Re: [R] detecting null values in a CSV file

2008-09-19 Thread jim holtman
You can always do this if they are single valued vectors: if ((!is.na(data_filter)) & (!is.na(trigger)) & (data_filter == trigger)) This will catch the condition where either is an NA and therefore not do the final compare which was giving your error. On Fri, Sep 19, 2008 at 9:48 AM, Jason

Re: [R] detecting null values in a CSV file

2008-09-19 Thread Jason Thibodeau
On a related note, I am trying to do some matching using conditional statements. These NULL values are being brought in to my data frame as NA, as expected, but in a conditional if() statement, I cannot compare then to a integer value, it fails the program. Here is a small snippet of where the erro

Re: [R] detecting null values in a CSV file

2008-09-18 Thread Hutchinson,David [PYR]
Try length(na.omit()) Here's an example: data <- runif(100,0,10) data[runif(20,0,100)] <- NA file.contents <- matrix(data, ncol = 5, byrow = TRUE) for (i in 1:5) { print (length(na.omit(file.contents[,i]))) } -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Beh

Re: [R] detecting null values in a CSV file

2008-09-18 Thread Jason Thibodeau
Phil's suggestion worked like a charm. My NA's were counted in the frequency table. Thanks for the help, all! On Thu, Sep 18, 2008 at 1:28 PM, Henrik Bengtsson <[EMAIL PROTECTED]>wrote: > What have you tried this far? Can't you parse them as missing values, > i.e. NAs? See ?read.csv and argum

Re: [R] detecting null values in a CSV file

2008-09-18 Thread Jason Thibodeau
I haven't given it a shot yet. To complicate matters further, this file I have already passed through a filter, which has already converted my null values to NA. your insight might be of assistance. On Thu, Sep 18, 2008 at 1:30 PM, Sebastian Weirich <[EMAIL PROTECTED]>wrote: Hello, maybe you lo

Re: [R] detecting null values in a CSV file

2008-09-18 Thread Henrik Bengtsson
What have you tried this far? Can't you parse them as missing values, i.e. NAs? See ?read.csv and arguments '...', i.e. the arguments '...' are passed to read.table() which takes argument 'na.strings' - a character *vector* of strings that you want to be interpreted as NAs. See ?read.table for m