[R] running Cox regression model for 1000 markers

2017-12-13 Thread Ding, Yuan Chun
HI All, Sorry to bother you. I have a data matrix with 1000 genes in rows and 100 samples in columns; I need to run Cox regression model for each of the 1000 markers. I know how to run Cox regression model for individual marker. Does anyone know a R package or method to run Cox model for tho

Re: [R] consolidate three function into one

2018-01-14 Thread Ding, Yuan Chun
HI R users, I construct dendrogram tree and cut the tree into different clusters, then generate survival curves by the following three functions. All variables are included in an inputfile. Can you help me to consolidate the following three function into one functions? I thought about using

Re: [R] consolidate three function into one

2018-01-14 Thread Ding, Yuan Chun
. Thanks, Ding From: Bert Gunter [mailto:bgunter.4...@gmail.com] Sent: Sunday, January 14, 2018 9:50 AM To: Ding, Yuan Chun Subject: Re: [R] consolidate three function into one I have not looked at your code *at all*, so I am not sure what exactly you mean by "consolidate." Is this wh

Re: [R] consolidate three function into one

2018-01-14 Thread Ding, Yuan Chun
main = "Survival curve",pval = TRUE,font.x = 16,font.y = 16, font.tickslab = 14,font.legend =c(14,"plain","black"), legend = "bottom", legend.title = "Tree Cluster", legend.labs = legend.labs,

Re: [R] consolidate three function into one

2018-01-15 Thread Ding, Yuan Chun
s)", main = "Survival curve",pval = TRUE,font.x = 16,font.y = 16, font.tickslab = 14,font.legend =c(14,"plain","black"), legend = "bottom", legend.title = "Tree Cluster", legend.labs = legend.labs

Re: [R] consolidate three function into one

2018-01-15 Thread Ding, Yuan Chun
writing R function and need to find a good guide source about writing R functions. If you know a good book or website for guidance of R function, please let me know. Thanks, Ding From: Bert Gunter [mailto:bgunter.4...@gmail.com] Sent: Monday, January 15, 2018 10:11 AM To: Ding, Yuan Chun Cc

[R] please help me a little

2018-02-09 Thread Ding, Yuan Chun
Hi R Users, I am very frustrated with the following code. Please do me a favor to run it. after reading into the test data set (I also pasted the data set below), the first line of code for "res_coxphf" did not work and generated the error code below. but the other three line worked well. the

Re: [R] data analysis for partial two-by-two factorial design

2018-03-02 Thread Ding, Yuan Chun
Dear R users, I need to analyze data generated from a partial two-by-two factorial design: two levels for drug A (yes, no), two levels for drug B (yes, no); however, data points are available only for three groups, no drugA/no drugB, yes drugA/no drugB, yes drugA/yes drug B, omitting the fourt

Re: [R] data analysis for partial two-by-two factorial design

2018-03-02 Thread Ding, Yuan Chun
Hi Bert, Thank you so much for your direction, I have asked a question on stackexchange website. Ding From: Bert Gunter [mailto:bgunter.4...@gmail.com] Sent: Friday, March 02, 2018 12:32 PM To: Ding, Yuan Chun Cc: r-help@r-project.org Subject: Re: [R] data analysis for partial two-by-two

Re: [R] data analysis for partial two-by-two factorial design

