Skip to content

Instantly share code, notes, and snippets.

@ifknot
Created October 17, 2020 16:05
Show Gist options
  • Save ifknot/dc514d9910e51604907be0f1700d85d6 to your computer and use it in GitHub Desktop.
Save ifknot/dc514d9910e51604907be0f1700d85d6 to your computer and use it in GitHub Desktop.
read_csv, as_dates example
#include <iostream>
#include "data_frame.h"
#include "read_csv.h"
#include "head.h"
#include "as_dates.h"
using namespace R;
int main() {
std::cout << "read dumb data into heterogeneous container\n\n";
auto car_data = read_csv("mpg.csv");
try {
car_data["year"] = as_dates({ car_data["year"] }, "%Y");
}
catch (const std::exception& e) {
std::cerr << e.what() << "\n\n";
}
std::cout << head(car_data);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment