[R] UseDevel: version requires a more recent R

2018-01-09 Thread Sariya, Sanjeev
Hello R experts:

I need a developer version of a Bioconductor library.

> sessionInfo()
R version 3.4.2 (2017-09-28)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

When I try to useDevel it fails.

I've removed packages and again loaded but I get the same error message.

remove.packages("BiocInstaller")
source("https://bioconductor.org/biocLite.R";)
library(BiocInstaller)

Bioconductor version 3.6 (BiocInstaller 1.28.0), ?biocLite for help


> useDevel()

Error: 'devel' version requires a more recent R

I'm running into this error for few days now. I close R after removing 
biocInstaller and proceed with following steps.

Please guide me to fix this.

Thanks,
SS

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] How to run mixed model with related independent variables

2018-01-26 Thread Sariya, Sanjeev
I've data that look like:

Outcome V1_AA  V1_EU  V1_NA  V2_AA  V2_EU  V2_NA
0  0.046 1.001 0.954 0.045 1.001 0.954
0  0.007 1  0.993 0.007 1  0.993
1  1.774 0.217 0.009 1.774 0.217 0.009
1  0.004 1.996 0  0.004 1.996 0
1  1.001 0.997 0.002 1.001 0.997 0.002
0  0.940.998 0.061 0.940.998 0.061
0  0.587 1.407 0.006 0.587 1.408 0.006
1  0.019 1.978 0.003 0.018 1.979 0.003

