[R] tidyverse: read_csv() misses column
Rich Shepard
r@hep@rd @end|ng |rom @pp|-eco@y@@com
Mon Nov 1 18:29:13 CET 2021
On Mon, 1 Nov 2021, Jeff Newmiller wrote:
> More explicitly... look at rows past the first row. If your csv has 300
> rows and column 1 has something non-numeric in row 299 then the whole
> column gets imported as character data. Try
> cor_disc[[ 1 ]] |> as.numeric() |> is.na() |> where()
> to find suspect rows. You may want to read about the na argument to read_csv in ?read_csv.
Jeff,
cor_disc has 415264 rows.
> cor_disc[[ 1 ]] |> as.numeric() |> is.na() |> where()
Error in where(is.na(as.numeric(cor_disc[[1]]))) :
could not find function "where"
Searching for 'where' in ?read_csv finds only
where each character represents one column:
And, if there was such a non-numeric in any row of column 1 wouldn't
read.csv() also catch it and throw an error?
Thanks,
Rich
More information about the R-help
mailing list