HI Jim
thank you so much! This is amazing answer!!!
Ana
On Sat, Jun 13, 2020 at 4:09 AM Jim Lemon wrote:
>
> Right, back from shopping. Since you have fourteen rows containing NAs
> and you only want seven, we can infer that half of them must go. As
> they are neatly divided into seven rows in
On 2020-06-13 19:09 +1000, Jim Lemon wrote:
> Right, back from shopping. Since you have fourteen rows containing NAs
> and you only want seven, we can infer that half of them must go. As
> they are neatly divided into seven rows in which only one NA appears
> and seven in which two stare meaningles
Dear Ana,
pmax could also fit here.
pmax(b$FLASER, b$PLASER, na.rm = TRUE)
Bests,
Mark
> --
>
> Message: 21
> Date: Sat, 13 Jun 2020 19:09:11 +1000
> From: Jim Lemon
> To: sokovic.anamar...@gmail.com
> Cc: Rasmus Liland , r-help
>
Right, back from shopping. Since you have fourteen rows containing NAs
and you only want seven, we can infer that half of them must go. As
they are neatly divided into seven rows in which only one NA appears
and seven in which two stare meaninglessly out at us. I will assume
that the latter are the
Great idea!
Here it is:
> b[is.na(b$FLASER) | is.na(b$PLASER),]
FID IID FLASER PLASER pheno
1: fam1837 G1837 1 NA 2
2: fam2410 G2410 NA NA 2
3: fam2838 G2838 NA 2 2
4: fam3367 G3367 1 NA 2
5: fam3410 G3410 1 NA 2
6: fam
Since you have only a few troublesome NA values, if you look at them,
or even better, post them:
b[is.na(b$FLASER) | is.na(b$PLASER),]
perhaps we can work out the appropriate logic to get rid of only the
ones you don't want.
Jim
On Sat, Jun 13, 2020 at 12:50 PM Ana Marija wrote:
>
> Hi Rasmus,
Hi Rasmus,
thank you for getting back to be, the command your provided seems to
add all 11 NAs to 2s
> b$pheno <-
+ ifelse(b$PLASER==2 |
+ b$FLASER==2 |
+ is.na(b$PLASER) |
+ is.na(b$PLASER) & b$FLASER %in% 1:2 |
+ is.na
On 2020-06-13 11:30 +1000, Jim Lemon wrote:
> On Fri, Jun 12, 2020 at 8:06 PM Jim Lemon wrote:
> > On Sat, Jun 13, 2020 at 10:46 AM Ana Marija wrote:
> > >
> > > I am trying to make a new column
> > > "pheno" so that I reduce the number
> > > of NAs
> >
> > it looks like those two NA values in
>
Obviously my guess was wrong. I thought you wanted to impute the value
of "pheno" from FLASER if PLASER was missing. From just your summary
table, it's hard to guess the distribution of NA values. My guess that
the two undesirable NAs were cases where PLASER was missing and FLASER
was 2. My tactic
Hi Jim,
I tried it:
> b$pheno<-ifelse(b$PLASER==2 | b$FLASER==2 |is.na(b$PLASER) & b$FLASER ==
> 2,2,1)
> table(b$pheno,exclude = NULL)
12
859 828 11
> b$pheno<-ifelse(b$PLASER==2 | b$FLASER==2 |is.na(b$FLASER) & b$PLASER ==
> 2,2,1)
> table(b$pheno,exclude = NULL)
12
859
Hi Ana,
>From your desired result, it looks like those two NA values in PLASER
are the ones you want to drop.
If so, try this:
b$pheno<-ifelse(b$PLASER==2 | b$FLASER==2 |
is.na(b$PLASER) & b$FLASER == 2,2,1)
and if I have it the wrong way round, swap FLASER and PLASER in the
bit I have added.
J
Hello
I have a data frame like this:
> head(b)
FID IID FLASER PLASER
1: fam1000 G1000 1 1
2: fam1001 G1001 1 1
3: fam1003 G1003 1 2
4: fam1005 G1005 1 1
5: fam1009 G1009 1 1
6: fam1052 G1052 1 1
...
> table(b$PLASER,b$FLASER, e
12 matches
Mail list logo