[R] tidyverse: read_csv() misses column

Jeff Newmiller jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Mon Nov 1 18:55:42 CET 2021


Sorry... untested code... use which... not where.

On November 1, 2021 10:29:13 AM PDT, Rich Shepard <rshepard using appl-ecosys.com> wrote:
>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
>
>______________________________________________
>R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

-- 
Sent from my phone. Please excuse my brevity.



More information about the R-help mailing list