Sorry... untested code... use which... not where.
On November 1, 2021 10:29:13 AM PDT, Rich Shepard <rshepard at
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 at 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.