Created
October 17, 2020 16:05
-
-
Save ifknot/dc514d9910e51604907be0f1700d85d6 to your computer and use it in GitHub Desktop.
read_csv, as_dates example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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