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

Erik Iverson iverson at biostat.wisc.edu
Tue Jul 1 20:12:56 CEST 2008


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.



More information about the R-help mailing list