Re: [R] how to handle missing values "." when importing data in R

2010-01-12 Thread karena
thank you guys. All the columns of my data are numeric. I tried both methods, and they both work. I appreciate your help. -k -- View this message in context: http://n4.nabble.com/how-to-handle-missing-values-when-importing-data-in-R-tp1012298p1012397.html Sent from the R help mailing list arc

Re: [R] how to handle missing values "." when importing data in R

2010-01-12 Thread jim holtman
What is the structure of the data that you are reading in? Are you using 'read.table', 'scan', etc.? Are all the columns numeric, or do you just want to change some of them? If you have used 'na.strings' to cause the values of the missing data to be set to NA, then you can iterate through the ap

Re: [R] how to handle missing values "." when importing data in

2010-01-12 Thread Ted Harding
On 12-Jan-10 17:46:47, karena wrote: > hi, I have a question about importing data in R. > > I want to import a file which has missing value in it, and the missing > values are denoted as ".", I want to first read in the file, and then > change the "." into the number zero "0". > > how can I do th

Re: [R] how to handle missing values "." when importing data in R

2010-01-12 Thread karena
Hi, tim, thank you very much for the reply, but I am really a new user. How to change all NAs to zero? thanks again. karena jholtman wrote: > > ?read.table > > na.strings='.' > > Then change all NAs to zero df$col[is.na(df$col)] <- 0 > > On Tue, Jan 12, 2010 at 12:46 PM, karena wrote

Re: [R] how to handle missing values "." when importing data in R

2010-01-12 Thread jim holtman
?read.table na.strings='.' Then change all NAs to zero df$col[is.na(df$col)] <- 0 On Tue, Jan 12, 2010 at 12:46 PM, karena wrote: > > hi, I have a question about importing data in R. > > I want to import a file which has missing value in it, and the missing > values are denoted as ".", I w

[R] how to handle missing values "." when importing data in R

2010-01-12 Thread karena
hi, I have a question about importing data in R. I want to import a file which has missing value in it, and the missing values are denoted as ".", I want to first read in the file, and then change the "." into the number zero "0". how can I do that? thank you, karena -- View this message in c