RE: is.na(v)-b (was: Re: [R] Beginner's query - segmentation fault)

2003-10-15 Thread Simon Fear
: [R] Beginner's query - segmentation fault) Security Warning: If you are not sure an attachment is safe to open please contact Andy on x234. There are 0 attachments with this message. By accident I'm also toying around

RE: is.na(v)-b (was: Re: [R] Beginner's query - segmentation fault)

2003-10-15 Thread Paul Lemmens
Hello Simon, --On woensdag 15 oktober 2003 10:08 +0100 Simon Fear [EMAIL PROTECTED] wrote: By the way, `is.na(x) - FALSE` will leave x unchanged (including leaving it as NA ! how bad is that ?!) Twilight Zone (Golden Earring). But with that remark I'm getting off topic, so thank you for your

RE: is.na(v)-b (was: Re: [R] Beginner's query - segmentation fault)

2003-10-14 Thread Paul Lemmens
By accident I'm also toying around with NA's, so I started reading up on this thread but failed to find a 'concluding' remark or advice. As a naive R user I would have loved to see a comment do it like this. The prevailing opinion seemed to be that is.na() might be better (safer) but x - NA is

RE: is.na(v)-b (was: Re: [R] Beginner's query - segmentation fault)

2003-10-09 Thread Simon Fear
-Original Message- From: Richard A. O'Keefe [mailto:[EMAIL PROTECTED] snip The very existence of an is.na- which accepts a logical vector containing FALSE as well as TRUE ... And don't forget this is not the only usage of is.na-. In fact it is designed to take any valid indexing

Re: is.na(v)-b (was: Re: [R] Beginner's query - segmentation fault)

2003-10-08 Thread Uwe Ligges
Richard A. O'Keefe wrote: I am puzzled by the advice to use is.na(x) - TRUE instead of x - NA. ?NA says Function `is.na-' may provide a safer way to set missingness. It behaves differently for factors, for example. However, MAY provide is a bit scary, and it doesn't say WHAT the

RE: is.na(v)-b (was: Re: [R] Beginner's query - segmentation fault)

2003-10-08 Thread Simon Fear
Note this behaviour: a-a a-NA mode(a) [1] logical a-a is.na(a) - T mode(a) [1] character However after either way of assigning NA to a, is.na(a) is true, and it prints as NA, so I can't see it's ever likely to matter. [Why do I say these things? Expect usual flood of examples where it

RE: is.na(v)-b (was: Re: [R] Beginner's query - segmentation fault)

2003-10-08 Thread Prof Brian Ripley
On Wed, 8 Oct 2003, Simon Fear wrote: Note this behaviour: a-a a-NA mode(a) [1] logical a-a is.na(a) - T mode(a) [1] character However after either way of assigning NA to a, is.na(a) is true, and it prints as NA, so I can't see it's ever likely to matter. [Why do I say these

RE: is.na(v)-b (was: Re: [R] Beginner's query - segmentation fault)

2003-10-08 Thread Simon Fear
Well, that's a convincing argument, but maybe it's the name that's worrying some of us. Maybe it would be more intuitive if called set.na (sorry, I mean setNA). Also is.na- cannot be used to create a new variable of NAs, so is not a universal method, which is a shame for its advocates. I

RE: is.na(v)-b (was: Re: [R] Beginner's query - segmentation fault)

2003-10-08 Thread Gabor Grothendieck
Also, presumably is.na- could be redefined by the user for particular classes so if you got in the habit of setting NAs that way it would generalize better. --- Date: Wed, 8 Oct 2003 11:49:29 +0100 (BST) From: Prof Brian Ripley [EMAIL PROTECTED] I don't think it can ever `go wrong', but it

RE: is.na(v)-b (was: Re: [R] Beginner's query - segmentation fault)

2003-10-08 Thread Richard A. O'Keefe
Simon Fear [EMAIL PROTECTED] suggested that a-a a-NA mode(a) [1] logical a-a is.na(a) - T mode(a) [1] character might be a relevant difference between assigning NA and using is.na. But the analogy is flawed: is.na(x) -

RE: is.na(v)-b (was: Re: [R] Beginner's query - segmentation fault)

2003-10-08 Thread Richard A. O'Keefe
Concerning x[i] - NA vs is.na(x[i]) - TRUE Brian Ripley wrote: I don't think it can ever `go wrong', but it can do things other than the user intends. If the user writes x[i] - NA, the user has clearly indicated his intention that the i element(s) of x should become NA. There

Re: is.na(v)-b (was: Re: [R] Beginner's query - segmentation fault)

2003-10-08 Thread Duncan Murdoch
Tongue in cheek But surely is.na(x) - is.na(x) is clearer than x[is.na(x)] - NA (neither of which is a no-op). /Tongue in cheek __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Re: [R] Beginner's query - segmentation fault

2003-10-07 Thread Peter Dalgaard BSA
Laura Quinn [EMAIL PROTECTED] writes: I am dealing with a huge matrix in R (20 columns, 54000 rows) and have lots of missing values within the dataset which are currently displayed as the value -999.00 I am trying to create a new matrix (or change the existing one) to display these values as

Re: [R] Beginner's query - segmentation fault

2003-10-07 Thread Prof Brian Ripley
On Tue, 7 Oct 2003, Laura Quinn wrote: I am dealing with a huge matrix in R (20 columns, 54000 rows) and have lots of missing values within the dataset which are currently displayed as the value -999.00 I am trying to create a new matrix (or change the existing one) to display these values as

RE: [R] Beginner's query - segmentation fault

2003-10-07 Thread Adaikalavan RAMASAMY
I cannot explain the segmentation fault but try this instead (which works for matrices) temp[which(temp==-999, arr.ind=T)] - NA Are you sure temp is matrix and not a dataframe ? Use class(temp) to find out. Also, if you are getting these -999.00 because you have read files containing them, it

Re: [R] Beginner's query - segmentation fault

2003-10-07 Thread Uwe Ligges
Laura Quinn wrote: I am dealing with a huge matrix in R (20 columns, 54000 rows) and have lots of missing values within the dataset which are currently displayed as the value -999.00 I am trying to create a new matrix (or change the existing one) to display these values as NA so that I can then

Re: [R] Beginner's query - segmentation fault

2003-10-07 Thread Laura Quinn
thanks, have used temp [temp==0]- NA and this seems to have worked, though it won't let me access individual columns (ie temp$t1 etc) to work on - is there any real advantage in using a matrix, or would i be better advised to deal with dataframes? (I have double checked and temp is currently a

Re: [R] Beginner's query - segmentation fault

2003-10-07 Thread Uwe Ligges
Adaikalavan RAMASAMY wrote: I cannot explain the segmentation fault but try this instead (which works for matrices) temp[which(temp==-999, arr.ind=T)] - NA No! Please *do* use is.na()- !!! Uwe Ligges Are you sure temp is matrix and not a dataframe ? Use class(temp) to find out. Also, if you

Re: [R] Beginner's query - segmentation fault

2003-10-07 Thread Prof Brian Ripley
On Tue, 7 Oct 2003, Laura Quinn wrote: thanks, have used temp [temp==0]- NA and this seems to have worked, though it won't let me access individual columns (ie temp$t1 etc) to work on - is there any real advantage in using a matrix, or would i be better advised to deal with dataframes?

Re: [R] Beginner's query - segmentation fault

2003-10-07 Thread Uwe Ligges
Laura Quinn wrote: thanks, have used temp [temp==0]- NA Please use is.na(temp[temp==0]) - TRUE and this seems to have worked, though it won't let me access individual columns (ie temp$t1 etc) No! temp$t1 is a list element or column of a data.frame, but not a column of a matrix. *PLEASE*,

is.na(v)-b (was: Re: [R] Beginner's query - segmentation fault)

2003-10-07 Thread Richard A. O'Keefe
I am puzzled by the advice to use is.na(x) - TRUE instead of x - NA. ?NA says Function `is.na-' may provide a safer way to set missingness. It behaves differently for factors, for example. However, MAY provide is a bit scary, and it doesn't say WHAT the difference in behaviour is. I