search for: data_cleaned

Displaying 1 result from an estimated 1 matches for "data_cleaned".

2008 Feb 12
3
regular expression for na.strings / read.table
...78 56 89 56 100 ...but which would work (Stars are still there)! Do anyone knows how to do that ? 2-Second solution: - first read the file with DATA<-read.csv("test.txt") - then replace all fields containing a * with NA in applying the following function to the object DATA: DATA_cleaned<-apply(DATA,c(1,2),function(x){if(length(grep("\\*",x,value=TRUE))==1){x<-NA}}) DATA_cleaned X1 X.789 LNM. X78 X56 X89 X56.1 X100 [1,] NULL NULL NULL NULL NULL NULL NULL NULL [2,] NULL NULL NULL NULL NULL NULL NULL NULL [3,] NULL NULL NULL NULL NULL NULL NULL NA...