2018-03-05 Thread Ding, Yuan Chun
= drug A + drug B? any suggestion is appreciated. From: Bert Gunter [mailto:bgunter.4...@gmail.com] Sent: Friday, March 02, 2018 12:32 PM To: Ding, Yuan Chun Cc: r-help@r-project.org Subject: Re: [R] data analysis for partial two-by-two factorial design [Attention

Re: [R] data analysis for partial two-by-two factorial design

2018-03-05 Thread Ding, Yuan Chun
, March 05, 2018 2:27 PM To: David Winsemius Cc: Ding, Yuan Chun; r-help@r-project.org Subject: Re: [R] data analysis for partial two-by-two factorial design David: I believe your response on SO is incorrect. This is a standard OFAT (one factor at a time) design, so that assuming additivity (no

Re: [R] data analysis for partial two-by-two factorial design

2018-03-05 Thread Ding, Yuan Chun
-help-boun...@r-project.org] On Behalf Of Ding, Yuan Chun Sent: Monday, March 05, 2018 2:45 PM To: Bert Gunter; David Winsemius Cc: r-help@r-project.org Subject: Re: [R] data analysis for partial two-by-two factorial design Hi Bert and David, Thank you so much for willingness to spend some time on

Re: [R] data analysis for partial two-by-two factorial design

2018-03-05 Thread Ding, Yuan Chun
insem...@comcast.net] Sent: Monday, March 05, 2018 3:55 PM To: Bert Gunter Cc: Ding, Yuan Chun; r-help@r-project.org Subject: Re: [R] data analysis for partial two-by-two factorial design > On Mar 5, 2018, at 3:04 PM, Bert Gunter wrote: > > But of course the whole point of additivity is to

[R] error message from sqldf

