[R] vector replacement 1/0 to P/A
Hi, Can someone suggest an efficient way to substitute a vector/matrix which contains 1's and 0's to P's and A's (resp.)? Thanks, Lana __ R-help@r-project.org mailing list 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] saving loess fit
Hi, pv.lo - loess(Affy ~ DABG, DA, span=0.2, degree=2, family=symmetric) I would like to know how to save the output from the loess fit so that I can read it again into another session of R. Can someone help me figure this out? Lana Schaffer Biostatistics/Informatics The Scripps Research Institute DNA Array Core Facility La Jolla, CA 92037 (858) 784-2263 (858) 784-2994 schaf...@scripps.edu __ R-help@r-project.org mailing list 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 with make with R-devel
Hi, I am getting an error compiling the R-devel on a suse architecture 64-bit architecture. The cp attribute is sending 'trusted.lov' and an error. This is a sample of the output: make[3]: Entering directory `/lustre/people/schaffer/R-devel/src/library/base' building package 'base' make[4]: Entering directory `/lustre/people/schaffer/R-devel/src/library/base' all.R is unchanged cmp: EOF on ../../../library/base/R/base cp: getting attribute `trusted.lov' of `all.R': Operation not permitted make[4]: *** [mkR] Error 1 make[4]: Leaving directory `/lustre/people/schaffer/R-devel/src/library/base' make[3]: *** [all] Error 2 Is there someone who can modify the Makefile so that I am able to compile R-devel? Lana Schaffer Biostatistics/Informatics The Scripps Research Institute DNA Array Core Facility La Jolla, CA 92037 (858) 784-2263 (858) 784-2994 schaf...@scripps.edu __ R-help@r-project.org mailing list 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 with make
Hi, I am trying to compile the R-dev version on a unix Suse machine and got errors. Would someone be able to help me determine what to do to fix these errors: make[1]: Entering directory `/lustre/people/schaffer/R-devel/m4' make[1]: Nothing to be done for `R'. make[1]: Leaving directory `/lustre/people/schaffer/R-devel/m4' make[1]: Entering directory `/lustre/people/schaffer/R-devel/tools' make[1]: Nothing to be done for `R'. make[1]: Leaving directory `/lustre/people/schaffer/R-devel/tools' make[1]: Entering directory `/lustre/people/schaffer/R-devel/doc' make[2]: Entering directory `/lustre/people/schaffer/R-devel/doc/html' make[3]: Entering directory `/lustre/people/schaffer/R-devel/doc/html/search' make[3]: Leaving directory `/lustre/people/schaffer/R-devel/doc/html/search' make[2]: Leaving directory `/lustre/people/schaffer/R-devel/doc/html' make[2]: Entering directory `/lustre/people/schaffer/R-devel/doc/manual' make[2]: Nothing to be done for `R'. make[2]: Leaving directory `/lustre/people/schaffer/R-devel/doc/manual' make[1]: Leaving directory `/lustre/people/schaffer/R-devel/doc' make[1]: Entering directory `/lustre/people/schaffer/R-devel/etc' make[1]: Leaving directory `/lustre/people/schaffer/R-devel/etc' make[1]: Entering directory `/lustre/people/schaffer/R-devel/share' make[1]: Leaving directory `/lustre/people/schaffer/R-devel/share' make[1]: Entering directory `/lustre/people/schaffer/R-devel/src' make[2]: Entering directory `/lustre/people/schaffer/R-devel/src/scripts' creating src/scripts/R.fe make[3]: Entering directory `/lustre/people/schaffer/R-devel/src/scripts' mkdir -p -- ../../bin make[3]: Leaving directory `/lustre/people/schaffer/R-devel/src/scripts' make[2]: Leaving directory `/lustre/people/schaffer/R-devel/src/scripts' make[2]: Entering directory `/lustre/people/schaffer/R-devel/src/include' mkdir -p -- ../../include cp: getting attribute `trusted.lov' of `Rmath.h0': Operation not permitted make[2]: *** [Rmath.h] Error 1 make[2]: Leaving directory `/lustre/people/schaffer/R-devel/src/include' make[1]: *** [R] Error 1 make[1]: Leaving directory `/lustre/people/schaffer/R-devel/src' make: *** [R] Error 1 Lana Schaffer Biostatistics/Informatics The Scripps Research Institute DNA Array Core Facility La Jolla, CA 92037 (858) 784-2263 (858) 784-2994 schaf...@scripps.edu __ R-help@r-project.org mailing list 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] subset function within a function
Hi, I am using this subset statement and it works outside a function. LIS[[i]]- lapply(LI, subset, select=cov[[i]]) However, wrapped inside a function this statement produces the same values for every LIS[[1]] which is only the first subset of LI. Does anyone know why is not working correctly inside a function? ff = factor(covariate) nLev - nlevels(ff) cov - vector(mode=list,length=nLev) for (gp in 1:nLev) { cov[[gp]] - covariate == levels(ff)[gp] } LIS - vector(mode=list,length=nLev) #if (SINGLE == T ) LIS[[1]] - LI else {} for (i in 1:nLev) LIS[[i]]- lapply(LI, subset, select=cov[[i]]) Lana Schaffer Biostatistics/Informatics The Scripps Research Institute DNA Array Core Facility La Jolla, CA 92037 (858) 784-2263 (858) 784-2994 [EMAIL PROTECTED] __ R-help@r-project.org mailing list 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] adding a package in Windows
Hi, I am using version R2.7.0 and I have installed Rtools27.exe. Upon calling R CMD INSTALL I got this error: .../src/gnuwin32/MakePkg:1: missing separator Can someone tell me what is wrong? Lana Schaffer Biostatistics/Informatics The Scripps Research Institute DNA Array Core Facility La Jolla, CA 92037 (858) 784-2263 (858) 784-2994 [EMAIL PROTECTED] __ R-help@r-project.org mailing list 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] converting numbers to characters
Hi, I need to convert numbers to characters in order to index an array when I encountered the number 10 which turned into 1e+05. Does anyone know how to get around this problem? Lana Schaffer Biostatistics/Informatics The Scripps Research Institute DNA Array Core Facility La Jolla, CA 92037 (858) 784-2263 (858) 784-2994 [EMAIL PROTECTED] __ R-help@r-project.org mailing list 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] converting numbers to characters
Hi, I need to convert numbers to characters in order to index an array when I encountered the number 10 which turned into 1e+05. Does anyone know how to get around this problem? Lana Schaffer Biostatistics/Informatics The Scripps Research Institute DNA Array Core Facility La Jolla, CA 92037 (858) 784-2263 (858) 784-2994 [EMAIL PROTECTED] __ R-help@r-project.org mailing list 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] alternative to matching/merge?
Jim, I understand that that do.call will combine all the lists into a matrix. But I have a list,x, which is a list of a list as in x[[1]] and x[[2]] which are themselves lists. Then using do.call(rbind, x) would combine both x[[1]] and x[[2]] into a matrix. I want to keep x[[1]] and x[[2]] separately into their own matrix, and so I am putting do.call into a loop ie. do.call(rbind,x[[i]]) to keep them separate. More elegantly I would want to put do.call into lapply but have not been successful to do this. Lana -Original Message- From: jim holtman [mailto:[EMAIL PROTECTED] Sent: Monday, June 16, 2008 5:24 PM To: Lana Schaffer Cc: hadley wickham; r-help@r-project.org Subject: Re: [R] alternative to matching/merge? Is this what you tried: x - data.frame(a=1:10, b=1:10) x - data.frame(a=1:3, b=1:3) do.call(rbind, list(x,x,x,x,x)) a b 1 1 1 2 2 2 3 3 3 4 1 1 5 2 2 6 3 3 7 1 1 8 2 2 9 3 3 10 1 1 11 2 2 12 3 3 13 1 1 14 2 2 15 3 3 On Mon, Jun 16, 2008 at 7:36 PM, Lana Schaffer [EMAIL PROTECTED] wrote: Jim, Is it possible to do a do.call(rbind,d.frame) with a list like using lapply(data,func,args)? I have not successfully executed this. Lana -Original Message- From: hadley wickham [mailto:[EMAIL PROTECTED] Sent: Friday, June 13, 2008 2:54 PM To: jim holtman Cc: Lana Schaffer; r-help@r-project.org Subject: Re: [R] alternative to matching/merge? On Fri, Jun 13, 2008 at 11:45 AM, jim holtman [EMAIL PROTECTED] wrote: What is the structure of 'd.frame' and 'segFile'? Run Rprof so that we can see which of the functions it is spending its time in. What happens if x$index is not in seqFile$index? Are the values in the 'index' unique in both structures? Subsetting a data frame can be expensive when compared to using a matrix. Could you use a matrix instead of a data frame; are all the columns the same mode? Again either a subset of data would be helpful or an 'str' on the data objects being used so that we can understand what they are. A few other ideas to try: * try merging do.call(rbind, d.frame) and seqFile, and then spliting the results back up * try turning giving seqFile rownames (rownames(seqFile) - seqFile$index) and then use character matching: cbind(x, seqFile[ as.character(x$index)] * if there is a one to one corresponding between index in seqFile and all data.frames in d.frame, merge all of the d.frames together, order both by index then just cbind Hadley -- http://had.co.nz/ -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? __ R-help@r-project.org mailing list 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] alternative to matching/merge?
Jim, Is it possible to do a do.call(rbind,d.frame) with a list like using lapply(data,func,args)? I have not successfully executed this. Lana -Original Message- From: hadley wickham [mailto:[EMAIL PROTECTED] Sent: Friday, June 13, 2008 2:54 PM To: jim holtman Cc: Lana Schaffer; r-help@r-project.org Subject: Re: [R] alternative to matching/merge? On Fri, Jun 13, 2008 at 11:45 AM, jim holtman [EMAIL PROTECTED] wrote: What is the structure of 'd.frame' and 'segFile'? Run Rprof so that we can see which of the functions it is spending its time in. What happens if x$index is not in seqFile$index? Are the values in the 'index' unique in both structures? Subsetting a data frame can be expensive when compared to using a matrix. Could you use a matrix instead of a data frame; are all the columns the same mode? Again either a subset of data would be helpful or an 'str' on the data objects being used so that we can understand what they are. A few other ideas to try: * try merging do.call(rbind, d.frame) and seqFile, and then spliting the results back up * try turning giving seqFile rownames (rownames(seqFile) - seqFile$index) and then use character matching: cbind(x, seqFile[ as.character(x$index)] * if there is a one to one corresponding between index in seqFile and all data.frames in d.frame, merge all of the d.frames together, order both by index then just cbind Hadley -- http://had.co.nz/ __ R-help@r-project.org mailing list 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] alternative to matching/merge?
Jim, My code is this: mergefunc - function(x,seqFile){ # merge(seqFile,x) cbind(x, seqFile[ match(as.vector(x$index), as.vector(seqFile$index)), ]) } LIX - lapply(d.frame[[1]], mergefunc,seqFile=seqFile) Each matrix/data.frame takes 0.2 seconds and then to do this 1240 times takes ~4 minutes. Thanks, Lana -Original Message- From: jim holtman [mailto:[EMAIL PROTECTED] Sent: Thursday, June 12, 2008 6:40 PM To: Lana Schaffer Cc: r-help@r-project.org Subject: Re: [R] alternative to matching/merge? It would be nice if you at least included the code that you are using and a subset of the data. Have you run Rprof to determine which of the functions is consuming the time? On Thu, Jun 12, 2008 at 3:25 PM, Lana Schaffer [EMAIL PROTECTED] wrote: Greetings, I am doing matching/merge for a table (40919x3) to data which is in the form of a list of 1268 data.frames. Using lapply this is taking ~5 minutes. I know that the match/merge functions are time consuming, so is there an alternative to this accomplish this goal? is lapply not efficient? Lana Schaffer Biostatistics/Informatics The Scripps Research Institute DNA Array Core Facility La Jolla, CA 92037 (858) 784-2263 (858) 784-2994 [EMAIL PROTECTED] __ R-help@r-project.org mailing list 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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? __ R-help@r-project.org mailing list 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] alternative to matching/merge?
Jim, d.frame[[i]] is a list of data.frames and seqFile is a data.frame. I have coverted them to vectors/matrixes and the timing is the same as data.frame. 'index' is unique in both structures. The list is subset into data.frame/matrix structures. Lana -Original Message- From: jim holtman [mailto:[EMAIL PROTECTED] Sent: Friday, June 13, 2008 9:45 AM To: Lana Schaffer Cc: r-help@r-project.org Subject: Re: [R] alternative to matching/merge? What is the structure of 'd.frame' and 'segFile'? Run Rprof so that we can see which of the functions it is spending its time in. What happens if x$index is not in seqFile$index? Are the values in the 'index' unique in both structures? Subsetting a data frame can be expensive when compared to using a matrix. Could you use a matrix instead of a data frame; are all the columns the same mode? Again either a subset of data would be helpful or an 'str' on the data objects being used so that we can understand what they are. On Fri, Jun 13, 2008 at 12:03 PM, Lana Schaffer [EMAIL PROTECTED] wrote: Jim, My code is this: mergefunc - function(x,seqFile){ # merge(seqFile,x) cbind(x, seqFile[ match(as.vector(x$index), as.vector(seqFile$index)), ]) } LIX - lapply(d.frame[[1]], mergefunc,seqFile=seqFile) Each matrix/data.frame takes 0.2 seconds and then to do this 1240 times takes ~4 minutes. Thanks, Lana -Original Message- From: jim holtman [mailto:[EMAIL PROTECTED] Sent: Thursday, June 12, 2008 6:40 PM To: Lana Schaffer Cc: r-help@r-project.org Subject: Re: [R] alternative to matching/merge? It would be nice if you at least included the code that you are using and a subset of the data. Have you run Rprof to determine which of the functions is consuming the time? On Thu, Jun 12, 2008 at 3:25 PM, Lana Schaffer [EMAIL PROTECTED] wrote: Greetings, I am doing matching/merge for a table (40919x3) to data which is in the form of a list of 1268 data.frames. Using lapply this is taking ~5 minutes. I know that the match/merge functions are time consuming, so is there an alternative to this accomplish this goal? is lapply not efficient? Lana Schaffer Biostatistics/Informatics The Scripps Research Institute DNA Array Core Facility La Jolla, CA 92037 (858) 784-2263 (858) 784-2994 [EMAIL PROTECTED] __ R-help@r-project.org mailing list 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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? __ R-help@r-project.org mailing list 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] alternative to matching/merge?
Greetings, I am doing matching/merge for a table (40919x3) to data which is in the form of a list of 1268 data.frames. Using lapply this is taking ~5 minutes. I know that the match/merge functions are time consuming, so is there an alternative to this accomplish this goal? is lapply not efficient? Lana Schaffer Biostatistics/Informatics The Scripps Research Institute DNA Array Core Facility La Jolla, CA 92037 (858) 784-2263 (858) 784-2994 [EMAIL PROTECTED] __ R-help@r-project.org mailing list 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.