Hi Kai,
You can also try this:
proband_crc2 %>%
mutate(MMR = replace(MMR, MMR =="NA", "-"))
Thanks,
Kostas
On Wed, Jun 2, 2021 at 11:59 AM Jim Lemon wrote:
> Hi Kai,
> Maybe this will help:
>
> proband_crc2<-data.frame(MMR=rep(c(NA,"+"),3))
> proband_crc2
> proband_crc2$MMR[is.na(proband_cr
Hello Jim,Your example works well.Thank you for your help,Kai
On Tuesday, June 1, 2021, 04:59:09 PM PDT, Kai Yang via R-help
wrote:
Hi List,
I have a column MMR in a data frame proband_crc2. The column contents missing
value and + (means positive).
I need to replace all missing value
Hi Kai,
Maybe this will help:
proband_crc2<-data.frame(MMR=rep(c(NA,"+"),3))
proband_crc2
proband_crc2$MMR[is.na(proband_crc2$MMR)]<-"-"
proband_crc2
Jim
On Wed, Jun 2, 2021 at 9:59 AM Kai Yang via R-help wrote:
>
> Hi List,
> I have a column MMR in a data frame proband_crc2. The column content
A unary negative sign with no number is not a number, so it has to be
character. If you are done with computations you can format your numbers as
character data and set the NA to "-", but such a conversion will prevent you
from performing computations so it is only useful for creating report tab
z <- x
z[is.na(z)] <- y
z
#[1] 20 40 3 50 1
A.K.
On Tuesday, December 24, 2013 12:06 PM, Kathryn Lord
wrote:
Dear R users,
I have two different vectors like below
x <- c( NA, NA, 3, NA, 1)
y <- c( 20, 40 ,50)
Combining x and y, I'd like to create new vector z
z <- c(20, 40, 3, 50, 1
Hi,
c1 = (1,2,3,4,5,6,NA,7,8,NA,9,10,NA)
library(zoo)
na.locf(c1)
# [1] 1 2 3 4 5 6 6 7 8 8 9 10 10
A.K.
Hi, I want to "fix" an array that contains several NA elements. And I
would like to replace them with the previous valid element.
So my array c = (1,2,3,4,5,6,NA,7,8,NA,9,10,NA
On Jul 29, 2013, at 9:39 AM, iza.ch1 wrote:
> Hi everyone
>
> I have a problem with replacing the NA values with the mean of the column
> which contains them. If I replace Na with the means of the rest values in the
> column, the mean of the whole column will be still the same as if I would
>
': 5 obs. of 3 variables:
$ AllNAs : num NaN NaN NaN NaN NaN
$ NoNAs : num 1 2 3 4 5
$ SomeNAs: cplx 100+1i 100+1i 100+1i ...
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
> -Original Message-----
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r
Hi,
de<- structure(c(NA, NA, NA, NA, NA, NA, NA, NA, 0.27500571, -3.07568579,
-0.42240954, -0.26901731, 0.01766284, -0.8099958, 0.20805934,
0.03036708, -0.26928087, 1.20925752, 0.38012008, -0.41778861,
-0.49677462, -0.13248754, -0.54179054, 0.35788624, -0.41467591,
-0.59234248, 0.73642396, -0.
On 29-07-2013, at 18:39, "iza.ch1" wrote:
> Hi everyone
>
> I have a problem with replacing the NA values with the mean of the column
> which contains them. If I replace Na with the means of the rest values in the
> column, the mean of the whole column will be still the same as if I would
>
Consider the following:
f <- function(x){
m <- mean(x, na.rm = TRUE)
x[is.na(x)] <- m
x
}
apply(de, 2, f)
HTH,
Jorge.-
On Tue, Jul 30, 2013 at 2:39 AM, iza.ch1 wrote:
> Hi everyone
>
> I have a problem with replacing the NA values with the mean of the column
> which contains them. If I repla
Dear iza.ch1,
I hesitate to say this, because mean imputation is such a bad idea, but it's
easy to do what you want with a loop, rather than puzzling over a "cleverer"
way to accomplish the task. Here's an example using the Freedman data set in
the car package:
> colSums(is.na(Freedman))
popul
On 29-07-2013, at 18:39, "iza.ch1" wrote:
> Hi everyone
>
> I have a problem with replacing the NA values with the mean of the column
> which contains them. If I replace Na with the means of the rest values in the
> column, the mean of the whole column will be still the same as if I would
>
Hi,
If your geology map is a special kind of object, this may not work,
but if you are just dealing with a data frame or matrix type object
named, "geology" with columns, something like this ought to do the
trick:
geology[is.na(geology[, "landform"]), "landform"] <- 0
?is.na returns a logical ve
try 'na.locf' in the zoo package
On Mon, Jun 21, 2010 at 7:52 AM, Patrick Hausmann
wrote:
> Dear list,
>
> I'm trying to replace NA-values with the preceding values in that column.
> This code works, but I am sure there is a more elegant way...
>
> df <- data.frame(id = c("A1", NA, NA, NA, "B1",
Hi
r-help-boun...@r-project.org napsal dne 17.03.2010 18:01:50:
>
> Building on the question how to replace NA with 0.
>
> My data set below has date, station 1, flags for station 1, station 2,
flags
> for station 2, etc...
>
> I would like to make the values in the station columns equal to 1
Building on the question how to replace NA with 0.
My data set below has date, station 1, flags for station 1, station 2, flags
for station 2, etc...
I would like to make the values in the station columns equal to 1 and the NA
in the station columns equal to 0 and then sum each row for the numbe
It works just the same as matrices:
> z <- zoo(cbind(a = c(1, NA, 3), b = c(NA, 10, 11)))
> z[is.na(z)] <- 999
> z
a b
1 1 999
2 999 10
3 3 11
>
There are also a number of other methods for handling NAs in zoo:
na.approx
na.contiguous
na.locf
na.spline
na.trim
and na.stinterp in the
Seconded.
--- Greg Snow <[EMAIL PROTECTED]> wrote:
>
>
>
> > -Original Message-
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of
> Gabor Csardi
> > Sent: Friday, September 14, 2007 2:56 AM
> > To: S Ellison
> &
On 14-Sep-07 09:22:36, S Ellison wrote:
> Being a chemist, I have to confess that I can't always tell
> that what I'm about to attempt is barking, trivial, uninteresting
> or better done a completely different way; myself, I'd rather be
> warned too often than left to dig my own pit and fall into i
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Gabor Csardi
> Sent: Friday, September 14, 2007 2:56 AM
> To: S Ellison
> Cc: [EMAIL PROTECTED]
> Subject: Re: [R] replace NA value with 0
I nominate the following parag
>>> Ted Harding <[EMAIL PROTECTED]> 14/09/2007 10:59:47 >>>
>On the contrary! It adds to our "collective wisdom".
>
>We all have to suck eggs, and usually can successfully perform the act.
Ted,
Thanks for the kind remarks.
But we'll have to get off the egg topic, or we'll all end up as acknowl
On Fri, Sep 14, 2007 at 10:22:36AM +0100, S Ellison wrote:
[...]
> knee-jerk. Apologies if I'm teaching egg-sucking to an expert.
No apologies please. As i said I _like_ it. Thanks :)
G
> S
>
> ***
> This email and any attachment
>>On Fri, Sep 14, 2007 at 09:46:57AM +0100, S Ellison wrote:
>>
>>... only you probably shouldn't be doing that at all. Words like 'bias'
>>spring to mind...
>>
>> Woudn't it be better to accept the NA's and find methods that handle them as
>> genuinely missing.
>> R is usually quite good at
On Fri, Sep 14, 2007 at 09:46:57AM +0100, S Ellison wrote:
>
>
> >>> Gabor Csardi <[EMAIL PROTECTED]> 14/09/2007 09:27:03 >>>
> >x[ is.na(x) ] <- 0
> >
> >should work in most cases i think.
>
> ... only you probably shouldn't be doing that at all. Words like 'bias'
> spring to mind...
>
> Woud
>>> Gabor Csardi <[EMAIL PROTECTED]> 14/09/2007 09:27:03 >>>
>x[ is.na(x) ] <- 0
>
>should work in most cases i think.
... only you probably shouldn't be doing that at all. Words like 'bias' spring
to mind...
Woudn't it be better to accept the NA's and find methods that handle them as
genuine
x[ is.na(x) ] <- 0
should work in most cases i think.
Gabor
On Fri, Sep 14, 2007 at 10:08:19AM +0200, Alfredo Alessandrini wrote:
> Hi,
>
> how can I replace NA value with 0:
>
> 1991 217 119 103 109 137 202 283 240 146 NA
> 1992 270 174 149 144 166 239 278 237 275 NA
> 1993 146 111 104
27 matches
Mail list logo