Hello Ana Marija,
Apologies, the warning escaped me. When Pheno is assigned NA .
> a=a[,PHENO:=NA]
It is assigned a NA of type logical by default. We just have to make
sure it is an NA of type numeric
> a[,PHENO:=1.0*NA]
So the full set of commands is:
library(data.table)
setDT(a)
a[,PHENO:=
Thank you again for your help and giving me the opportunity to choose
the efficient method. For a small data set there is no discernable
difference between the different approaches. I will carry out a
comparison using the large data set.
On Wed, Sep 23, 2020 at 11:52 AM LMH wrote:
>
> Below
Hi Jeremie,
when I try to reproduce your code this is what I get:
> a=setDT(a)
> head(a)
FID IID CURRELIG PLASER RTNPTHY
1: fam0110 G1102 2 2
2: fam0113 G1132 2 2
3: fam0114 G1142 2 2
4: fam0117 G1172 2 2
5: fam01
Hello,
Thanks for the further explanation.
I believe that yes, it would be a good idea to document a bit better
that "apart from fuzz" is a rounding operation, it is said en passant,
and its meaning is not clear.
Rui Barradas
Às 21:25 de 23/09/20, Duncan Murdoch escreveu:
On 23/09/2020 4:0
On 23/09/2020 4:03 p.m., Rui Barradas wrote:
Hello,
I believe that though Duncan's explanation is right it is also not
explaining the value of the digits argument. round makes the first 2
numbers 0 but why?
If there had been rounding in their computation, you might see a
difference like 1e-15
Hello,
I believe that though Duncan's explanation is right it is also not
explaining the value of the digits argument. round makes the first 2
numbers 0 but why? The function below prints the digits argument and
then outputs d. The code is taken from jitter.
f <- function(x){
z <- diff(r
Hello Ana Marija,
I cannot reproduce your error,
with a$PHENO=ifelse(a$PLASER==2 |a$RTNPTHY==2, 2, ifelse(a$CURRELIG==1 |
a$RTNPTHY==1,1,NA))
For instance I have the expected PHENO=2
> FID IID CURRELIG PLASER RTNPTHY PHENO
> 39: fam5706 G57061 1 2 2
In gen
Hello,
R 4.0.2 on Ubuntu 20.04, sessionInfo at end.
This came up in r-help, I'm answering to the OP and also posting to
r-devel since I believe it is more appropriate there.
I can confirm this. The original instructions are the first and the
last, but even with smaller numbers the error shows
Nested ifelse()'s are confusing and invite error.
Just use ?within and subscript with your conditions:
dat$PHENO <- NA ## initialize PHENO
> dat <- ## to return the modified result
within(dat, {
+ PHENO[CURRELIG ==1] <- 1
+ PHENO[CURRELIG == 1 & PLASER == 2] <- 2
+ PHENO[CURRELIG ==
I tried doing this:
a$PHENO=ifelse(a$PLASER==2 | a$RTNPTHY==2,2,ifelse(a$CURRELIG==1 |
a$RTNPTHY==1,1,NA))
which brought be closer to the solution, but now I have lines like this:
FID IID CURRELIG PLASER RTNPTHY PHENO
fam3151 G31511 1 NANA
fam3149 G31492
Below is a script in bash the uses the awk tokenizer to do the work.
This assumes that your input and output delimiter is space. The number of
consecutive delimiters in
the input is not important. This also assumes that the input file does not have
a header row. That
is easy to modify if you wan
Hello,
I have a data frame as shown bellow.
I want to create a new column PHENO which will be defined as follows:
if CURRELIG==1 -> PHENO==1
in the above subset those that have:
PLASER==2 -> PHENO==2
and
those where RTNPTHY==1 -> PHENO==1
I tried doing this:
a$PHENO=ifelse(a$CURRELIG==1 | a$RTNPT
What is the delimiter is in the input data? Is it tab, space, etc?
Is this going to be the same for the output data that you will use for R input?
LMH
Val wrote:
> Thank you all for the help!
>
> LMH, Yes I would like to see the alternative. I am using this for a
> large data set and if the
On 23/09/2020 6:32 a.m., Martin Keller-Ressel wrote:
Dear all,
i have noticed some strange behaviour in the „jitter“ function in R.
On the help page for jitter it is stated that
"The result, say r, is r <- x + runif(n, -a, a) where n <- length(x) and a is
the amount argument (if specified).“
Hello,
I’d like to apologise as I understand that this is a significant amount of
code, but I am struggling to understand why my code develops an error when
running. I have been able to obtain results for the list of matrices named xdot
and ydot but am struggling with zdot as I keep getting the
Dear all,
i have noticed some strange behaviour in the „jitter“ function in R.
On the help page for jitter it is stated that
"The result, say r, is r <- x + runif(n, -a, a) where n <- length(x) and a is
the amount argument (if specified).“
and
"If amount is NULL (default), we set a <- factor *
Hello,
I have an experiment measuring optical density (OD) when comparing
three parameters:
a) concentration of the target
b) concentration of the probe
c) concentration of the reporter antibody.
Using plotrix I can nicely draw the first two into clusters, but I
can't get separation for the third p
...or try R-patched, which I'm told has the newer GUI.
-pd
> On 21 Sep 2020, at 21:43 , Berend Hasselman wrote:
>
>
>
>> On 21 Sep 2020, at 20:24, Gonçalo Ferraz wrote:
>>
>> Hello,
>>
>> I’ve been using R-studio for a while and today I needed to try something
>> directly on the R-GUI.
>>
Hello,
If speed is important, and following the previous discussion and Bert's
tests, here are two other alternatives, both faster.
1. Bert2 is Bert's original but with scan(., sep = "_") substituted for
unlist/strsplit.
2. A package data.table solution. These are always fast, many times the
19 matches
Mail list logo