search for: na_character

Displaying 3 results from an estimated 3 matches for "na_character".

Did you mean: na_character_
2009 Oct 28
1
replacing <NA> in character column
I have a small Excel data file with two columns of character variables, one column with a numeric variable and three rows. One of the character cells is blank and one of the numeric cells is blank. I read the data file with the following code: library(RODBC) channel <- odbcConnectExcel('u:/test.xls') sqlTables(channel) s1 <- sqlFetch(channel, "Sheet1")
2011 Mar 14
2
data.frame transformation
Hi R users, I have following data frame df<-data.frame(q1=c(0,0,33.33,"check"),q2=c(0,33.33,"check",9.156), q3=c("check","check",25,100),q4=c(7.123,35,100,"check")) and i would like to replace every element that is less then 10 with . (dot) in order to obtain this: q1 q2 q3 q4 1 . . check . 2 . 33.33 check 35
2011 Aug 30
4
weird apply() behavior
Hi, I had a weird results from using apply(). Here is an simple example: > y<-data.frame(list(a=c(1,NA),b=c('2k','0'))) > y ??? a???? b 1? 1?? 2k 2 NA?? 0 > apply(y,1,function(x){x<-unlist(x); if (!is.na(x[2]) & x[2]=='2k' & !is.na(x[1]) & x[1]=='1') 1 else 0} ) This should print "1 0" as output, as demonstrated by: >