: [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
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
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
-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
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
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
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
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
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
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) -
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
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
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
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
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
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
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
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
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?
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*,
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
21 matches
Mail list logo