Re: [R] Ignore blank columns when reading a row from a table

From: Erik Iverson <iverson_at_biostat.wisc.edu>
Date: Tue, 01 Jul 2008 13:12:56 -0500

It depends what you mean by 'ignore'. Some functions have an na.rm argument which throws out NAs before computing the statistic.

if the vector 'x' has NAs, then

x <- x[!is.na(x)]

may be what you're looking for. This removes NAs from x and reassigns the value to x.

naw3_at_duke.edu wrote:
> Hi,
>
> I am extracting data from a table where the rows have different column lengths,
> and empty columns have NA in them. Whenever I extract a row with some empty
> columns, the resulting vector carries all the NAs. Is there a way to ignore the
> empty columns?
>
> Thanks,
> -Nina
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> 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.



R-help_at_r-project.org mailing list
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. Received on Tue 01 Jul 2008 - 18:15:51 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 01 Jul 2008 - 18:31:43 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive