I'm importing a raw csv file using read_csv.
- The raw csv file contains
date column, on import it's converted to col_datetime format.
- I create a column
seas (short for season) using the code
df <- mutate(df, seas = ifelse(month(date) < 5, year(date) - 1, year(date)))
- I run the code
group_by(df, seas) %>% tally() to check the seasons calculated properly. The output looks good. No NA values.
| seas |
n |
| 1999 |
642 |
| 2000 |
648 |
| 2001 |
644 |
| 2002 |
666 |
| 2003 |
664 |
| 2004 |
664 |
| 2005 |
666 |
- Export the dataframe with the new
seas column using write_csv.
- Import the new csv (the one created in the step above) and get the error.
Warning: 648 parsing failures.
| row |
col |
expected |
actual |
file |
| 1453 |
seas |
no trailing characters |
e3 |
'df_cleaned.csv' |
| 1454 |
seas |
no trailing characters |
e3 |
'df_cleaned.csv' |
| 1455 |
seas |
no trailing characters |
e3 |
'df_cleaned.csv' |
| 1456 |
seas |
no trailing characters |
e3 |
'df_cleaned.csv' |
| 1457 |
seas |
no trailing characters |
e3 |
'df_cleaned.csv' |
.... .... ...................... ...... ....................
See problems(...) for more details.
- Even though the 2000
seas (season) calculated properly before the export (see the dataframe results in step 3), upon import something is triggering a parsing issue.
unique(nfl$seas)
[1] 1995 1996 1997 1998 1999 NA 2001 2002 2003 2004 2005 2006 2007
[14] 2008 2009 2010 2011 2012 2013 2014 2015 2016
filter(df, is.na(seas)) %>% select(date, seas) produces
A tibble: 648 × 2
| date |
seas |
| 2000-07-29 |
NA |
| 2000-07-29 |
NA |
| 2000-07-30 |
NA |
| 2000-07-30 |
NA |
read.csv works with no issues.
I'm importing a raw csv file using
read_csv.datecolumn, on import it's converted tocol_datetimeformat.seas(short for season) using the codedf <- mutate(df, seas = ifelse(month(date) < 5, year(date) - 1, year(date)))group_by(df, seas) %>% tally()to check the seasons calculated properly. The output looks good. No NA values.seascolumn usingwrite_csv.Warning: 648 parsing failures.
.... .... ...................... ...... ....................
See problems(...) for more details.
seas(season) calculated properly before the export (see the dataframe results in step 3), upon import something is triggering a parsing issue.unique(nfl$seas)filter(df, is.na(seas)) %>% select(date, seas)producesA tibble: 648 × 2
read.csvworks with no issues.