Re: [R] Convert NA to '.'

2009-06-22 Thread David Winsemius
On Jun 22, 2009, at 1:21 PM, Jorge Ivan Velez wrote: Hi David, It works for me when handling data frames mixing characters and numeric by using either print() or a function called "foo": # Some data x <- c("A", "B", "C", 3.5, 1, 0, NA, "a character",NA, "another character") mydata <- dat

Re: [R] Convert NA to '.'

2009-06-22 Thread Jorge Ivan Velez
Hi David, It works for me when handling data frames mixing characters and numeric by using either print() or a function called "foo": # Some data x <- c("A", "B", "C", 3.5, 1, 0, NA, "a character",NA, "another character") mydata <- data.frame(x = x, y = sample(x)) mydata # Option 1: print()ing pr

Re: [R] Convert NA to '.'

2009-06-22 Thread David_D
Jorge, Thanks a lot for your reply. It's indeed working in this case. However, with data frames mixing numeric and character is not working anymore. Morever I am working with many variables and I don't want to modify them. What I would really appreciate is a global option (in the Rprofile?) that

Re: [R] Convert NA to '.'

2009-06-22 Thread Jorge Ivan Velez
Dear David, Try this: x <- c("A", "B", "C", NA) x[is.na(x)] <- "." x HTH, Jorge On Mon, Jun 22, 2009 at 2:11 AM, David_D wrote: > > Dear R-users, > > For reporting purpose (using Sweave and LaTeX), I am creating complex > tables > with the cat function such as > > > x<-c("A", "B", "C", NA) >

[R] Convert NA to '.'

2009-06-22 Thread David_D
Dear R-users, For reporting purpose (using Sweave and LaTeX), I am creating complex tables with the cat function such as > x<-c("A", "B", "C", NA) > cat(x, '\n') A B C NA For convenience, I would like to change all my NA value to something else like '.' (as in SAS for example). Is there a globa