2018-03-10 Thread Ding, Yuan Chun
Dear R users, I got the following error message from running sqldf code in R. do you know how to fix it? I read the sqldf package instruction and did not find a solution. Thank you, Ding chr10 <- sqldf("select * from manifest where CHR==10") UCN3cpg <- sqldf("select * from chr10 where MA

[R] how to write a loop to repetitive jobs

2018-04-16 Thread Ding, Yuan Chun
Hi All.., I need to do the following repetitive jobs: seg71 <- read.csv("C:/Awork/geneAssociation/removed8samples/neuhausen71/seg.pr3.csv", head=T) seg71$id <-"sn71" seg72 <- read.csv("C:/Awork/geneAssociation/removed8samples/neuhausen72/seg.pr3.csv", head=T) seg72$id <-"sn72" seg73 <- rea

Re: [R] how to write a loop to repetitive jobs

2018-04-16 Thread Ding, Yuan Chun
Hi Rui, Thank you very much!! It worked very well, I am looking into how to use lapply and do.call. Ding -Original Message- From: Rui Barradas [mailto:ruipbarra...@sapo.pt] Sent: Monday, April 16, 2018 2:16 PM To: Ding, Yuan Chun; r-help@r-project.org Subject: Re: [R] how to write a

Re: [R] Hacked

2018-04-17 Thread Ding, Yuan Chun
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 Subj

[R] merge two data frame based on equal and unequal comparisons

2018-04-18 Thread Ding, Yuan Chun
Dear R users, I need to merge two data frames based on both equal and unequal comparisons. The "sqldf" package used to work well , but today, I cannot resolve the following error by reinstallation of the sqldf package. Can anyone suggest a different way to perform this kind of merge function

Re: [R] merge two data frame based on equal and unequal comparisons

2018-04-18 Thread Ding, Yuan Chun
;- sqldf("select * from DMR_log2pbde47 as a left join DMS_log2pbde47 as b on a.chrom = b.chromo and a.start <= b.MAPINFO and a.end >= b.MAPINFO", method = "raw" ) -Original Message- From: R-help [mailto:r-help-boun...@r-project.org]

[R] create multiple categorical variables in a data frame using a loop

2018-04-19 Thread Ding, Yuan Chun
Hi All, I want to create a categorical variable, cat.pfoa, in the file of pfas.pheno (a data frame) based on log2pfoa values. I can do it using the following code. pfas.pheno <-within(pfas.pheno, {cat.pfoa<-NA cat.pfoa[pfas.pheno$log2pfoa <=quantile(pfas.pheno$log2pfoa,0.25, na.rm =T)]<-0 c

Re: [R] create multiple categorical variables in a data frame using a loop

2018-04-19 Thread Ding, Yuan Chun
Hi Rui, Thank you very much for your help!! It works very well, I got it. Ding -Original Message- From: Rui Barradas [mailto:ruipbarra...@sapo.pt] Sent: Thursday, April 19, 2018 11:35 AM To: Ding, Yuan Chun ; r-help@r-project.org Subject: Re: [R] create multiple categorical

Re: [R] create multiple categorical variables in a data frame using a loop

2018-04-20 Thread Ding, Yuan Chun
Hi David, Thank you so much for your kind suggestion and fixing my code!! I learn a lot from you today. Ding -Original Message- From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: Thursday, April 19, 2018 6:58 PM To: Ding, Yuan Chun Cc: r-help@r-project.org Subject: Re: [R

[R] add one variable to a data frame

2018-05-11 Thread Ding, Yuan Chun
Hi All, I have a data frame dat1: dat1 <-data.frame(N=seq(1, 12,1), B=c("29_log","29_log", "29_log", "27_cat", "27_cat", "1_log", "1_log", "1_log", "1_log", "1_log",

Re: [R] add one variable to a data frame

2018-05-11 Thread Ding, Yuan Chun
Hi Sarah, Thank you so much!! I got your good ideas. Ding -Original Message- From: Sarah Goslee [mailto:sarah.gos...@gmail.com] Sent: Friday, May 11, 2018 11:40 AM To: Ding, Yuan Chun Cc: r-help mailing list Subject: Re: [R] add one variable to a data frame [Attention: This email came

Re: [R] add one variable to a data frame

2018-05-11 Thread Ding, Yuan Chun
h of each value, and unique values dat1$sarah2 <- rep(seq_len(length(unique(dat1$B))), times=rle(as.vector(dat1$B))$lengths) #seq_along(x) is the same as seq_len(length(x)) dat1$D <- rep(seq_along(unique(dat1$B)), times=rle(as.vector(dat1$B))$lengths)

Re: [R] add one variable to a data frame

2018-05-11 Thread Ding, Yuan Chun
and then got answer after coming back from lunch. I am a beginner in R, so question might be trivial. Ding From: Bert Gunter [mailto:bgunter.4...@gmail.com] Sent: Friday, May 11, 2018 1:37 PM To: Sarah Goslee Cc: Ding, Yuan Chun; r-help mailing list Subject: Re: [R] add one variable to a data

[R] find common regions between two kinds of tests

2018-05-15 Thread Ding, Yuan Chun
Dear R community, For 100 sites at human chromosomes, I ran two tests, one is to consider an experiment measurement as a continuous variable, so doing multiple regression; the other is to compare top 25% samples to bottom 25% samples based on values of the measured variable, so categorical an

[R] heatmap.2, adding a legend at bottom

2018-10-04 Thread Ding, Yuan Chun
Hi All, I generated the attached heatmap using the following R code and attached testfile. I tried to move the legend to the bottom, Can anyone help me? I have play for 3 hours and can not resolve the problem. Thank you, Ding --

Re: [R] heatmap.2, adding a legend at bottom

2018-10-04 Thread Ding, Yuan Chun
Hi All, I generated the attached heatmap using the following R code and attached testfile. I tried to move the legend to the bottom, Can anyone help me? I have played for 3 hours and can not resolve the problem. I realized that in the last email, I forgot to include the "Group" variable for

Re: [R] heatmap.2, adding a legend at bottom

2018-10-04 Thread Ding, Yuan Chun
Hi David, Thank you so much!! Problem resolved. xpd=TRUE does the trick to put a legend outside. Ding -Original Message- From: David L Carlson [mailto:dcarl...@tamu.edu] Sent: Thursday, October 04, 2018 12:09 PM To: Ding, Yuan Chun; r-help@r-project.org Subject: RE: heatmap.2, adding

[R] calculate Euclidean distances between populations in R with this data structure

2014-09-04 Thread Ding, Yuan Chun
I want to calculate Euclidean distance between 12 populations, in each population there are 20 samples and each sample is measured for 100 genes (these are microarray data; the numbers here are just examples). The equation I found is: distance = sqrt{[sum(Average of xi -average of yi)^2] /n },

Re: [R] calculate Euclidean distances between populations in R with this data structure

2014-09-04 Thread Ding, Yuan Chun
R package to do it. Thanks, Ding -Original Message- From: Sarah Goslee [mailto:sarah.gos...@gmail.com] Sent: Thursday, September 04, 2014 4:49 PM To: Ding, Yuan Chun Cc: r-help@R-project.org Subject: Re: [R] calculate Euclidean distances between populations in R with this data structure