Column Outcome is dependent variable. It's dichotomous either 0 or 1.
Column 1st, 2nd, 3rd are three components of V1, similarly next three for V2. 
Sum of V1_AA, V1_EU and V1_NA will be two at each row. Similarly for V2 
variable's components.
Here the three predictors (I'm referring as component) are related. If AA is 
higher then, NA and EU will be lesser.

I cannot simply use multivariate regression as:

Y ~ V1_AA + V1_EU + V1_NA

How do I proceed with these data?

Thanks!


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Error while working with png output on linux server

2018-02-01 Thread Sariya, Sanjeev
I'm working on linux server:
Linux  4.9.0-4-amd64 #1 SMP Debian 4.9.51-1 (2017-09-28) x86_64 GNU/Linux

I get error while creating png files. I'm sharing my commands and error while I 
run those commands:

>png("abc", type="cairo")
Error in .External2(C_X11, paste0("png::", filename), g$width, g$height,  :
  unable to start device PNG
In addition: Warning message:
In png("abc", type = "cairo") : unable to open connection to X11 display ''

> png("apoeqqplot.png", res=600)
Error in .External2(C_X11, paste0("png::", filename), g$width, g$height,  :
  unable to start device PNG
In addition: Warning message:
In png("apoeqqplot.png", res = 600) :
  unable to open connection to X11 display ''

dev.off()

R version 3.4.2 (2017-09-28)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 9 (stretch)

Matrix products: default
BLAS: /mnt/mfs/cluster/bin/R-3.4/lib/libRblas.so
LAPACK: /mnt/mfs/cluster/bin/R-3.4/lib/libRlapack.so

locale:
[1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8   LC_NAME=C
[9] LC_ADDRESS=C   LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

other attached packages:
[1] CMplot_3.3.1

loaded via a namespace (and not attached):
[1] compiler_3.4.2 tools_3.4.2


How do I fix this?


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Error while working with png output on linux server

2018-02-01 Thread Sariya, Sanjeev
Thanks for pointing to FAQ: I tried with cairo (shared in commands), 
unfortunately didn't work. 

--
Sanjeev Sariya


-Original Message-
From: Jeff Newmiller [mailto:jdnew...@dcn.davis.ca.us] 
Sent: Thursday, February 01, 2018 10:12 AM
To: r-help@r-project.org; Sariya, Sanjeev ; 
r-help@r-project.org
Subject: Re: [R] Error while working with png output on linux server

FAQ 7.19?

Also, read the Posting Guide, in particular about posting using plain text. 
--
Sent from my phone. Please excuse my brevity.

On February 1, 2018 6:50:42 AM PST, "Sariya, Sanjeev" 
 wrote:
>I'm working on linux server:
>Linux  4.9.0-4-amd64 #1 SMP Debian 4.9.51-1 (2017-09-28) x86_64 
>GNU/Linux
>
>I get error while creating png files. I'm sharing my commands and error 
>while I run those commands:
>
>>png("abc", type="cairo")
>Error in .External2(C_X11, paste0("png::", filename), g$width, 
>g$height,  :
>  unable to start device PNG
>In addition: Warning message:
>In png("abc", type = "cairo") : unable to open connection to X11 
>display ''
>
>> png("apoeqqplot.png", res=600)
>Error in .External2(C_X11, paste0("png::", filename), g$width, 
>g$height,  :
>  unable to start device PNG
>In addition: Warning message:
>In png("apoeqqplot.png", res = 600) :
>  unable to open connection to X11 display ''
>
>dev.off()
>
>R version 3.4.2 (2017-09-28)
>Platform: x86_64-pc-linux-gnu (64-bit)
>Running under: Debian GNU/Linux 9 (stretch)
>
>Matrix products: default
>BLAS: /mnt/mfs/cluster/bin/R-3.4/lib/libRblas.so
>LAPACK: /mnt/mfs/cluster/bin/R-3.4/lib/libRlapack.so
>
>locale:
>[1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
>[3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8
>[5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8
>[7] LC_PAPER=en_US.UTF-8   LC_NAME=C
>[9] LC_ADDRESS=C   LC_TELEPHONE=C
>[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>
>attached base packages:
>[1] stats graphics  grDevices utils datasets  methods   base
>
>other attached packages:
>[1] CMplot_3.3.1
>
>loaded via a namespace (and not attached):
>[1] compiler_3.4.2 tools_3.4.2
>
>
>How do I fix this?
>
>
>   [[alternative HTML version deleted]]
>
>__
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Error while working with png output on linux server

2018-02-01 Thread Sariya, Sanjeev
Thanks for your reply. I searched for the error on Google before resorting to 
the R forum (help group).
I tried Sys.env(...) too, but didn't resolve the error I get. Hence I am 
looking for solution.


 
--


-Original Message-
From: Thierry Onkelinx [mailto:thierry.onkel...@inbo.be] 
Sent: Thursday, February 01, 2018 10:57 AM
To: Sariya, Sanjeev 
Cc: Jeff Newmiller ; r-help@r-project.org
Subject: Re: [R] Error while working with png output on linux server

Dear Sanjeev,

It seems that you system neither supports X11 devices nor cairo devices. See 
http://lmgtfy.com/?q=R+unable+to+open+connection+to+X11
for possible solutions.

Best regards,

ir. Thierry Onkelinx
Statisticus / Statistician

Vlaamse Overheid / Government of Flanders INSTITUUT VOOR NATUUR- EN 
BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE AND FOREST Team Biometrie & 
Kwaliteitszorg / Team Biometrics & Quality Assurance thierry.onkel...@inbo.be 
Havenlaan 88 bus 73, 1000 Brussel www.inbo.be

///
To call in the statistician after the experiment is done may be no more than 
asking him to perform a post-mortem examination: he may be able to say what the 
experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not 
data. ~ Roger Brinner The combination of some data and an aching desire for an 
answer does not ensure that a reasonable answer can be extracted from a given 
body of data. ~ John Tukey 
///




2018-02-01 16:18 GMT+01:00 Sariya, Sanjeev :
> Thanks for pointing to FAQ: I tried with cairo (shared in commands), 
> unfortunately didn't work.
>
> --
> Sanjeev Sariya
>
>
> -Original Message-
> From: Jeff Newmiller [mailto:jdnew...@dcn.davis.ca.us]
> Sent: Thursday, February 01, 2018 10:12 AM
> To: r-help@r-project.org; Sariya, Sanjeev ; 
> r-help@r-project.org
> Subject: Re: [R] Error while working with png output on linux server
>
> FAQ 7.19?
>
> Also, read the Posting Guide, in particular about posting using plain text.
> --
> Sent from my phone. Please excuse my brevity.
>
> On February 1, 2018 6:50:42 AM PST, "Sariya, Sanjeev" 
>  wrote:
>>I'm working on linux server:
>>Linux  4.9.0-4-amd64 #1 SMP Debian 4.9.51-1 (2017-09-28) x86_64 
>>GNU/Linux
>>
>>I get error while creating png files. I'm sharing my commands and 
>>error while I run those commands:
>>
>>>png("abc", type="cairo")
>>Error in .External2(C_X11, paste0("png::", filename), g$width, 
>>g$height,  :
>>  unable to start device PNG
>>In addition: Warning message:
>>In png("abc", type = "cairo") : unable to open connection to X11 
>>display ''
>>
>>> png("apoeqqplot.png", res=600)
>>Error in .External2(C_X11, paste0("png::", filename), g$width, 
>>g$height,  :
>>  unable to start device PNG
>>In addition: Warning message:
>>In png("apoeqqplot.png", res = 600) :
>>  unable to open connection to X11 display ''
>>
>>dev.off()
>>
>>R version 3.4.2 (2017-09-28)
>>Platform: x86_64-pc-linux-gnu (64-bit) Running under: Debian GNU/Linux 
>>9 (stretch)
>>
>>Matrix products: default
>>BLAS: /mnt/mfs/cluster/bin/R-3.4/lib/libRblas.so
>>LAPACK: /mnt/mfs/cluster/bin/R-3.4/lib/libRlapack.so
>>
>>locale:
>>[1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
>>[3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8
>>[5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8
>>[7] LC_PAPER=en_US.UTF-8   LC_NAME=C
>>[9] LC_ADDRESS=C   LC_TELEPHONE=C
>>[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>>
>>attached base packages:
>>[1] stats graphics  grDevices utils datasets  methods   base
>>
>>other attached packages:
>>[1] CMplot_3.3.1
>>
>>loaded via a namespace (and not attached):
>>[1] compiler_3.4.2 tools_3.4.2
>>
>>
>>How do I fix this?
>>
>>
>>   [[alternative HTML version deleted]]
>>
>>__
>>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 
>>https://stat.ethz.ch/mailman/listinfo/r-help
>>PLEASE do read the posting guide
>>http://www.R-project.org/posting-guide.html
>>and provide commented, minimal, self-contained, reproducible code.
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Error while working with png output on linux server

2018-02-01 Thread Sariya, Sanjeev
Thank you.

--
Sanjeev Sariya


-Original Message-
From: Jeff Newmiller [mailto:jdnew...@dcn.davis.ca.us] 
Sent: Thursday, February 01, 2018 12:09 PM
To: Sariya, Sanjeev ; Thierry Onkelinx 

Cc: r-help@r-project.org
Subject: RE: [R] Error while working with png output on linux server

This is not an R issue so this is not a good venue... it has to do with which 
support software you have (not) installed. Try the R-sig-debian mailing list. 
Please clarify to them how you installed R... for Debian there are relevant deb 
packages and a corresponding Debian repository that provide the simplest route 
to a working system, but if you compile it yourself it is easy to miss 
dependencies.
--
Sent from my phone. Please excuse my brevity.

On February 1, 2018 8:23:13 AM PST, "Sariya, Sanjeev" 
 wrote:
>Thanks for your reply. I searched for the error on Google before 
>resorting to the R forum (help group).
>I tried Sys.env(...) too, but didn't resolve the error I get. Hence I 
>am looking for solution.
>
>
> 
>--
>
>
>-Original Message-
>From: Thierry Onkelinx [mailto:thierry.onkel...@inbo.be]
>Sent: Thursday, February 01, 2018 10:57 AM
>To: Sariya, Sanjeev 
>Cc: Jeff Newmiller ; r-help@r-project.org
>Subject: Re: [R] Error while working with png output on linux server
>
>Dear Sanjeev,
>
>It seems that you system neither supports X11 devices nor cairo 
>devices. See http://lmgtfy.com/?q=R+unable+to+open+connection+to+X11
>for possible solutions.
>
>Best regards,
>
>ir. Thierry Onkelinx
>Statisticus / Statistician
>
>Vlaamse Overheid / Government of Flanders INSTITUUT VOOR NATUUR- EN 
>BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE AND FOREST Team Biometrie 
>& Kwaliteitszorg / Team Biometrics & Quality Assurance 
>thierry.onkel...@inbo.be Havenlaan 88 bus 73, 1000 Brussel www.inbo.be
>
>///
> To call in the statistician after the experiment 
>is done may be no more than asking him to perform a post-mortem 
>examination: he may be able to say what the experiment died of. ~ Sir 
>Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger 
>Brinner The combination of some data and an aching desire for an answer 
>does not ensure that a reasonable answer can be extracted from a given 
>body of data. ~ John Tukey 
>///
>
>
>
>
>
>2018-02-01 16:18 GMT+01:00 Sariya, Sanjeev :
>> Thanks for pointing to FAQ: I tried with cairo (shared in commands),
>unfortunately didn't work.
>>
>> --
>> Sanjeev Sariya
>>
>>
>> -Original Message-
>> From: Jeff Newmiller [mailto:jdnew...@dcn.davis.ca.us]
>> Sent: Thursday, February 01, 2018 10:12 AM
>> To: r-help@r-project.org; Sariya, Sanjeev ;
>
>> r-help@r-project.org
>> Subject: Re: [R] Error while working with png output on linux server
>>
>> FAQ 7.19?
>>
>> Also, read the Posting Guide, in particular about posting using plain
>text.
>> --
>> Sent from my phone. Please excuse my brevity.
>>
>> On February 1, 2018 6:50:42 AM PST, "Sariya, Sanjeev"
> wrote:
>>>I'm working on linux server:
>>>Linux  4.9.0-4-amd64 #1 SMP Debian 4.9.51-1 (2017-09-28) x86_64 
>>>GNU/Linux
>>>
>>>I get error while creating png files. I'm sharing my commands and 
>>>error while I run those commands:
>>>
>>>>png("abc", type="cairo")
>>>Error in .External2(C_X11, paste0("png::", filename), g$width, 
>>>g$height,  :
>>>  unable to start device PNG
>>>In addition: Warning message:
>>>In png("abc", type = "cairo") : unable to open connection to X11 
>>>display ''
>>>
>>>> png("apoeqqplot.png", res=600)
>>>Error in .External2(C_X11, paste0("png::", filename), g$width, 
>>>g$height,  :
>>>  unable to start device PNG
>>>In addition: Warning message:
>>>In png("apoeqqplot.png", res = 600) :
>>>  unable to open connection to X11 display ''
>>>
>>>dev.off()
>>>
>>>R version 3.4.2 (2017-09-28)
>>>Platform: x86_64-pc-linux-gnu (64-bit) Running under: Debian
>GNU/Linux
>>>9 (stretch)
>>>
>>>Matrix products: default
>>>BLAS: /mnt/mfs/cluster/bin/R-3.4/lib/libRblas.so
>>>LAPACK: /mnt/mfs/cluster/bin/R-3.4/lib/libRlapack.so
>>>
>>>locale:
>>>[1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
>&

Re: [R] change location of temporary files

2018-02-23 Thread Sariya, Sanjeev
You can set this in script as:

library("unixtools ")
set.tempdir("/home/path_to_dir/temp_dir/")

--
Sanjeev 

-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Kumar Mainali
Sent: Friday, February 23, 2018 1:53 PM
To: R Help 
Subject: [R] change location of temporary files

I would like to change where R stores the temporary files to my external hard 
drive in my iMac. This is important because the temporary files R creates are 
huge and I do not have enough available space in my internal HD. Again, this is 
for macOS.

This change has to be temporary. Later I need to use the usual location for 
temp files in the internal HD.

Thanks in advance,
Kumar Mainali

--
Postdoctoral Associate
Department of Biology
University of Maryland, College Park
ᐧ

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Help with apply and new column?

2018-03-05 Thread Sariya, Sanjeev
Hello members,

Can I ask question for apply, adding new column to data frame on this e-mail 
list?

Thanks!



[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Help with apply and new column?

2018-03-05 Thread Sariya, Sanjeev
Thanks. I think nabble is good for programming questions. Bear with me if I'm 
incorrect.

Data: Genomics SNP information 
Goal: I need to add Chromosome and SNP position to the data frame I'm using 
through apply.

I'd like to add new column from text processed through apply function.

For example:  10:60523:T:G  (Column 2)
CHR: 10
Position: 60523

Dataset:
chr rs  ps  n_miss  allele1 allele0 af  betase  l_remle 
p_wald
-9  10:60523:T:G-9  0   T   G   0.977   -1.769354e-02   
3.597196e-021.566731e-016.228309e-01
-9  10:60684:A:C-9  0   A   C   0.973   1.698925e-02
2.942366e-021.561001e-015.636926e-01
-9  10:61331:A:G-9  0   A   G   0.973   1.708586e-02
2.942424e-021.560944e-015.614851e-01
-9  10:62010:C:T-9  0   C   T   0.980   -8.513143e-03   
3.837054e-021.566875e-018.244260e-01

Code:


data<-read.table("small.txt",header = T) # read data
data<-data[,c(2,11)] #delete other columns not needed 

#--split data on : and get chromosome and position

split_rs<-function(rs){  

chr<-vector(,length(rs)) # create new vector to store chr
pos<-vector(,length(rs)) #create new vector to store position

for(i in 1:length(rs)){ #iterate over RS column

if(grepl(":",rs[i])){ #if : in column string 
temp <- strsplit(rs[i],":",fixed=T) #split
chr[i] <-temp[[1]][1] #store CHR
pos[i] <- temp[[1]][2]  #store position
}
}
return(list(chr=chr,pos=pos)) #return making a list
}

data$POS<-"NA" #add new column CHR and make NA 
data$CHR <- "NA" #add new column POS and make NA

temp<-apply(data,2,split_rs) #send data frame to function 

#--I assign value from list sent -- I would like to improve this part

data$CHR<-temp$rs$chr
data$POS<-temp$rs$pos

rm(temp)

colnames(data)<-c("SNP","P","CHR","BP")




-Original Message-
From: Jeff Newmiller [mailto:jdnew...@dcn.davis.ca.us] 
Sent: Monday, March 5, 2018 1:48 PM
To: r-help@r-project.org; Sariya, Sanjeev ; R Help 

Subject: Re: [R] Help with apply and new column?

Read the Posting Guide... (see message footer) ... some relevant things you can 
find there:

a) Yes, this appears to be about how to use an R base function so it is on topic
b) Post a reproducible example (include some sample data, preferably using the 
dput function)
c) Post using plain text so the mailing list doesn't convert it for you and 
mangle things in a way you did not intend. 
--
Sent from my phone. Please excuse my brevity.

On March 5, 2018 10:07:24 AM PST, "Sariya, Sanjeev"  
wrote:
>Hello members,
>
>Can I ask question for apply, adding new column to data frame on this 
>e-mail list?
>
>Thanks!
>
>
>
>   [[alternative HTML version deleted]]
>
>__
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Help with apply and new column?

2018-03-05 Thread Sariya, Sanjeev
Thank you, that helps. 

-Original Message-
From: Jeff Newmiller [mailto:jdnew...@dcn.davis.ca.us] 
Sent: Monday, March 5, 2018 3:36 PM
To: Sariya, Sanjeev 
Cc: r-help@r-project.org; R Help 
Subject: RE: [R] Help with apply and new column?

Comments interspersed, and some code at the end.

On Mon, 5 Mar 2018, Sariya, Sanjeev wrote:

> Thanks. I think nabble is good for programming questions. Bear with me 
> if I'm incorrect.

You may have found R-help archives at Nabble, but R-help has nothing to do with 
Nabble.

>
> Data: Genomics SNP information

I know almost nothing about using R for genomics.

> Goal: I need to add Chromosome and SNP position to the data frame I'm using 
> through apply.
>
> I'd like to add new column from text processed through apply function.
>
> For example:  10:60523:T:G  (Column 2)
> CHR: 10
> Position: 60523

Assuming Position is "P", what are your "SNP" and "BP" in the names you 
assigned below as c("SNP","P","CHR","BP")?

> Dataset:
> chr   rs  ps  n_miss  allele1 allele0 af  betase  l_remle 
> p_wald
> -910:60523:T:G-9  0   T   G   0.977   -1.769354e-02   
> 3.597196e-021.566731e-016.228309e-01
> -910:60684:A:C-9  0   A   C   0.973   1.698925e-02
> 2.942366e-021.561001e-015.636926e-01
> -910:61331:A:G-9  0   A   G   0.973   1.708586e-02
> 2.942424e-021.560944e-015.614851e-01
> -910:62010:C:T-9  0   C   T   0.980   -8.513143e-03   
> 3.837054e-021.566875e-018.244260e-01
>
> Code:
>
> 
> data<-read.table("small.txt",header = T) # read data 
> data<-data[,c(2,11)] #delete other columns not needed
>
> #--split data on : and get chromosome and position
>
> split_rs<-function(rs){
>
>chr<-vector(,length(rs)) # create new vector to store chr
>pos<-vector(,length(rs)) #create new vector to store position
>
>for(i in 1:length(rs)){ #iterate over RS column
>
>if(grepl(":",rs[i])){ #if : in column string
>temp <- strsplit(rs[i],":",fixed=T) #split
>chr[i] <-temp[[1]][1] #store CHR
>pos[i] <- temp[[1]][2]  #store position
>}
>}
>return(list(chr=chr,pos=pos)) #return making a list }
>
> data$POS<-"NA" #add new column CHR and make NA data$CHR <- "NA" #add 
> new column POS and make NA
>
> temp<-apply(data,2,split_rs) #send data frame to function
>
> #--I assign value from list sent -- I would like to improve this part
>
> data$CHR<-temp$rs$chr
> data$POS<-temp$rs$pos
>
> rm(temp)
>
> colnames(data)<-c("SNP","P","CHR","BP")
> 

##
# Your code was pretty severely broken... it would not run, # and I don't know 
what you expected to see as output.

# 1) data is the name of a function in base R... re-using
#it can lead to puzzling errors
# 2) With all this character manipulation, you need to read
#your character data in as character, not as factors
# 3) Don't use the T variable... use the constant TRUE,
#since T can easily be overwritten to some non-TRUE value.
dta <- read.table( "small.txt", header = TRUE, as.is = TRUE ) # read data dta 
<- dta[ , c( 2, 11 ) ] #delete other columns not needed

# 4) Not at all clear why you want to split all of the columns
#using apply( ..., 2, ... ) when only one column has ":" characters
#temp <- apply( dta, 2, split_rs ) #send data frame to function temp <- 
strsplit( dta$rs, ":" ) # gets the whole column splits at once

# wildly guessing here
rs_chrmatrix <- do.call( rbind, temp )
rs_DF <- as.data.frame( rs_chrmatrix, stringsAsFactors = FALSE ) names( rs_DF ) 
<- c( "CHR", "P", "X1", "X2" ) rs_DF$P <- as.integer( rs_DF$P )

str( rs_DF )
##




>
> -Original Message-
> From: Jeff Newmiller [mailto:jdnew...@dcn.davis.ca.us]
> Sent: Monday, March 5, 2018 1:48 PM
> To: r-help@r-project.org; Sariya, Sanjeev ; 
> R Help 
> Subject: Re: [R] Help with apply and new column?
>
> Read the Posting Guide... (see message footer) ... some relevant things you 
> can find there:
>
> a) Yes, this appears to be about how to use an R base function so it 
> is on topic
> b) Post a reproducible example (include some sample data, preferably 
> using the dput funct

Re: [R] Hacked

2018-04-17 Thread Sariya, Sanjeev
I've been receiving nasty e-mails too. No g-mail, but official/work e-mail 
address. 

-Original Message-
From: R-help  On Behalf Of Rui Barradas
Sent: Tuesday, April 17, 2018 5:09 PM
To: Ding, Yuan Chun ; Fowler, Mark ; 
Luis Puerto ; Peter Langfelder 

Cc: R-Help ML R-Project ; Neotropical bat risk 
assessments 
Subject: Re: [R] Hacked

Hello,

Nor do I, no gmail, also got spam.

Rui Barradas

On 4/17/2018 8:34 PM, Ding, Yuan Chun wrote:
> No, I do not use gmail, still got dirty spam email twice.
> 
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of 
> Fowler, Mark
> Sent: Tuesday, April 17, 2018 12:32 PM
> To: Luis Puerto; Peter Langfelder
> Cc: R-Help ML R-Project; Neotropical bat risk assessments
> Subject: Re: [R] Hacked
> 
> [Attention: This email came from an external source. Do not open 
> attachments or click on links from unknown senders or unexpected 
> emails.]
> 
> 
> 
> 
> 
> Just an observation. I have not seen the spam you are discussing. Possibly it 
> is specific to gmail addresses?
> 
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Luis 
> Puerto
> Sent: April 17, 2018 4:11 PM
> To: Peter Langfelder
> Cc: R-Help ML R-Project; Neotropical bat risk assessments
> Subject: Re: [R] Hacked
> 
> Hi!
> 
> This happened to me also! I just got a spam email just after posting and then 
> in following days I got obnoxious spam emails in my spam filter. As the 
> others, I think that there is some kind of bot subscribed to the list, but 
> also perhaps a spider or crawler monitoring the R-Help archive and getting 
> email addresses there. Nabble is a possibility too.
> 
>> On 17 Apr 2018, at 21:50, Peter Langfelder  
>> wrote:
>>
>> I got some spam emails after my last post to the list, and the emails 
>> did not seem to go through r-help. The spammers may be subscribed to 
>> the r-help, or they get the poster emails from some of the web copies 
>> of this list (nabble or similar).
>>
>> Peter
>>
>> On Tue, Apr 17, 2018 at 11:37 AM, Ulrik Stervbo  
>> wrote:
>>> I asked the moderators about it. This is the reply
>>>
>>> "Other moderators have looked into this a bit and may be able to 
>>> shed more light on it. This is a "new" tactic where the spammers 
>>> appear to reply to the r-help post. They are not, however, going through 
>>> the r-help server.
>>>
>>> It also seems that this does not happen to everyone.
>>>
>>> I am not sure how you can automatically block the spammers.
>>>
>>> Sorry I cannot be of more help."
>>>
>>> --Ulrik
>>>
>>> Jeff Newmiller  schrieb am Di., 17. Apr.
>>> 2018,
>>> 14:59:
>>>
 Likely a spammer has joined the mailing list and is auto-replying 
 to posts made to the list. Unlikely that the list itself has been 
 "hacked". Agree that it is obnoxious.

 On April 17, 2018 5:01:10 AM PDT, Neotropical bat risk assessments 
 < neotropical.b...@gmail.com> wrote:
> Hi all,
>
> Site has been hacked?
> Bad SPAM arriving
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

 --
 Sent from my phone. Please excuse my brevity.

 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

>>>
>>> [[alternative HTML version deleted]]
>>>
>>> __
>>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do r

Re: [R] Something simple not working in group_by

2018-07-09 Thread Sariya, Sanjeev
Strange. Worked fine on:

R version 3.4.2 (2017-09-28)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 9 (stretch)

Commands:

m <- data.frame( id = rep(1:3, each=2), score = rep(c(6,3), each=3) )

as.data.frame(m %>% group_by(id) %>% mutate(total = cumsum(score)))

  id score total
1  1 6 6
2  1 612
3  2 6 6
4  2 3 9
5  3 3 3
6  3 3 6

-Original Message-
From: R-help  On Behalf Of Sumitrajit Dhar
Sent: Monday, July 9, 2018 5:35 PM
To: r-help@r-project.org
Subject: [R] Something simple not working in group_by

Hi Folks,

I am trying to get a group_by cumsum using:

R version 3.5.0 (2018-04-23) -- "Joy in Playing"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (64-bit)

Here is an example of a simple construct that is not working.

m <- data.frame( id = rep(1:3, each=2), score = rep(c(6,3), each=3) )

m %>% group_by(id) %>% mutate(total = cumsum(score))

My output:

# A tibble: 6 x 3
# Groups:   id [3]
 id score total

1 1 6 6
2 1 612
3 2 618
4 2 321
5 3 324
6 3 327

What am I missing? Thanks in advance.

Regards,
Sumit

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.