Re: [R] group by rows
What should be FUN in aggregate as no function like mean, sum etc will be applied Carol On Wednesday, March 9, 2016 1:59 PM, Sarah Goslee <sarah.gos...@gmail.com> wrote: Possibly aggregate(), but you posted in HTML so your data were mangled. Please use dput(), post in plain text, and try to explain more clearly what you want the result to look like. Sarah On Wed, Mar 9, 2016 at 7:09 AM, carol white via R-help <r-help@r-project.org> wrote: > How is it possible to group rows of a matrix or a data frame by the same > values of the first column? > 1 14331 453452 653 3762 45 > > 1 1433,453452 45, 653 376 > Thanks > > Carol > > [[alternative HTML version deleted]] > > ___ [[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] group by rows
How is it possible to group rows of a matrix or a data frame by the same values of the first column? 1 14331 453452 653 3762 45 1 1433,453452 45, 653 376 Thanks Carol [[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] Change the location of R
Hi,I have R v 3.0 installed /usr/... and the new version R-3.2.3 in my home under ubuntu. Is it correct to copy the R-3.2.3 directory into /usr/local/lib/R/ or should I reconfig and remake into /usr/local/lib/R/? Regards, Carol [[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] determine the year of a date
Hi,might be trivial but how to determine the year of a date which is in the %m/%d/%y format and those whose year is century should be modified to ISO so that all date will have with year in ISO? Regards, Carol [[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] determine the year of a date
yes, some of them are like 09/01/15 and some others are 09/01/2015 and all of them range between 2015 and 2016. The goal was to convert 09/01/15 to 09/01/2015. I don't know if the fact that they range between 2015 and 2016 make the task easier. Best wishes Carol On Wednesday, February 3, 2016 7:34 PM, Boris Steipe <boris.ste...@utoronto.ca> wrote: Sorry - messed up example: corrected here... d <- "7/27/77" strptime(d, format="%m/%d/%y") # "1977-07-27 EDT" x <- strptime(d, format="%m/%d/%y") strftime(x, format="%m/%d/%Y") # "07/27/1977" On Feb 3, 2016, at 1:29 PM, Boris Steipe <boris.ste...@utoronto.ca> wrote: > It seems your autocorrect is playing tricks on you but if I understand you > correctly you have a two digit year and want to convert that to a four digit > year? That's not uniquely possible of course; by convention, as the > documentation to strptime() says: > > On input, values 00 to 68 are prefixed by 20 and 69 to 99 by 19 – that > is the behaviour specified by the 2004 and 2008 POSIX standards... > > If this is correct for you, you need to convert the string to a time object > and the time object back to string. The format specifier %Y prints four-digit > years: > > > d <- "7/27/59" > strptime(d, format="%m/%d/%y") # "2059-07-27 EDT" > x <- strptime(d, format="%m/%d/%y") > > strftime(x, format="%m/%d/%Y") # "07/27/1977" > > > > B. > > > > > > > > On Feb 3, 2016, at 11:03 AM, carol white via R-help <r-help@r-project.org> > wrote: > >> Hi,might be trivial but how to determine the year of a date which is in the >> %m/%d/%y format and those whose year is century should be modified to ISO so >> that all date will have with year in ISO? >> Regards, >> Carol >> >> [[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. [[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] logical vector of the indices of a string in a vector
Hi, it might be trivial but is there any way to get the logical vector of the indices of a string in a vector? I thought that %in% would do but it doesn't. I also want to filter the empty fields. Here I want to extract the non-empty elements containing "Yes":x =c("Yes, fsd", "", "No","","Yes, fjsdlf", "") x[c("Yes") %in% x & x != ""]character(0) Above, I wanted to do the 2 following operations in 1. Here with grep, it works but %in% in above doesn't:y = x[grep("Yes", x)] > y = y[y != ""] > y [1] "Yes, fsd" "Yes, fjsdlf" Thanks Carol [[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] warning on generic function when building R package
Jim's solution works. Thank you Carol On Monday, October 19, 2015 11:53 PM, Jim Lemon <drjimle...@gmail.com> wrote: I think what you may have done is simply changed x.init= to x=x.init. x.init may or may not be there when the function is called, and that is what the warning is saying. While you have satisfied the restriction that the first argument must be "x", but then set the default value to something that R is unable to resolve to a value. What you may want to do is something like this: plot.func<-function(x,y,...) { if(missing(x)) stop("Must have an x value") if(missing(y)) stop("Must have a y value") ...} Jim On Tue, Oct 20, 2015 at 7:32 AM, carol white via R-help <r-help@r-project.org> wrote: In effect, this works but whether I use x or x.init, y or y.init in plot.func, I get no visible binding for global variable ‘x.init’no visible binding for global variable ‘y.init’ Regards, On Monday, October 19, 2015 9:59 PM, Duncan Murdoch <murdoch.dun...@gmail.com> wrote: On 19/10/2015 3:50 PM, carol white wrote: > Thanks Murdoch. > > defining > plot.func<- function(x=x.init, y=y.init, arg3, arg4, "title", col, arg5) > > and if plot doesn't take the exact parameters of plot.func but modified > of these parameters > plot(x=x.pt,y=y.pt,xlim = c(0, 10), ylim = c(0,1), xlab= "xlab", > ylab="ylab", main = "title", col = col,type = "l") > > then, how to define and invoke to be consisent? I don't really understand your question, but this is all about the function header for plot.func, not the call you make to plot(). You need to name the first argument as "x", you need to include "..." as an open argument, and you need a legal header. So this would be okay: plot.func<- function(x=x.init, y=y.init, arg3, arg4, main = "title", # can't skip the arg name col, arg5, ...) { # can't skip the dots Duncan Murdoch > > Regards, > > On Monday, October 19, 2015 7:45 PM, Duncan Murdoch > <murdoch.dun...@gmail.com> wrote: > > > On 19/10/2015 1:29 PM, carol white via R-help wrote: > >> Hi,I have invoked plot in a function (plot.func) as follows but when I > check the built package, I get a warning: >> plot(x.pt,y.pt,xlim = c(0, 10), ylim = c(0,1), xlab= "xlab", > ylab="ylab", main = "title", col = col,type = "l") >> R CMD check my.package >> checking S3 generic/method consistency ... WARNING >> plot: >> function(x, ...) >> plot.func: >> function(x.pt, y.pt, arg3, arg4, "title", col, arg5) >> >> See section ‘Generic functions and methods’ in the ‘Writing R >> Extensions’ manual. >> Which plot argument is illegitimate or missing and how to eliminate > the warning? > > > The first argument to plot.func needs to be called "x" if you want to > use it as a method. Method signatures need to be consistent with the > generic signature. > > Duncan Murdoch > > > > [[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. [[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] warning on generic function when building R package
In effect, this works but whether I use x or x.init, y or y.init in plot.func, I get no visible binding for global variable ‘x.init’no visible binding for global variable ‘y.init’ Regards, On Monday, October 19, 2015 9:59 PM, Duncan Murdoch <murdoch.dun...@gmail.com> wrote: On 19/10/2015 3:50 PM, carol white wrote: > Thanks Murdoch. > > defining > plot.func<- function(x=x.init, y=y.init, arg3, arg4, "title", col, arg5) > > and if plot doesn't take the exact parameters of plot.func but modified > of these parameters > plot(x=x.pt,y=y.pt,xlim = c(0, 10), ylim = c(0,1), xlab= "xlab", > ylab="ylab", main = "title", col = col,type = "l") > > then, how to define and invoke to be consisent? I don't really understand your question, but this is all about the function header for plot.func, not the call you make to plot(). You need to name the first argument as "x", you need to include "..." as an open argument, and you need a legal header. So this would be okay: plot.func<- function(x=x.init, y=y.init, arg3, arg4, main = "title", # can't skip the arg name col, arg5, ...) { # can't skip the dots Duncan Murdoch > > Regards, > > On Monday, October 19, 2015 7:45 PM, Duncan Murdoch > <murdoch.dun...@gmail.com> wrote: > > > On 19/10/2015 1:29 PM, carol white via R-help wrote: > >> Hi,I have invoked plot in a function (plot.func) as follows but when I > check the built package, I get a warning: >> plot(x.pt,y.pt,xlim = c(0, 10), ylim = c(0,1), xlab= "xlab", > ylab="ylab", main = "title", col = col,type = "l") >> R CMD check my.package >> checking S3 generic/method consistency ... WARNING >> plot: >> function(x, ...) >> plot.func: >> function(x.pt, y.pt, arg3, arg4, "title", col, arg5) >> >> See section ‘Generic functions and methods’ in the ‘Writing R >> Extensions’ manual. >> Which plot argument is illegitimate or missing and how to eliminate > the warning? > > > The first argument to plot.func needs to be called "x" if you want to > use it as a method. Method signatures need to be consistent with the > generic signature. > > Duncan Murdoch > > > > [[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] warning on generic function when building R package
Thanks Murdoch. defining plot.func<- function(x=x.init, y=y.init, arg3, arg4, "title", col, arg5) and if plot doesn't take the exact parameters of plot.func but modified of these parametersplot(x=x.pt,y=y.pt,xlim = c(0, 10), ylim = c(0,1), xlab= "xlab", ylab="ylab", main = "title", col = col,type = "l") then, how to define and invoke to be consisent? Regards, On Monday, October 19, 2015 7:45 PM, Duncan Murdoch <murdoch.dun...@gmail.com> wrote: On 19/10/2015 1:29 PM, carol white via R-help wrote: > Hi,I have invoked plot in a function (plot.func) as follows but when I check > the built package, I get a warning: > plot(x.pt,y.pt,xlim = c(0, 10), ylim = c(0,1), xlab= "xlab", ylab="ylab", > main = "title", col = col,type = "l") > R CMD check my.package > checking S3 generic/method consistency ... WARNING > plot: > function(x, ...) > plot.func: > function(x.pt, y.pt, arg3, arg4, "title", col, arg5) > > See section ‘Generic functions and methods’ in the ‘Writing R > Extensions’ manual. > Which plot argument is illegitimate or missing and how to eliminate the > warning? The first argument to plot.func needs to be called "x" if you want to use it as a method. Method signatures need to be consistent with the generic signature. Duncan Murdoch [[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] warning on generic function when building R package
Hi,I have invoked plot in a function (plot.func) as follows but when I check the built package, I get a warning: plot(x.pt,y.pt,xlim = c(0, 10), ylim = c(0,1), xlab= "xlab", ylab="ylab", main = "title", col = col,type = "l") R CMD check my.package checking S3 generic/method consistency ... WARNING plot: function(x, ...) plot.func: function(x.pt, y.pt, arg3, arg4, "title", col, arg5) See section ‘Generic functions and methods’ in the ‘Writing R Extensions’ manual. Which plot argument is illegitimate or missing and how to eliminate the warning? Thanks Carol [[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] [FORGED] change text size on a graphics
Hi,I use hist. If I usehist.result = hist(c(14,20,9,31,17), plot = F)plot(hist.result, labels = T, cex = 2) #doesn't increase the font size of all text on the plot: axis annotation, axis labels, count labels on top of the bars plot(hist.result, labels = T, cex.axis = 2, cex.label = 2, cex.main = 2) # how to increase the size of count labels that are displayed on the top of the bars by labels = T? Regards, On Tuesday, July 21, 2015 9:45 AM, Jim Lemon drjimle...@gmail.com wrote: Hi Carol, If you are using the barlabels function in the plotrix package, just add the usual cex argument to the call. Using the first example in the help page: heights-c(14,20,9,31,17) barpos-barplot(heights,main=A redundant bar plot) barlabels(barpos,heights+1,prop=1,cex=1.5) Jim On Tue, Jul 21, 2015 at 7:23 AM, Rolf Turner r.tur...@auckland.ac.nz wrote: On 21/07/15 08:24, carol white via R-help wrote: Hi,How is it possible to increase the size of a histogram labels (displayed on the top of the bars)? I thought that if I use cex 1, it will increase all text size on a plot (axis labels, axis annotation, title of the graphics and histogram labels) which I want but it doesn't. ***What*** labels displayed on the top of the bars??? I don't see any such labels when I plot a histogram. Reproducible example? And please don't post in HTML. cheers, Rolf Turner -- Technical Editor ANZJS Department of Statistics University of Auckland Phone: +64-9-373-7599 ext. 88276 __ 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] change text size on a graphics
Hi,How is it possible to increase the size of a histogram labels (displayed on the top of the bars)? I thought that if I use cex 1, it will increase all text size on a plot (axis labels, axis annotation, title of the graphics and histogram labels) which I want but it doesn't. Regards, Carol [[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] load a very big .RData - error reading from connection
yes and doesn't help.600MB Thanks Carol On Tuesday, June 9, 2015 12:22 PM, Jim Lemon drjimle...@gmail.com wrote: Hi carol, Have you tried renaming the file to something like my.RData? And just how big is it? Jim On Tue, Jun 9, 2015 at 5:50 AM, carol white via R-help r-help@r-project.org wrote: Hi,How is it possible to load a very big .RData that can't be loaded it's very big and the following error msg is displayed load(.RData) Error: error reading from connection Thanks Carol [[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. [[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] load a very big .RData - error reading from connection
Hi,How is it possible to load a very big .RData that can't be loaded it's very big and the following error msg is displayed load(.RData) Error: error reading from connection Thanks Carol [[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] building a list in a loop
It might be an easy question but how to construct correctly a list in a loop? The following doesn't work before starting the loopd = NULL#in the loop, 1st iteration d = list(d,c(1,2,3)d[[1]] NULL [[2]] [1] 1 2 3#in the loop, 2nd iterationd=list(d,c(4,5,6)d [[1]] [[1]][[1]] NULL [[1]][[2]] [1] 1 2 3 [[2]] [1] 4 5 6 the goal is to have the result of d= list(c(1,2,3),c(4,5,6)) where the list components are not known out of the loop. d[[1]] [1] 1 2 3 [[2]] [1] 4 5 6 Moreover, how to name the components of the list in the loop while constructing as the names are not known out of the loop, either? note that the name of the component is stored in a variable in the loop d = NULL#name1 contains the name for c(1,2,3), how to give the name below? d = list(d,c(1,2,3) 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] building a list in a loop
Here is the best solution that I found as the list is built in the embedded functions withtout using loop index, list elements' names etc d = list()d[[length(d)+1]] = 1:3d[[length(d)+1]] = 4:6 Many thanks for your help On Friday, June 5, 2015 12:04 PM, PIKAL Petr petr.pi...@precheza.cz wrote: #yiv1728143486 #yiv1728143486 _filtered #yiv1728143486 {font-family:Helvetica;} _filtered #yiv1728143486 {font-family:Helvetica;} _filtered #yiv1728143486 {font-family:Calibri;} _filtered #yiv1728143486 {font-family:Tahoma;}#yiv1728143486 p.yiv1728143486MsoNormal, #yiv1728143486 li.yiv1728143486MsoNormal, #yiv1728143486 div.yiv1728143486MsoNormal {margin:0cm;margin-bottom:.0001pt;font-size:12.0pt;}#yiv1728143486 a:link, #yiv1728143486 span.yiv1728143486MsoHyperlink {color:blue;text-decoration:underline;}#yiv1728143486 a:visited, #yiv1728143486 span.yiv1728143486MsoHyperlinkFollowed {color:purple;text-decoration:underline;}#yiv1728143486 p.yiv1728143486MsoAcetate, #yiv1728143486 li.yiv1728143486MsoAcetate, #yiv1728143486 div.yiv1728143486MsoAcetate {margin:0cm;margin-bottom:.0001pt;font-size:8.0pt;}#yiv1728143486 p.yiv1728143486msonormal, #yiv1728143486 li.yiv1728143486msonormal, #yiv1728143486 div.yiv1728143486msonormal {margin-right:0cm;margin-left:0cm;font-size:12.0pt;}#yiv1728143486 p.yiv1728143486msochpdefault, #yiv1728143486 li.yiv1728143486msochpdefault, #yiv1728143486 div.yiv1728143486msochpdefault {margin-right:0cm;margin-left:0cm;font-size:12.0pt;}#yiv1728143486 span.yiv1728143486msohyperlink {}#yiv1728143486 span.yiv1728143486msohyperlinkfollowed {}#yiv1728143486 span.yiv1728143486style-mailovzprvy17 {}#yiv1728143486 p.yiv1728143486msonormal1, #yiv1728143486 li.yiv1728143486msonormal1, #yiv1728143486 div.yiv1728143486msonormal1 {margin:0cm;margin-bottom:.0001pt;font-size:12.0pt;}#yiv1728143486 span.yiv1728143486msohyperlink1 {color:blue;text-decoration:underline;}#yiv1728143486 span.yiv1728143486msohyperlinkfollowed1 {color:purple;text-decoration:underline;}#yiv1728143486 span.yiv1728143486style-mailovzprvy171 {color:#1F497D;}#yiv1728143486 p.yiv1728143486msochpdefault1, #yiv1728143486 li.yiv1728143486msochpdefault1, #yiv1728143486 div.yiv1728143486msochpdefault1 {margin-right:0cm;margin-left:0cm;font-size:10.0pt;}#yiv1728143486 span.yiv1728143486TextbublinyChar {}#yiv1728143486 span.yiv1728143486StylE-mailovZprvy29 {color:#1F497D;}#yiv1728143486 .yiv1728143486MsoChpDefault {font-size:10.0pt;} _filtered #yiv1728143486 {margin:70.85pt 70.85pt 70.85pt 70.85pt;}#yiv1728143486 div.yiv1728143486WordSection1 {}#yiv1728143486 Hi This I do not consider as a loop without index. AFAIK i is index and the loop is executed twice. First with i equal to „a“ and second time with i equal to „b“. In that case you need to have some objects which are named“a” or “b” and you can use it for selection or computing d-list(a=NULL, b=NULL)for (i in c(a,b)) {d[[i]]-1:3} CheersPetr From: carol white [mailto:wht_...@yahoo.com] Sent: Friday, June 05, 2015 11:51 AM To: PIKAL Petr Subject: Re: [R] building a list in a loop for (i in c(a,b)) best, On Friday, June 5, 2015 11:36 AM, PIKAL Petr petr.pi...@precheza.cz wrote: Hi Can you please specify how loop without index shall be constructed? It is rather new topic for me. Petr From: carol white [mailto:wht_...@yahoo.com] Sent: Friday, June 05, 2015 11:21 AM To: PIKAL Petr Subject: Re: [R] building a list in a loop also consider a loop without index (not like for (i ...) where index could be used for the list construction) Cheers, On Friday, June 5, 2015 11:13 AM, PIKAL Petr petr.pi...@precheza.cz wrote: Hi It is not clear what exactly do you want. d-list() vec-1:3 for (i in 1:2) { vec-vec+3*(i-1) d[[i]]-vec #names(d)[i] - paste(name,i) } You can add names in second loop or you can use names command in first loop. Cheers Petr -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of carol white via R-help Sent: Friday, June 05, 2015 10:40 AM To: R-help Help Subject: [R] building a list in a loop It might be an easy question but how to construct correctly a list in a loop? The following doesn't work before starting the loopd = NULL#in the loop, 1st iteration d = list(d,c(1,2,3)d[[1]] NULL [[2]] [1] 1 2 3#in the loop, 2nd iterationd=list(d,c(4,5,6)d [[1]] [[1]][[1]] NULL [[1]][[2]] [1] 1 2 3 [[2]] [1] 4 5 6 the goal is to have the result of d= list(c(1,2,3),c(4,5,6)) where the list components are not known out of the loop. d[[1]] [1] 1 2 3 [[2]] [1] 4 5 6 Moreover, how to name the components of the list in the loop while constructing as the names are not known out of the loop, either? note that the name of the component is stored in a variable in the loop d = NULL#name1 contains the name for c(1,2,3), how to give the name below? d = list(d,c(1,2,3) Thanks [[alternative HTML version deleted
Re: [R] building a list in a loop
in this example can elements of the list be accessed by their name if their name is the value of a variable?el = acan the first element d[[1]] be accessed by el instead of the list index like d$a but via el? Thanks On Friday, June 5, 2015 12:04 PM, PIKAL Petr petr.pi...@precheza.cz wrote: #yiv1728143486 #yiv1728143486 _filtered #yiv1728143486 {font-family:Helvetica;} _filtered #yiv1728143486 {font-family:Helvetica;} _filtered #yiv1728143486 {font-family:Calibri;} _filtered #yiv1728143486 {font-family:Tahoma;}#yiv1728143486 p.yiv1728143486MsoNormal, #yiv1728143486 li.yiv1728143486MsoNormal, #yiv1728143486 div.yiv1728143486MsoNormal {margin:0cm;margin-bottom:.0001pt;font-size:12.0pt;}#yiv1728143486 a:link, #yiv1728143486 span.yiv1728143486MsoHyperlink {color:blue;text-decoration:underline;}#yiv1728143486 a:visited, #yiv1728143486 span.yiv1728143486MsoHyperlinkFollowed {color:purple;text-decoration:underline;}#yiv1728143486 p.yiv1728143486MsoAcetate, #yiv1728143486 li.yiv1728143486MsoAcetate, #yiv1728143486 div.yiv1728143486MsoAcetate {margin:0cm;margin-bottom:.0001pt;font-size:8.0pt;}#yiv1728143486 p.yiv1728143486msonormal, #yiv1728143486 li.yiv1728143486msonormal, #yiv1728143486 div.yiv1728143486msonormal {margin-right:0cm;margin-left:0cm;font-size:12.0pt;}#yiv1728143486 p.yiv1728143486msochpdefault, #yiv1728143486 li.yiv1728143486msochpdefault, #yiv1728143486 div.yiv1728143486msochpdefault {margin-right:0cm;margin-left:0cm;font-size:12.0pt;}#yiv1728143486 span.yiv1728143486msohyperlink {}#yiv1728143486 span.yiv1728143486msohyperlinkfollowed {}#yiv1728143486 span.yiv1728143486style-mailovzprvy17 {}#yiv1728143486 p.yiv1728143486msonormal1, #yiv1728143486 li.yiv1728143486msonormal1, #yiv1728143486 div.yiv1728143486msonormal1 {margin:0cm;margin-bottom:.0001pt;font-size:12.0pt;}#yiv1728143486 span.yiv1728143486msohyperlink1 {color:blue;text-decoration:underline;}#yiv1728143486 span.yiv1728143486msohyperlinkfollowed1 {color:purple;text-decoration:underline;}#yiv1728143486 span.yiv1728143486style-mailovzprvy171 {color:#1F497D;}#yiv1728143486 p.yiv1728143486msochpdefault1, #yiv1728143486 li.yiv1728143486msochpdefault1, #yiv1728143486 div.yiv1728143486msochpdefault1 {margin-right:0cm;margin-left:0cm;font-size:10.0pt;}#yiv1728143486 span.yiv1728143486TextbublinyChar {}#yiv1728143486 span.yiv1728143486StylE-mailovZprvy29 {color:#1F497D;}#yiv1728143486 .yiv1728143486MsoChpDefault {font-size:10.0pt;} _filtered #yiv1728143486 {margin:70.85pt 70.85pt 70.85pt 70.85pt;}#yiv1728143486 div.yiv1728143486WordSection1 {}#yiv1728143486 Hi This I do not consider as a loop without index. AFAIK i is index and the loop is executed twice. First with i equal to „a“ and second time with i equal to „b“. In that case you need to have some objects which are named“a” or “b” and you can use it for selection or computing d-list(a=NULL, b=NULL)for (i in c(a,b)) {d[[i]]-1:3} CheersPetr From: carol white [mailto:wht_...@yahoo.com] Sent: Friday, June 05, 2015 11:51 AM To: PIKAL Petr Subject: Re: [R] building a list in a loop for (i in c(a,b)) best, On Friday, June 5, 2015 11:36 AM, PIKAL Petr petr.pi...@precheza.cz wrote: Hi Can you please specify how loop without index shall be constructed? It is rather new topic for me. Petr From: carol white [mailto:wht_...@yahoo.com] Sent: Friday, June 05, 2015 11:21 AM To: PIKAL Petr Subject: Re: [R] building a list in a loop also consider a loop without index (not like for (i ...) where index could be used for the list construction) Cheers, On Friday, June 5, 2015 11:13 AM, PIKAL Petr petr.pi...@precheza.cz wrote: Hi It is not clear what exactly do you want. d-list() vec-1:3 for (i in 1:2) { vec-vec+3*(i-1) d[[i]]-vec #names(d)[i] - paste(name,i) } You can add names in second loop or you can use names command in first loop. Cheers Petr -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of carol white via R-help Sent: Friday, June 05, 2015 10:40 AM To: R-help Help Subject: [R] building a list in a loop It might be an easy question but how to construct correctly a list in a loop? The following doesn't work before starting the loopd = NULL#in the loop, 1st iteration d = list(d,c(1,2,3)d[[1]] NULL [[2]] [1] 1 2 3#in the loop, 2nd iterationd=list(d,c(4,5,6)d [[1]] [[1]][[1]] NULL [[1]][[2]] [1] 1 2 3 [[2]] [1] 4 5 6 the goal is to have the result of d= list(c(1,2,3),c(4,5,6)) where the list components are not known out of the loop. d[[1]] [1] 1 2 3 [[2]] [1] 4 5 6 Moreover, how to name the components of the list in the loop while constructing as the names are not known out of the loop, either? note that the name of the component is stored in a variable in the loop d = NULL#name1 contains the name for c(1,2,3), how to give the name below? d = list(d,c(1,2,3) Thanks [[alternative HTML version deleted]] __ R
[R] merge function
Hi,By default the merge function should take the intersection of column names (if this is understood from by = intersect(names(x), names(y)), but it takes all columns. How to specify the intersection of column names? Thanks Carol [[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] merge function
I understood that by would take the intersection of names(x) and names(y), names(x) being the column names of x and names(y), column names of y. if x has 5 col and the col names of x are col1, col2... col5 and y has 3 col and their names are col1, col2, col3, I thought that the merged data set will have 3 col, namely col1, col2, col3 but all 5 col, i.e. col1, col2... col5 are taken if nothing is specified for the by arg. Cheers, On Monday, June 1, 2015 4:32 PM, Michael Dewey li...@dewey.myzen.co.uk wrote: On 01/06/2015 14:46, carol white via R-help wrote: Hi,By default the merge function should take the intersection of column names (if this is understood from by = intersect(names(x), names(y)), Dear Carol The by parameter specifies which columns are used to merge by. Did you understand it to be which columns are retained in the result? Just a hunch, and if not then you need to give us a toy example. but it takes all columns. How to specify the intersection of column names? Thanks Carol [[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. -- Michael http://www.dewey.myzen.co.uk/home.html [[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] package.skeleton warning
So I finally used filenames - list.files(~/Desktop/myPkg/R/, full.names = TRUE) package.skeleton(name = myPackage, code_files = filenames) and still despite the warnings mentioned before, the man and R folders seem to have been created correctly. I had put the vignettes folder and inst in the source folder (~/Desktop/myPkg) at the same level as R folder. inst contains citation. but after invoking package.skeleton, nothing happened to copy the vignettes nor inst folders in the myPackage folder. Should package.skeleton have taken care of them or I should process separately? Thanks On Tuesday, April 28, 2015 5:22 PM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 28/04/2015 11:09 AM, carol white wrote: I have many code files so listing them will be long. When leave it empty, I get package.skeleton(name = myPackage, code_files = ) Error in sys.source(cf, envir = environment) : '' is not an existing file Sorry, I meant leave it out, i.e. just use package.skeleton(name=myPackage). This will look at the objects that are currently defined in your workspace and base your package on those. But if you have your code already in a bunch of files in ~/Desktop/myPkg/R/, you could use filenames - list.files(~/Desktop/myPkg/R/, full.names = TRUE) to get all the names in one vector, and use that as the code_files argument, i.e. package.skeleton(name = myPackage, code_files = filenames) You may need to leave out some files if they aren't all *.R files. Duncan Murdoch Thanks On Tuesday, April 28, 2015 4:48 PM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 28/04/2015 10:05 AM, carol white via R-help wrote: Hi,Why do I get this warning when I run package.skeleton() and how to solve this problem? Warning messages: 1: In package.skeleton(name = myPackage, code_files = ~/Desktop/myPkg/R/) : Invalid file name(s) for R code in ./myPackage/R: 'R' are now renamed to 'zname.R' 2: In file.rename(from = file.path(code_dir, wrong), to = file.path(code_dir, : cannot rename file './myPackage/R/R' to './myPackage/R/zR.R', reason 'No such file or directory' You are saying that your code is in a file called ~/Desktop/myPkg/R/ but you have no such file. If you really do have your code already in some files, list them in the code_files argument, otherwise leave it blank. Duncan Murdoch [[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] package.skeleton warning
Hi,Why do I get this warning when I run package.skeleton() and how to solve this problem? Warning messages: 1: In package.skeleton(name = myPackage, code_files = ~/Desktop/myPkg/R/) : Invalid file name(s) for R code in ./myPackage/R: 'R' are now renamed to 'zname.R' 2: In file.rename(from = file.path(code_dir, wrong), to = file.path(code_dir, : cannot rename file './myPackage/R/R' to './myPackage/R/zR.R', reason 'No such file or directory' Thanks Carol [[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] reverse dep of a package
Hi,How to cite reverse dependancies in the NAMESPACE file in building a package? Regards, Carol [[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] package.skeleton warning
I have many code files so listing them will be long. When leave it empty, I get package.skeleton(name = myPackage, code_files = ) Error in sys.source(cf, envir = environment) : '' is not an existing file There should be an automatic way to source all code files instead of listing them. Even if I upload and have them as R objects, I shouldn't have to list them in the list arg. Thanks On Tuesday, April 28, 2015 4:48 PM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 28/04/2015 10:05 AM, carol white via R-help wrote: Hi,Why do I get this warning when I run package.skeleton() and how to solve this problem? Warning messages: 1: In package.skeleton(name = myPackage, code_files = ~/Desktop/myPkg/R/) : Invalid file name(s) for R code in ./myPackage/R: 'R' are now renamed to 'zname.R' 2: In file.rename(from = file.path(code_dir, wrong), to = file.path(code_dir, : cannot rename file './myPackage/R/R' to './myPackage/R/zR.R', reason 'No such file or directory' You are saying that your code is in a file called ~/Desktop/myPkg/R/ but you have no such file. If you really do have your code already in some files, list them in the code_files argument, otherwise leave it blank. Duncan Murdoch [[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] reverse dep of a package
yes, reverse dependency. All the reverse dependancies on the main web page of the packages are generated by CRAN? Thanks On Tuesday, April 28, 2015 5:02 PM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 28/04/2015 8:54 AM, carol white via R-help wrote: Hi,How to cite reverse dependancies in the NAMESPACE file in building a package? That doesn't make sense. How could you predict which packages will depend on yours? Perhaps you mean something different by reverse dependency. The standard definition is that if B depends on A, then A is a dependency of B, and B is a reverse dependency of A. Duncan Murdoch [[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] cite publications in the package help file
To cite related publications, it seems that they can't be mentioned in DESCRIPTION. Where to mention so that it appears on the 1st page of the pdf help file and the package main web page? I'm not talking about what is specified in inst/citation. Thanks, Carol [[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] cite publications in the package help file
the main web page is meant the page when a package is accessed on CRAN. So is it possible on this page that the content of DESCRIPTION is displayed to display the related publications and also put the related publications so that they appear on the help pdf file? On Tuesday, April 28, 2015 7:37 PM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 28/04/2015 1:00 PM, carol white via R-help wrote: To cite related publications, it seems that they can't be mentioned in DESCRIPTION. Where to mention so that it appears on the 1st page of the pdf help file and the package main web page? I'm not talking about what is specified in inst/citation. The package help file (e.g. foo-package.Rd for package foo) will be displayed first in the PDF, and is the first entry linked in the help page index for the package. I don't know what page you mean as the package main web page. Duncan Murdoch [[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] cite publications in the package help file
an example of a package main web page on CRANhttp://cran.r-project.org/web/packages/A3/index.html and the help pdf filehttp://cran.r-project.org/web/packages/A3/A3.pdf Regards, On Tuesday, April 28, 2015 7:37 PM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 28/04/2015 1:00 PM, carol white via R-help wrote: To cite related publications, it seems that they can't be mentioned in DESCRIPTION. Where to mention so that it appears on the 1st page of the pdf help file and the package main web page? I'm not talking about what is specified in inst/citation. The package help file (e.g. foo-package.Rd for package foo) will be displayed first in the PDF, and is the first entry linked in the help page index for the package. I don't know what page you mean as the package main web page. Duncan Murdoch [[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] view large tables
what is the best function to view large tables or data frames, scrolling down-up, left-right? Thanks c. [[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] ubuntu 14.04
Hi, Can R be run on ubuntu 14.04 LTS without problem or is there any incompatibility? Thanks Carol [[alternative HTML version deleted]] __ 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] division of col by the sum of the col
Hi, If I want to divide the column of a matrix by the sum of the column, should I loop over the columns or can I use apply family? Regards, Carol [[alternative HTML version deleted]] __ 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] extract GO results in xml format
from a list of GO term enrichment results in xml format, what is the best way to extract term and p-value columns? Which function is the best to use? I used xmlToDataFrame but got Error in `[-.data.frame`(`*tmp*`, i, names(nodes[[i]]), value = c(5, : duplicate subscripts for columns Look forward to your reply, Carol [[alternative HTML version deleted]] __ 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] color palettes
I don't make a chart with 1000 colors. I allocate 1000 colors for 1000 iterms and then, the selected items based on a criterion will get a color out of 1000. Thanks On Friday, August 8, 2014 4:38 PM, David L Carlson dcarl...@tamu.edu wrote: I would suggest not using pie charts and not trying to make 1000 color distinctions. Also read all of my original post and do some research. cols - hsv(.6, seq(0, 1, length.out=1000), .9) pie(1:1000, labels=, col=cols, border=NA) David From:carol white [mailto:wht_...@yahoo.com] Sent: Friday, August 8, 2014 9:03 AM To: David L Carlson Subject: Re: [R] color palettes Well I'm using 1000 colors in a pie chart and get the same color but different intensity. I can't fix myself as the number of colors are high. So what would you suggest? Thanks carol On Friday, August 8, 2014 3:58 PM, David L Carlson dcarl...@tamu.edu wrote: I think your question is too vague to answer since we don't know what you are trying to do or how many colors you need. The easy answer is that you don't need to use rainbow() at all, just use color names: mycolors - c(red, green, blue, violet) and you will have one of each. For example, col=mycolors(2) will plot using green (and so will col=green). There are lots of color names in R: length(colors(distinct=TRUE)) [1] 502 The longer answer is that there are many color palettes and ways of selecting, manipulating, and choosing colors. The built in functions include palettes such as rainbow, heat.colors, terrain.colors, topo.colors, cm.colors, and gray and ways of specifying colors (in addition to using names) including rgb, hsv, and hcl. In addition, there are several packages for creating color palettes including RColorBrewer, colortools, colorspace, and munsell. - David L Carlson Department of Anthropology Texas AM University College Station, TX 77840-4352 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of carol white Sent: Friday, August 8, 2014 8:27 AM To: r-help@r-project.org Subject: [R] color palettes Hi, Is there any way to take one color of each color family from a color palettes like rainbow? For ex, if there are different blues differentiated by intensity, hue etc, taking one of them. In this case, when using rainbow(n), then how to select 1 color of each family, for ex 1 blue, 1 red etc? It doesn't matter which intensity, hue etc is taken as long as 1 color from each family is taken. Thanks Carol [[alternative HTML version deleted]] __ 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. [[alternative HTML version deleted]] __ 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] color palettes
Hi, Is there any way to take one color of each color family from a color palettes like rainbow? For ex, if there are different blues differentiated by intensity, hue etc, taking one of them. In this case, when using rainbow(n), then how to select 1 color of each family, for ex 1 blue, 1 red etc? It doesn't matter which intensity, hue etc is taken as long as 1 color from each family is taken. Thanks Carol [[alternative HTML version deleted]] __ 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] separate numbers from chars in a string
Hi, If I have a string of consecutive chars followed by consecutive numbers and then chars, like absdfds0213451ab, how to separate the consecutive chars from consecutive numbers? grep doesn't seem to be helpful grep([a-z],absdfds0213451ab, ignore.case=T) [1] 1 grep([0-9],absdfds0213451ab, ignore.case=T) [1] 1 Thanks Carol [[alternative HTML version deleted]] __ 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] separate numbers from chars in a string
There are some level of variation either chars followed by numbers or chars, numbers, chars Perhaps, I should use gsub as you suggested all and if the string is composed of chars followed by numbers, it will return the 3rd part empty? Regards, Carol On Wednesday, July 30, 2014 10:52 PM, Marc Schwartz marc_schwa...@me.com wrote: On Jul 30, 2014, at 3:13 PM, carol white wht_...@yahoo.com wrote: Hi, If I have a string of consecutive chars followed by consecutive numbers and then chars, like absdfds0213451ab, how to separate the consecutive chars from consecutive numbers? grep doesn't seem to be helpful grep([a-z],absdfds0213451ab, ignore.case=T) [1] 1 grep([0-9],absdfds0213451ab, ignore.case=T) [1] 1 Thanks Carol grep() will only tell you that a pattern is present. You want to use gsub() or similar with back references to return parts of the vector. Will they ALWAYS appear in that pattern (letters, numbers, letters) or is there some level of variation? If they will always appear as in your example, then one approach is: strsplit(gsub(([a-z]+)([0-9]+)([a-z]+), \\1 \\2 \\3, absdfds0213451ab), ) [[1]] [1] absdfds 0213451 ab The initial gsub() returns the 3 parts separated by a space, which is then used as the split argument to strsplit(). If there will be some variation, you can use multiple calls to gsub() or similar, each getting either the letters or the numbers. Regards, Marc Schwartz [[alternative HTML version deleted]] __ 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] selection of probes, probesets mapping to the same gene
Hi, Apart from genefilter, is there any other packages that find all probes, probesets mappign to the same gene and then, select the one based on criterion for ex largest value of the test statistic? Look forward to your reply, Carol [[alternative HTML version deleted]] __ 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] corresponding replicated el of one matrix in another matrix or vector
Hi, I have a matrix of unique elements (strings) like v1 and a vector which contains replicated values of the 2nd column of the first matrix. v1 = cbind(c(1,2,3),c(a,b,c)) v2 = c(rep(a,5), rep(c,10), rep(b,3)) How can I add a column to v2 that contains the values of the first column of the first matrix v1 where the 2nd column of v1 matches the values of v2? Do I need to grep by looping over the nrow of v1 which is very time consuming or is there a better solution? the results should be the same as v3=rbind( c(rep(a,5), rep(c,10), rep(b,3)), c(rep(1,5), rep(3,10), rep(2,3))) --- v1 [,1] [,2] [,3] [1,] 1 2 3 [2,] a b c v2 [1] a a a a a c c c c c c c c c c b b b v3 [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,] a a a a a c c c c c c c c c [2,] 1 1 1 1 1 3 3 3 3 3 3 3 3 3 [,15] [,16] [,17] [,18] [1,] c b b b [2,] 3 2 2 2 [[alternative HTML version deleted]] __ 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] corresponding replicated el of one matrix in another matrix or vector
How to keep the same order of elements as v2 for the new matrix? v3 [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,] a a a a a c c c c c c c c c [2,] 1 1 1 1 1 3 3 3 3 3 3 3 3 3 [,15] [,16] [,17] [,18] [1,] c b b b [2,] 3 2 2 2 instead of t(merge(data.frame(V2=v2), as.data.frame(v1))) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] V2 a a a a a b b b c c c c c c V1 1 1 1 1 1 2 2 2 3 3 3 3 3 3 [,15] [,16] [,17] [,18] V2 c c c c V1 3 3 3 3 On Wednesday, July 23, 2014 10:06 PM, Uwe Ligges lig...@statistik.tu-dortmund.de wrote: On 23.07.2014 21:16, carol white wrote: Hi, I have a matrix of unique elements (strings) like v1 and a vector which contains replicated values of the 2nd column of the first matrix. v1 = cbind(c(1,2,3),c(a,b,c)) v2 = c(rep(a,5), rep(c,10), rep(b,3)) How can I add a column to v2 that contains the values of the first column of the first matrix v1 where the 2nd column of v1 matches the values of v2? Do I need to grep by looping over the nrow of v1 which is very time consuming or is there a better solution? the results should be the same as v3=rbind( c(rep(a,5), rep(c,10), rep(b,3)), c(rep(1,5), rep(3,10), rep(2,3))) I'd try t(merge(data.frame(V2=v2), as.data.frame(v1))) Best, Uwe Ligges --- v1 [,1] [,2] [,3] [1,] 1 2 3 [2,] a b c v2 [1] a a a a a c c c c c c c c c c b b b v3 [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,] a a a a a c c c c c c c c c [2,] 1 1 1 1 1 3 3 3 3 3 3 3 3 3 [,15] [,16] [,17] [,18] [1,] c b b b [2,] 3 2 2 2 [[alternative HTML version deleted]] __ 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. [[alternative HTML version deleted]] __ 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] duplicated rows of a matrix
Hi, is it possible to find the duplicated rows of a matrix without a loop or i have to loop over the rows? duplicated doesn't seem to be helpful Thanks Carol [[alternative HTML version deleted]] __ 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] duplicated rows of a matrix
I need that duplicated indicate all row indices (occurences) that are duplicated. In your example, rows 2,3,4,5,8 Thanks. Carol On Monday, July 21, 2014 9:17 PM, William Dunlap wdun...@tibco.com wrote: Can you give an example of duplicated() not working on the rows of a matrix? Here is an example where it does work: m - cbind(c(a=1,b=2,c=3,d=2,e=3,f=4,g=1,h=1), c(11,13,11,13,11,13,13,11)) class(m) [1] matrix m [,1] [,2] a 1 11 b 2 13 c 3 11 d 2 13 e 3 11 f 4 13 g 1 13 h 1 11 duplicated(m) [1] FALSE FALSE FALSE TRUE TRUE FALSE FALSE TRUE m[duplicated(m), ] [,1] [,2] d 2 13 e 3 11 h 1 11 Bill Dunlap TIBCO Software wdunlap tibco.com On Mon, Jul 21, 2014 at 7:54 AM, carol white wht_...@yahoo.com wrote: Hi, is it possible to find the duplicated rows of a matrix without a loop or i have to loop over the rows? duplicated doesn't seem to be helpful Thanks Carol [[alternative HTML version deleted]] __ 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. [[alternative HTML version deleted]] __ 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] 1st el of a list of vectors
Hi, If we have a list of vectors of different lengths, how is it possible to retrieve the first element of the vectors of the list? l = list(c(1,2), c(3,5,6), c(7)) 1,3,7 should be retrieved Thanks Carol [[alternative HTML version deleted]] __ 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] odd, even indices of a vector
Might be a trivial question but how to identify the odd and even indices of a vector? x = c(1,z,w,2,6,7) el of odd indices= 1,w,6 el of even indices= z,2,7 given the def of odd and even in https://stat.ethz.ch/pipermail/r-help/2010-July/244299.html should a loop be used? for (i in 1: length(x)) if (is.odd(i)) print (i) Carol [[alternative HTML version deleted]] __ 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] writing matrices of different rows in a file
Hi, What is the best way of writing of matrices of different rows in a file? Should the matrices with the same number of rows be written first and then, empty columns for the matrices with a smaller number of rows followed by the matrices with a larger number of rows? Not a good solution (see below). Can't they be written with 1 script? m = rbind(c(1,2),c(2,44)) n = rbind(c(1,3),c(2,4),c(5,8)) write.csv(cbind(m,n),...) Error in .Method(..., deparse.level = deparse.level) : number of rows of matrices must match (see arg 2) write.csv(cbind(m,n[1.2,]),...) write.csv(cbind(cbind(rep( ,1), rep( ,1)),n[3,]),...) Warning message: In write.csv(cbind(cbind(rep( , 1), rep( , 1)), n[3, : attempt to set 'append' ignored Thanks Carol [[alternative HTML version deleted]] __ 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] access an element of a list without looping
Hi, Is there any way to access an element of a list without looping over the list nor using unlist? Just to avoid parsing a very long list. For ex, how to find a vector of a length 2 in a list without using a loop? l = list (c(1), c(2,3), c(1,2,3)) for (i in 1:length(l)) if(length(l[[i]]==2){ print (i) break } Thanks Carol [[alternative HTML version deleted]] __ 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] read a file of text with read.table
It might be a primitive question but I have a file of text and there is no separator between character on each line and the strings on each line have the same length. The format is like the following absfjdslf jfdldskjff jfsldfjslk When I read the file with read.table(myfile,colClasses = character), instead of putting the strings in a table of number of rows x length of string, read.table saves the file in a table of number of rows x 1 and each element seems to be a factor. Why does read.table not account for colClasses = character? thanks, Carol [[alternative HTML version deleted]] __ 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] read a file of text with read.table
Hi, with read.fwf, it works. But I still don't understand why it doesn't work with read.table since the sep by default is , which is the case and in one trial, I used read.table(myfile,colClasses = character, stringsAsFactors=FALSE, and stil didn't work but it should have. Regards, On Thursday, June 26, 2014 9:59 AM, Ron Crump r.e.cr...@warwick.ac.uk wrote: Hi Carol, It might be a primitive question but I have a file of text and there is no separator between character on each line and the strings on each line have the same length. The format is like the following absfjdslf jfdldskjff jfsldfjslk When I read the file with read.table(myfile,colClasses = character), instead of putting the strings in a table of number of rows x length of string, read.table saves the file in a table of number of rows x 1 and each element seems to be a factor. Why does read.table not account for colClasses = character? read.table relies on a separator to differentiate between columns, so it is not appropriate for your file, read.fwf would do the job. Setting colClasses (in my understanding) tells read.table how to treat input as it comes in - so it disables some testing of data types and makes reading quicker, it does not disable the setting of character data to be factors, which is the default. You need to use the stringsAsFactors=FALSE option for that. So, for your example (and I have added a letter to the first row to make it the same length as the others): cf - absfjdslfx jfdldskjff jfsldfjslk cdf - read.fwf(textConnection(cf),widths=rep(1,10),colClasses=character,stringsAsFactors=FALSE) See ?read.fwf for more information. A width is required for each column (in this case 1 repeated 10 times). Hope this helps. Ron. [[alternative HTML version deleted]] __ 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] extract a subset of non-contiguous elements of a matrix
Hi, Is there a way to extract a subset of non-contiguous elements of a matrix elegantly and with 1 or very few scripts? Suppose I have a matrix of positive and negative numbers (m) and I want to retrieve only the positive number. This I can do which(m0, arr.ind=T) which gives the indices of positive elements like (37,1), (80,1), ..., (54,2) etc. How can I extract positive numbers without looping on the indexes provided by which to make a new matrix? thanks, Carol [[alternative HTML version deleted]] __ 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] extract a subset of non-contiguous elements of a matrix
The extracted values don't form a matrix and that's the question how to extract because which returns the indexes? that is, from 1,1 2,1 1,2 how to retrieve values? Or if at the position 2,1, there is a negative value, how to retrieve 1,1 1,2 Carol On Thursday, June 19, 2014 1:29 PM, Bart Kastermans kaste...@kasterma.net wrote: On 19 Jun 2014, at 13:19, carol white wht_...@yahoo.com wrote: Hi, Is there a way to extract a subset of non-contiguous elements of a matrix elegantly and with 1 or very few scripts? Suppose I have a matrix of positive and negative numbers (m) and I want to retrieve only the positive number. This I can do which(m0, arr.ind=T) which gives the indices of positive elements like (37,1), (80,1), ..., (54,2) etc. How can I extract positive numbers without looping on the indexes provided by which to make a new matrix? What matrix do you want? For e.g. tm.1 - matrix(c(11,22,33,-4), ncol=2) which(tm.1 0, arr.ind=TRUE)   row col [1,] 1 1 [2,] 2 1 [3,] 1 2 tm.1[which(tm.1 0, arr.ind=TRUE)] [1] 11 22 33 The extracted values do not form a matrix. Either the above contains the answer, or I donât understand the question. Best, Bart thanks, Carol [[alternative HTML version deleted]] __ 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] extract a subset of non-contiguous elements of a matrix
 tm.1=rbind(c(1,-3,2,-4), c(1,-3,2,-4),c(1,-3,2,-4)) which(tm.1 0, arr.ind=TRUE)     row col [1,]  1  1 [2,]  2  1 [3,]  3  1 [4,]  1  3 [5,]  2  3 [6,]  3  3 so the answer should have the elements of tm.1 with the following indexes 1,1 1,3 2,1 2,3 3,1 3,3 On Thursday, June 19, 2014 3:08 PM, Bart Kastermans kaste...@kasterma.net wrote: If you give an example of input and desired output I can think about this. But at this point I do not understand what you want. In the example I gave the positive elements do not form a submatrix in any way I can think of. On 19 Jun 2014, at 15:04, carol white wht_...@yahoo.com wrote: well it gives a vector which is useless as I want a matrix. On Thursday, June 19, 2014 2:40 PM, Bart Kastermans kaste...@kasterma.net wrote: tm.1 - matrix(c(11,22,33,-4), ncol=2) which(tm.1 0, arr.ind=TRUE)  row col [1,] 1 1 [2,] 2 1 [3,] 1 2 tm.1[which(tm.1 0, arr.ind=TRUE)] [1] 11 22 33 This last command does what you ask I think. On 19 Jun 2014, at 14:12, carol white wht_...@yahoo.com wrote: The extracted values don't form a matrix and that's the question how to extract because which returns the indexes? that is, from 1,1 2,1 1,2 how to retrieve values? Or if at the position 2,1, there is a negative value, how to retrieve 1,1 1,2 Carol On Thursday, June 19, 2014 1:29 PM, Bart Kastermans kaste...@kasterma.net wrote: On 19 Jun 2014, at 13:19, carol white wht_...@yahoo.com wrote: Hi, Is there a way to extract a subset of non-contiguous elements of a matrix elegantly and with 1 or very few scripts? Suppose I have a matrix of positive and negative numbers (m) and I want to retrieve only the positive number. This I can do which(m0, arr.ind=T) which gives the indices of positive elements like (37,1), (80,1), ..., (54,2) etc. How can I extract positive numbers without looping on the indexes provided by which to make a new matrix? What matrix do you want? For e.g. tm.1 - matrix(c(11,22,33,-4), ncol=2) which(tm.1 0, arr.ind=TRUE)   row col [1,] 1 1 [2,] 2 1 [3,] 1 2 tm.1[which(tm.1 0, arr.ind=TRUE)] [1] 11 22 33 The extracted values do not form a matrix. Either the above contains the answer, or I donât understand the question. Best, Bart thanks, Carol [[alternative HTML version deleted]] __ 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] extract a subset of non-contiguous elements of a matrix
I realize that that the problem arises if there is a different number of negative numbers in the rows and columns of the original matrix. In this case, the resulting matrix won't have the same number of rows for all columns. The problem for ex doesn't arise for my example but for Bart's example [1,] 1 1 [2,] 2 1 [3,] 1 2 how to combine these elemnts? If the 2nd col contains the number of the resulting matrix, then, the number of rows are different and the matrix can't be completed. On Thursday, June 19, 2014 3:39 PM, Frede Aakmann Tøgersen fr...@vestas.com wrote: As Peter and Bart I really have a problem understanding you. Perhaps if you tell us what your desired result is going to used for we can be more helpful. You can do that using your latest example. In that example you want a matrix of sets of row and column indices. This will probably have to be a matrix of characters. There you go from a 3Ã4 matrix to a 3Ã2 matrix.  What do you want in case of Barts 2Ã2 matrix? A 3Ã1 or 1Ã3 matrix? And in a more general case? Best regards Frede Sendt fra Samsung mobil Oprindelig meddelelse Fra: carol white Dato:19/06/2014 15.18 (GMT+01:00) Til: Bart Kastermans Cc: r-help@r-project.org Emne: Re: [R] extract a subset of non-contiguous elements of a matrix  tm.1=rbind(c(1,-3,2,-4), c(1,-3,2,-4),c(1,-3,2,-4)) which(tm.1 0, arr.ind=TRUE)     row col [1,]  1  1 [2,]  2  1 [3,]  3  1 [4,]  1  3 [5,]  2  3 [6,]  3  3 so the answer should have the elements of tm.1 with the following indexes 1,1 1,3 2,1 2,3 3,1 3,3 On Thursday, June 19, 2014 3:08 PM, Bart Kastermans kaste...@kasterma.net wrote:  If you give an example of input and desired output I can think about this. But at this point I do not understand what you want. In the example I gave the positive elements do not form a submatrix in any way I can think of. On 19 Jun 2014, at 15:04, carol white wht_...@yahoo.com wrote: well it gives a vector which is useless as I want a matrix. On Thursday, June 19, 2014 2:40 PM, Bart Kastermans kaste...@kasterma.net wrote: tm.1 - matrix(c(11,22,33,-4), ncol=2) which(tm.1 0, arr.ind=TRUE)   row col [1,] 1 1 [2,] 2 1 [3,] 1 2 tm.1[which(tm.1 0, arr.ind=TRUE)] [1] 11 22 33 This last command does what you ask I think. On 19 Jun 2014, at 14:12, carol white wht_...@yahoo.com wrote: The extracted values don't form a matrix and that's the question how to extract because which returns the indexes? that is, from 1,1 2,1 1,2 how to retrieve values? Or if at the position 2,1, there is a negative value, how to retrieve 1,1 1,2 Carol On Thursday, June 19, 2014 1:29 PM, Bart Kastermans kaste...@kasterma.net wrote: On 19 Jun 2014, at 13:19, carol white wht_...@yahoo.com wrote: Hi, Is there a way to extract a subset of non-contiguous elements of a matrix elegantly and with 1 or very few scripts? Suppose I have a matrix of positive and negative numbers (m) and I want to retrieve only the positive number. This I can do which(m0, arr.ind=T) which gives the indices of positive elements like (37,1), (80,1), ..., (54,2) etc. How can I extract positive numbers without looping on the indexes provided by which to make a new matrix? What matrix do you want? For e.g. tm.1 - matrix(c(11,22,33,-4), ncol=2) which(tm.1 0, arr.ind=TRUE)   row col [1,] 1 1 [2,] 2 1 [3,] 1 2 tm.1[which(tm.1 0, arr.ind=TRUE)] [1] 11 22 33 The extracted values do not form a matrix. Either the above contains the answer, or I donât understand the question. Best, Bart thanks, Carol        [[alternative HTML version deleted]] [[alternative HTML version deleted]] __ 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] title size problem
Hi, When I use any value greater than 2 for cex.main in title, I get title(myTitle, cex.main= 5) Error in title(myTitle, cex.main = 5) : X11 font -adobe-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*, face 2 at size 60 could not be loaded How to fix it? Thanks Carol [[alternative HTML version deleted]] __ 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] find an empty char in the name of a vector
Hi, I have a vector with the name of an element that is empty. How can I find out the index of this element? The following doesn't work: empty.char = grep('[:blank:||:space:]' ,names(v)) if (length(empty.char)0) How about if the name of one element is g_ and the name of other elements g_anyword where any word contain alphanumeric characters and I want to find the one whose name contain only g_? Cheers, Carol [[alternative HTML version deleted]] __ 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] matrix column division by vector
Hi, What is the elegant script to divide the columns of a matrix by the respective position of a vector elements? m=rbind(c(6,4,2),c(3,2,1)) v= c(3,2,1) res= 6/3 4/2 2/1 3/3 2/2 1/1 this is correct mat2 = NULL for (i in 1: ncol(m)) mat2 = cbind(mat2, m[,i]/ v[i]) but how to do more compact and elegant with for ex do.call? Many thanks Carol [[alternative HTML version deleted]] __ 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] position of a string in a data frame
Hi, It might be a primitive question but how to find the position of a string in a data frame? Suppose I search the word sum (case insensitive) in a data frame and it is in the 7th row, 3rd column, how to retrieve the indices 7, 3? I tried to use grep with tapply but it doesn't work. Many thanks Carol [[alternative HTML version deleted]] __ 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] interaction.plot for continuous variables
Hi, Since factor variables should be used with interaction.plot, which function can be used to illustrate interactions between continuous variables? Regards, Carol [[alternative HTML version deleted]] __ 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] R update problem
Hi, I try to update R on Ubuntu I added deb http://cran.cnr.Berkeley.edu/bin/linux/ubuntu precise/ in /etc/apt/sources.list but any mirror site that I take, I get the following error msg: W: GPG error: http://cran.cnr.Berkeley.edu precise/ Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 51716619E084DAB9 What is the solution? Thanks Carol [[alternative HTML version deleted]] __ 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] R update problem
yes, and here is the output Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.DhD6e2Q3Xb --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver keyserver.ubuntu.com --recv-keys E084DAB9 gpg: requesting key E084DAB9 from hkp server keyserver.ubuntu.com gpg: key E084DAB9: public key Michael Rutter marut...@gmail.com imported gpg: Total number processed: 1 gpg: imported: 1 (RSA: 1) From: Emre Sahin i.emre.sa...@gmail.com Cc: r-h...@stat.math.ethz.ch r-h...@stat.math.ethz.ch Sent: Wednesday, May 15, 2013 5:35 PM Subject: Re: [R] R update problem On Wed, May 15, 2013 at 07:59:32AM -0700, carol white wrote: Hi, I try to update R on Ubuntu I added deb http://cran.cnr.Berkeley.edu/bin/linux/ubuntu precise/ in /etc/apt/sources.list but any mirror site that I take, I get the following error msg: W: GPG error: http://cran.cnr.Berkeley.edu precise/ Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 51716619E084DAB9 Hi, In a terminal, could you type sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9 HTH. E. [[alternative HTML version deleted]] __ 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] boxplot
Hi, It must be an easy question but how to boxplot a subset of data: data = read.table(my_data.txt, header = T) boxplot(data$var1[data$loc == nice]~data$loc_type[data$loc == nice]) #in this case, i want to display only the boxplot loc == nice #doesn't display the boxplot of only loc == nice. It also displays loc == mice Thanks Carol loc typeloc_typevar1var2 niceSA nice_SA 2.96E+033.33E+03 niceSA nice_SA 4.07E+034.44E+03 niceSA nice_SA 3.33E+034.81E+03 niceAm nice_Am 3.70E+020.00E+00 niceAm nice_Am 7.41E+020.00E+00 niceAm nice_Am 1.48E+030.00E+00 niceAp nice_Ap 3.70E+020.00E+00 niceAp nice_Ap 3.70E+020.00E+00 niceAp nice_Ap 3.70E+020.00E+00 niceAm_Ap nice_Am_Ap 0.00E+000.00E+00 niceAm_Ap nice_Am_Ap 0.00E+000.00E+00 niceAm_Ap nice_Am_Ap 0.00E+000.00E+00 miceSA mice_SA 9.26E+056.67E+04 miceSA mice_SA 8.52E+057.78E+04 miceSA mice_SA 9.63E+058.15E+04 miceAm mice_Am 5.93E+035.56E+03 miceAm mice_Am 5.56E+037.04E+03 miceAm mice_Am 7.78E+037.41E+03 miceAp mice_Ap 8.89E+034.07E+03 miceAp mice_Ap 9.63E+033.33E+03 miceAp mice_Ap 1.07E+042.59E+03 miceAm_Ap mice_Am_Ap 4.07E+031.11E+03 miceAm_Ap mice_Am_Ap 4.81E+031.11E+03 miceAm_Ap mice_Am_Ap 5.56E+033.70E+02 __ 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] Fw: rpart
Should I understand that this message was received? Thanks - Forwarded Message - From: carol white wht_...@yahoo.com To: r-h...@stat.math.ethz.ch r-h...@stat.math.ethz.ch Sent: Sunday, January 27, 2013 8:31 PM Subject: rpart Hi, When I look at the summary of an rpart object run on my data, I get 7 nodes but when I plot the rpart object, I get only 3 nodes. Should the number of nodes not match in the results of the 2 functions (summary and plot) or it is not always the same? Look forward to your reply, Carol summary(rpart.res) Call: rpart(formula = mydata$class ~ ., data = as.data.frame(t(mydata))) n= 62 CP nsplit rel error xerror xstd 1 0.6363636 0 1.000 1.000 0.1712469 2 0.1363636 1 0.3636364 0.6818182 0.1532767 3 0.010 2 0.2272727 0.7727273 0.1596659 Variable importance Hsa.627 Hsa.692 Hsa.692.2 Hsa.3306 Hsa.601 Hsa.831 Hsa.1832 Hsa.2456 19 13 11 10 10 8 6 6 Hsa.8147 Hsa.1131 Hsa.692.1 6 5 5 Node number 1: 62 observations, complexity param=0.6363636 predicted class=t expected loss=0.3548387 P(node) =1 class counts: 22 40 probabilities: 0.355 0.645 left son=2 (14 obs) right son=3 (48 obs) Primary splits: Hsa.627 59.83 to the left, improve=15.05376, (0 missing) Hsa.8147 1696.23 to the right, improve=14.46790, (0 missing) Hsa.37937 379.39 to the right, improve=13.75358, (0 missing) Hsa.692.2 842.305 to the right, improve=12.38710, (0 missing) Hsa.1832 735.805 to the right, improve=11.90495, (0 missing) Surrogate splits: Hsa.692.2 1086.655 to the right, agree=0.903, adj=0.571, (0 split) Hsa.3306 170.515 to the left, agree=0.887, adj=0.500, (0 split) Hsa.601 88.065 to the left, agree=0.887, adj=0.500, (0 split) Hsa.692 1251.99 to the right, agree=0.871, adj=0.429, (0 split) Hsa.831 281.54 to the left, agree=0.871, adj=0.429, (0 split) Node number 2: 14 observations predicted class=n expected loss=0 P(node) =0.2258065 class counts: 14 0 probabilities: 1.000 0.000 Node number 3: 48 observations, complexity param=0.1363636 predicted class=t expected loss=0.167 P(node) =0.7741935 class counts: 8 40 probabilities: 0.167 0.833 left son=6 (7 obs) right son=7 (41 obs) Primary splits: Hsa.8147 1722.605 to the right, improve=4.915215, (0 missing) Hsa.1832 681.145 to the right, improve=4.915215, (0 missing) Hsa.1410 49.985 to the left, improve=4.915215, (0 missing) Hsa.2456 186.195 to the right, improve=4.915215, (0 missing) Hsa.11616 969.085 to the right, improve=4.915215, (0 missing) Surrogate splits: Hsa.1832 681.145 to the right, agree=1.000, adj=1.000, (0 split) Hsa.2456 186.195 to the right, agree=1.000, adj=1.000, (0 split) Hsa.692 1048.375 to the right, agree=0.979, adj=0.857, (0 split) Hsa.692.1 1136.75 to the right, agree=0.979, adj=0.857, (0 split) Hsa.1131 1679.54 to the right, agree=0.979, adj=0.857, (0 split) Node number 6: 7 observations predicted class=n expected loss=0.2857143 P(node) =0.1129032 class counts: 5 2 probabilities: 0.714 0.286 Node number 7: 41 observations predicted class=t expected loss=0.07317073 P(node) =0.6612903 class counts: 3 38 probabilities: 0.073 0.927 attachment: rpart.png__ 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] rpart
Hi, When I look at the summary of an rpart object run on my data, I get 7 nodes but when I plot the rpart object, I get only 3 nodes. Should the number of nodes not match in the results of the 2 functions (summary and plot) or it is not always the same? Look forward to your reply, Carol summary(rpart.res) Call: rpart(formula = mydata$class ~ ., data = as.data.frame(t(mydata))) n= 62 CP nsplit rel error xerror xstd 1 0.6363636 0 1.000 1.000 0.1712469 2 0.1363636 1 0.3636364 0.6818182 0.1532767 3 0.010 2 0.2272727 0.7727273 0.1596659 Variable importance Hsa.627 Hsa.692 Hsa.692.2 Hsa.3306 Hsa.601 Hsa.831 Hsa.1832 Hsa.2456 19 13 11 10 10 8 6 6 Hsa.8147 Hsa.1131 Hsa.692.1 6 5 5 Node number 1: 62 observations, complexity param=0.6363636 predicted class=t expected loss=0.3548387 P(node) =1 class counts: 22 40 probabilities: 0.355 0.645 left son=2 (14 obs) right son=3 (48 obs) Primary splits: Hsa.627 59.83 to the left, improve=15.05376, (0 missing) Hsa.8147 1696.23 to the right, improve=14.46790, (0 missing) Hsa.37937 379.39 to the right, improve=13.75358, (0 missing) Hsa.692.2 842.305 to the right, improve=12.38710, (0 missing) Hsa.1832 735.805 to the right, improve=11.90495, (0 missing) Surrogate splits: Hsa.692.2 1086.655 to the right, agree=0.903, adj=0.571, (0 split) Hsa.3306 170.515 to the left, agree=0.887, adj=0.500, (0 split) Hsa.601 88.065 to the left, agree=0.887, adj=0.500, (0 split) Hsa.692 1251.99 to the right, agree=0.871, adj=0.429, (0 split) Hsa.831 281.54 to the left, agree=0.871, adj=0.429, (0 split) Node number 2: 14 observations predicted class=n expected loss=0 P(node) =0.2258065 class counts: 14 0 probabilities: 1.000 0.000 Node number 3: 48 observations, complexity param=0.1363636 predicted class=t expected loss=0.167 P(node) =0.7741935 class counts: 8 40 probabilities: 0.167 0.833 left son=6 (7 obs) right son=7 (41 obs) Primary splits: Hsa.8147 1722.605 to the right, improve=4.915215, (0 missing) Hsa.1832 681.145 to the right, improve=4.915215, (0 missing) Hsa.1410 49.985 to the left, improve=4.915215, (0 missing) Hsa.2456 186.195 to the right, improve=4.915215, (0 missing) Hsa.11616 969.085 to the right, improve=4.915215, (0 missing) Surrogate splits: Hsa.1832 681.145 to the right, agree=1.000, adj=1.000, (0 split) Hsa.2456 186.195 to the right, agree=1.000, adj=1.000, (0 split) Hsa.692 1048.375 to the right, agree=0.979, adj=0.857, (0 split) Hsa.692.1 1136.75 to the right, agree=0.979, adj=0.857, (0 split) Hsa.1131 1679.54 to the right, agree=0.979, adj=0.857, (0 split) Node number 6: 7 observations predicted class=n expected loss=0.2857143 P(node) =0.1129032 class counts: 5 2 probabilities: 0.714 0.286 Node number 7: 41 observations predicted class=t expected loss=0.07317073 P(node) =0.6612903 class counts: 3 38 probabilities: 0.073 0.927 attachment: rpart.png__ 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] reviews for quality control
Hi, It might be a trivial question but I just wonder if you could advise good theoretical tutorials, reviews on NGS (different platforms) quality control like nucleotides quality by cycle, nucleotides frequency by cycle, GC content and distribution, K-mer frequency by cycle as well as quality control after alignment and mapping. Look forward to your reply, Carol [[alternative HTML version deleted]] __ 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] function for inverse normal transformation
Hi, What is the function for inverse normal transformation? Thanks, Carol [[alternative HTML version deleted]] __ 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] function for inverse normal transformation
Thanks for your reply. So to derive it from a given data set, is the following correct to do? my_data.p =2*pnorm(abs(my_data),lower.tail=FALSE) my_data.q = qnorm(my_data.p) Cheers, From: Duncan Murdoch murdoch.dun...@gmail.com Cc: r-h...@stat.math.ethz.ch r-h...@stat.math.ethz.ch Sent: Friday, July 20, 2012 1:23 PM Subject: Re: [R] function for inverse normal transformation On 12-07-20 6:21 AM, carol white wrote: Hi, What is the function for inverse normal transformation? qnorm Duncan Murdoch Thanks, Carol [[alternative HTML version deleted]] __ 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. [[alternative HTML version deleted]] __ 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] function for inverse normal transformation
I have a continuous data. So to calculate the inverse normal transformation, I thought that I should first calculate the Z-score normalized data and then, calculate the p-value et the quantile transformation. Does this seem to be more sensible my_data.p =2*pnorm(abs(scale(my_data)),lower.tail=FALSE) my_data.q= qnorm(my_data.p) The attached file shows the histogram of a small data set before transformation, the p-value generated from the Z-score normalized data and then, the qnorm-transformed data. Thanks for your feedback, From: Duncan Murdoch murdoch.dun...@gmail.com To: carol white wht_...@yahoo.com Cc: r-h...@stat.math.ethz.ch r-h...@stat.math.ethz.ch Sent: Friday, July 20, 2012 1:42 PM Subject: Re: [R] function for inverse normal transformation On 12-07-20 7:36 AM, carol white wrote: Thanks for your reply. So to derive it from a given data set, is the following correct to do? my_data.p =2*pnorm(abs(my_data),lower.tail=FALSE) my_data.q = qnorm(my_data.p) I don't know what you're trying to do, but that doesn't look like it does something sensible. It would take a value like 2, compute the p to be 0.045, and return the corresponding quantile of the normal distribution, i.e. -1.69 or so. I don't know why you'd want to do that. Duncan Murdoch Cheers, From: Duncan Murdoch murdoch.dun...@gmail.com To: carol white wht_...@yahoo.com Cc: r-h...@stat.math.ethz.ch r-h...@stat.math.ethz.ch Sent: Friday, July 20, 2012 1:23 PM Subject: Re: [R] function for inverse normal transformation On 12-07-20 6:21 AM, carol white wrote: Hi, What is the function for inverse normal transformation? qnorm Duncan Murdoch Thanks, Carol [[alternative HTML version deleted]] __ 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. attachment: tmp.png__ 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] function for inverse normal transformation
Thanks Rui. I changed my scripts to the followings and I think that it still is not correct. See also the attached file. Thanks for your help, tmp [1] 2.502519 1.828576 3.755778 17.415000 3.779296 2.956850 2.379663 [8] 1.103559 8.920316 2.744500 2.938480 7.522174 10.629200 8.552259 [15] 5.425938 4.388906 0.00 0.723887 11.337860 3.763786 tmp.p =2*pnorm(abs(scale(tmp)),lower.tail=FALSE) tmp.qnorm = qnorm(tmp.p/2,lower.tail=FALSE) tmp.qnorm = qnorm(tmp.p/2,lower.tail=FALSE)*sign(tmp) equal(tmp, tmp.qnorm) [1] FALSE par(mfrow = c(1,3)) hist(tmp) hist(tmp.p) hist(tmp.qnorm) From: Rui Barradas ruipbarra...@sapo.pt To: carol white wht_...@yahoo.com Cc: r-help r-help@r-project.org Sent: Friday, July 20, 2012 2:02 PM Subject: Re: [R] function for inverse normal transformation Hello, No it's not correct, you are computing a what seems to be a two-tailed probabiity, so the inverse should account for it. Look closely: you take the absolute value, then the upper tail probability, then multiply 2 into it. Reverse these steps to get the correct value. # Helper function equal - function(x, y, tol=.Machine$double.eps^0.5) all(abs(x - y) tol) m - rnorm(5) p - 2*pnorm(abs(m), lower.tail=FALSE) m2 - qnorm(p/2, lower.tail=FALSE)*sign(m) equal(m, m2) (The helper function is just to test floating point values computed differently for equality.) Hope this helps, Rui Barradas Em 20-07-2012 12:36, carol white escreveu: Thanks for your reply. So to derive it from a given data set, is the following correct to do? my_data.p =2*pnorm(abs(my_data),lower.tail=FALSE) my_data.q = qnorm(my_data.p) Cheers, From: Duncan Murdoch murdoch.dun...@gmail.com Cc: r-h...@stat.math.ethz.ch r-h...@stat.math.ethz.ch Sent: Friday, July 20, 2012 1:23 PM Subject: Re: [R] function for inverse normal transformation On 12-07-20 6:21 AM, carol white wrote: Hi, What is the function for inverse normal transformation? qnorm Duncan Murdoch Thanks, Carol [[alternative HTML version deleted]] __ 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. [[alternative HTML version deleted]] __ 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. attachment: tmp.png__ 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] prcomp
Hi, If center=T (by default) in invoking prcomp, that is, prcomp (x) where x is a matrix with the observations are in rows and the variables are in column, is this equivalent to scale(t(x),center=T,scale=F) where x is a matrix with the observations are in rows and the variables are in columns? Additionally, could you advise when the variables should mean centered (center = T in prcomp) before the application of PCA? According to the documentation of prcomp, the variables and I assume not the observations are mean-centered if center = T. I have a discrete data containing 0, 1 and 2. Should I mean center the variables (center = T in prcomp)? See the histogram in attachment. When I don't mean center, the first PC captures 91% of variability. and when I mean center, the first PC captures 1% of variability, see the proportion of variation: non-mean centered variables: PC1 PC2 PC3 Standard deviation 259.42437 11.12854 6.865225 Proportion of Variance 0.91282 0.00168 0.000640 Cumulative Proportion 0.91282 0.91450 0.915140 mean-centered variables: PC1 PC2 PC3 Standard deviation 11.30053 6.870346 5.64987 Proportion of Variance 0.01985 0.007340 0.00496 Cumulative Proportion 0.01985 0.027190 0.03215 Thanks in advance, Carol__ 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] all occurences of an element in a vector
Hi, How do you identify all occurences of an element or a sub-vector in a vector as opposed to match, %in%, and intersect which find the first occurrence of an element? Cheers, Carol [[alternative HTML version deleted]] __ 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] all occurences of an element in a vector
like searching m or [m,n] in [1,n,m,e,m,n,n,u]. I want the exact match of all occurrences of m and n in the last vector. Therefore, grep is not helpful as it will extract if there are also mm and mmm. Cheers, Carol From: Ista Zahn istaz...@gmail.com Cc: r-h...@stat.math.ethz.ch r-h...@stat.math.ethz.ch Sent: Monday, May 21, 2012 3:38 PM Subject: Re: [R] all occurences of an element in a vector Hi Carol, I'm not sure what a sub-vector in a vector is, but I think you might be looking for ?grep Best, Ista Hi, How do you identify all occurences of an element or a sub-vector in a vector as opposed to match, %in%, and intersect which find the first occurrence of an element? Cheers, Carol [[alternative HTML version deleted]] __ 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. [[alternative HTML version deleted]] __ 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] labels in hist and ranges of an axis
Hi, How is it possible to change the character size of labels in a histogram (labels parameter in hist)? How is it possible to display the ranges of an axis in 3 significant digits? Thanks Carol [[alternative HTML version deleted]] __ 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] labels in hist and ranges of an axis
Thanks Gerrit. cex.axis changes the size of the axis label. I want to change the size of data labels that are displayed at the top of the bars in the histogram. What we obtain by histogram(...,labels=T) Any clue? Cheers, From: Gerrit Eichner gerrit.eich...@math.uni-giessen.de Cc: r-h...@stat.math.ethz.ch r-h...@stat.math.ethz.ch Sent: Monday, May 14, 2012 11:31 AM Subject: Re: [R] labels in hist and ranges of an axis Hi, Carol! How is it possible to change the character size of labels in a histogram (labels parameter in hist)? See ?par - cex.axis How is it possible to display the ranges of an axis in 3 significant digits? See ?axis and its argument at together with ?signif Hth -- Gerrit - Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.uni-giessen.de Justus-Liebig-University Giessen Tel: +49-(0)641-99-32104 Arndtstr. 2, 35392 Giessen, Germany Fax: +49-(0)641-99-32109 http://www.uni-giessen.de/cms/eichner - [[alternative HTML version deleted]] __ 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] storage of matrices of diff dimension together
Hi, It might be a trivial question but how do you store matrices of different dimensions read from a file or in a loop together? The best solution might be a list but I don't store the first matrix correctly: m = rbind(c(1,2),c(3,4),c(5,6)) t=rbind(c(1,2),c(5,6)) l = list(m) l = list(l,t) #I assumed that at the begining I don't have m and t at the same time to do list(m,t), but I list them, one after the other l [[1]] [[1]][[1]] [,1] [,2] [1,] 1 2 [2,] 3 4 [3,] 5 6 [[2]] [,1] [,2] t 1 2 5 6 thanks Carol [[alternative HTML version deleted]] __ 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] warning with glm.predict, wrong number of data rows
Hi, I split a data set into two partitions (80 and 42), use the first as the training set in glm and the second as testing set in glm predict. But when I call glm.predict, I get the warning message: Warning message: 'newdata' had 42 rows but variable(s) found have 80 rows - s = sample(1:122) glm.my.data=glm(my.data.class[s[1:80]]~t(my.data)[s[1:80],1:60],family=binomial) pred.my.data = predict(glm.gse13355,as.data.frame(t(my.data)[s[81:122],1:60]),type=response) Warning message: 'newdata' had 42 rows but variable(s) found have 80 rows length(pred.my.data) [1] 80 Thanks Carol [[alternative HTML version deleted]] __ 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] selective labels display on histogram
Hello, Is it possible to selectively display labels on a histogram? Thanks Carol [[alternative HTML version deleted]] __ 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] selective labels display on histogram
No, data labels on the histogram bars. labels = T in hist displays all data labels. thanks From: Petr PIKAL petr.pi...@precheza.cz Cc: r-h...@stat.math.ethz.ch r-h...@stat.math.ethz.ch Sent: Thursday, April 12, 2012 4:03 PM Subject: Re: [R] selective labels display on histogram Hi Hello, Is it possible to selectively display labels on a histogram? What labels? Like that? x-rnorm(1) hist(x) hist(x, axes=F, xlab=bla, ylab=ble, main=bleble) axis(1, at=c(-4, -1, 1, 4)) Regards Petr Thanks Carol [[alternative HTML version deleted]] __ 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. [[alternative HTML version deleted]] __ 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] X11 display problem
Hi, I run R on a unix server and login from a Mac with ssh -X. When I want to run a graphics function like hist, I get the following x11 message: Error in X11(d$display, d$width, d$height, d$pointsize, d$gamma, d$colortype, : unable to start device X11cairo In addition: Warning message: In function (display = , width, height, pointsize, gamma, bg, : unable to open connection to X11 display '' Do I need any library like cairo installed on my local Mac? I also set LC_CTYPE=en_US.UTF-8 in my profile Cheers, Carol [[alternative HTML version deleted]] __ 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] sdev, variance in prcomp
Hello, It might be a trivial question but I just wanted to find out the relationship between sdev and proportion of variance generated by prcomp. I got the following result from my data set PC1 PC2 PC3 Standard deviation 104.89454 15.40910 9.012047 Proportion of Variance 0.52344 0.01130 0.003860 Cumulative Proportion 0.52344 0.53474 0.538600 first, I had thought that the variance must be standard deviation power to 2 but it seems that variance is sdev/200. Did I misunderstood some thing? Best, Carol __ 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] time between two dates
Dear All, It may be a trivial question but how to determine the number of days between two dates? What I want to do is to subtract two dates by a function which returns the number of days between these two dates. 11.11.2008-11.11.2006 ~= 730 days Look forward to your reply, Carol __ 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] sort dates
Hello, How is it possible to sort dates in R? Cheers, Carol __ 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] breaks display of hist
Hello, How can I display the xlim of the boundaries of all or specific breaks in a histogram? I generated the attached plot with hist and would like to know which values of x correspond to the frequency 329 and display these values on the x axis? Best, carol__ 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] X11 fonts problems
Hello, I installed R--2-1.14.1.pkg on mac OS v 10.7.2 and when I wanted to invoke hist, I got the following error msg: Error in title(main = main, sub = sub, xlab = xlab, ylab = ylab, ...) : could not find any X11 fonts Check that the Font Path is correct. In addition: Warning messages: 1: In function (display = , width, height, pointsize, gamma, bg, : locale not supported by Xlib: some X ops will operate in C locale 2: In function (display = , width, height, pointsize, gamma, bg, : X cannot set locale modifiers Should I have installed any package or should I install any thing else for X11 like free type-2.4.8? I have found some directories related to fonts but apparently, are useless for this purpose? I installed devpack4-darwin8-bin4 but didn't help. sessionInfo() R version 2.14.1 (2011-12-22) Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) locale: [1] C/UTF-8/C/C/C/C attached base packages: [1] stats graphics grDevices utils datasets methods base Thanks in advance Carol __ 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 in rep.int(boxwex, n) : negative length vectors are not allowed
Dear All, I tried to invoke plot for a matrix of 196475 x2 dimension. I loaded the data with read.table. On one dimension, there are strings (names) and on the other dimension, the floats between 0 and 1. When I invoked plot by setting x to names and y to floats and ylim = c(0,1), I got the following error message: Error in rep.int(boxwex, n) : negative length vectors are not allowed Does it come from the large-size dimension of the matrix and which vectors get a negative length? Best, Carol __ 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] Fw: Error in rep.int(boxwex, n) : negative length vectors are not allowed-cont.
Sorry for the error: the first column is of the string type and the second column of float, respectively. - Forwarded Message - From: carol white wht_...@yahoo.com To: r-h...@stat.math.ethz.ch r-h...@stat.math.ethz.ch Cc: Sent: Wednesday, February 15, 2012 4:46 PM Subject: Error in rep.int(boxwex, n) : negative length vectors are not allowed Dear All, I tried to invoke plot for a matrix of 196475 x2 dimension. I loaded the data with read.table. On one dimension, there are strings (names) and on the other dimension, the floats between 0 and 1. When I invoked plot by setting x to names and y to floats and ylim = c(0,1), I got the following error message: Error in rep.int(boxwex, n) : negative length vectors are not allowed Does it come from the large-size dimension of the matrix and which vectors get a negative length? Best, Carol __ 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 message in R 2.1.14 installation
Hi, I tried to install R.2.14.1 but when running ./configure command, I got the following error message configure: error: --with-readline=yes (default) and headers/libs are not available All checking prior to this error message passed without any problem (see below). Cheers, Carol [root@localhost R-2.14.1]# ./configure checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu loading site script './config.site' loading build-specific script './config.site' checking for pwd... /bin/pwd checking whether builddir is srcdir... yes checking for working aclocal... found checking for working autoconf... found checking for working automake... found checking for working autoheader... found checking for gawk... gawk checking whether ln -s works... yes checking for bison... bison -y checking for ar... ar checking for a BSD-compatible install... /usr/bin/install -c checking for sed... /bin/sed checking for which... /usr/bin/which checking for less... /usr/bin/less checking for gtar... /bin/gtar checking for tex... /usr/bin/tex checking for pdftex... /usr/bin/pdftex checking for pdflatex... /usr/bin/pdflatex checking for makeindex... /usr/bin/makeindex checking for makeinfo... /usr/bin/makeinfo checking whether makeinfo version is at least 4.7... yes checking for install-info... /sbin/install-info checking for texi2dvi... /usr/bin/texi2dvi checking for kpsewhich... /usr/bin/kpsewhich configure: WARNING: inconsolata.sty not found: PDF vignettes and package manuals will not be rendered optimally checking for unzip... /usr/bin/unzip checking for zip... /usr/bin/zip checking for gzip... /bin/gzip checking for bzip2... /usr/bin/bzip2 checking for firefox... /usr/bin/firefox using default browser ... /usr/bin/firefox checking for acroread... /usr/bin/acroread checking for notangle... false checking for pkg-config... /usr/bin/pkg-config checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking how to run the C preprocessor... gcc -E checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking whether gcc needs -traditional... no checking how to run the C preprocessor... gcc -E checking for gfortran... gfortran checking whether we are using the GNU Fortran 77 compiler... yes checking whether gfortran accepts -g... yes checking for g++... g++ checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes checking how to run the C++ preprocessor... g++ -E checking whether __attribute__((visibility())) is supported... yes checking whether gcc accepts -fvisibility... yes checking whether gfortran accepts -fvisibility... yes checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking minix/config.h usability... no checking minix/config.h presence... no checking for minix/config.h... no checking whether it is safe to define __EXTENSIONS__... yes checking for gcc... gcc checking whether we are using the GNU Objective C compiler... yes checking whether gcc accepts -g... yes checking for Objective C++ compiler... trying some possibilities checking whether g++ can compile ObjC++... no no working compiler found checking for a sed that does not truncate output... (cached) /bin/sed checking for fgrep... /bin/grep -F checking for ld used by gcc... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B checking the name lister (/usr/bin/nm -B) interface... BSD nm checking the maximum length of command line arguments... 1966080 checking whether the shell understands some XSI constructs... yes checking whether the shell understands +=... yes checking for /usr/bin/ld option to reload object files... -r checking for objdump... objdump checking how to recognize dependent libraries... pass_all checking for strip... strip checking for ranlib... ranlib checking command to parse /usr/bin/nm -B output from gcc object... ok checking for dlfcn.h... yes checking whether we are using the GNU C++ compiler... (cached) yes checking whether g++ accepts -g... (cached) yes checking how to run the C++ preprocessor... g++ -E checking whether we are using the GNU Fortran 77 compiler... (cached) yes checking whether gfortran accepts -g... (cached) yes checking for objdir... .libs checking if gcc supports -fno-rtti -fno-exceptions... no
Re: [R] error message in R 2.1.14 installation
The OS is fedora 10. It's also a 32-bit architecture. Best, - Original Message - From: peter dalgaard pda...@gmail.com To: carol white wht_...@yahoo.com Cc: r-h...@stat.math.ethz.ch r-h...@stat.math.ethz.ch Sent: Thursday, January 12, 2012 1:27 PM Subject: Re: [R] error message in R 2.1.14 installation On Jan 12, 2012, at 13:03 , carol white wrote: Hi, I tried to install R.2.14.1 but when running ./configure command, I got the following error message configure: error: --with-readline=yes (default) and headers/libs are not available All checking prior to this error message passed without any problem (see below). You really should read the R Installation and Administration manual, and for that matter also the posting guide (e.g.: what OS is this? Debian? RedHat? Suse? Slackware?). Most likely you missed the need to install the _developer_ package for readline (called readline-dev or something like that) so that the C header files are not installed. -pd -- Peter Dalgaard, Professor Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd@cbs.dk Priv: pda...@gmail.com __ 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] unset proxy in R
Hello, Is Sys.unsetenv the right function to unset the proxy in R? Cheers, Carol __ 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] unset proxy in R
My apologies for having interfered with an existing thread. Any other proposition to unset the proxy in R is welcome. Cheers, Carol - Original Message - From: peter dalgaard pda...@gmail.com To: carol white wht_...@yahoo.com Cc: r-h...@stat.math.ethz.ch r-h...@stat.math.ethz.ch Sent: Monday, October 31, 2011 1:44 PM Subject: Re: [R] unset proxy in R On Oct 31, 2011, at 13:25 , carol white wrote: Hello, Is Sys.unsetenv the right function to unset the proxy in R? Possibly, but changing the subject of an earlier thread is not the right way to pose a question on R-help... (Send a new message. Replying to an old one causes the new one to be part of the older thread for people using threading mail clients. Worse, at least with OSX Mail, the subject of the thread is changed, so the thread on too many var in lm is now unset proxy in R.) -- Peter Dalgaard, Professor Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd@cbs.dk Priv: pda...@gmail.com __ 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] Packages for snp, CNV data
Hi, In addition to GADA, what are the available package in R and bioconductor to analyze amplification, deletion, LOH and indels of CNV, SNP data? Any reference is welcome. Best, Carol __ 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] X11 problem
Hello, TO update R under Ubuntu on my macchine, I downloaded R-2.13.1. When running ./configure, I got the following error message: checking for X... no configure: error: --with-x=yes (default) and X11 headers/libs are not available But I could use X11() function in R-2-10. So where does the problem come from? Cheers, Carol __ 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] X11 problem
Thanks for your reply. I used the following commands: sudo apt-get update sudo apt-get install r-base - Original Message - From: Kevin E. Thorpe kevin.tho...@utoronto.ca To: carol white wht_...@yahoo.com Cc: r-h...@stat.math.ethz.ch r-h...@stat.math.ethz.ch Sent: Thursday, August 25, 2011 2:34 PM Subject: Re: [R] X11 problem On 08/25/2011 08:27 AM, carol white wrote: Hello, TO update R under Ubuntu on my macchine, I downloaded R-2.13.1. When running ./configure, I got the following error message: checking for X... no configure: error: --with-x=yes (default) and X11 headers/libs are not available But I could use X11() function in R-2-10. So where does the problem come from? Cheers, Carol It looks like you're compiling from source and your system does not have the header files required installed. Did you compile your previous version or use a pre-built (binary) package? A binary package would not require the headers. I don't use Ubuntu, so I don't know what the name of packages you need for the headers. Typically the packages have the devel versions separate, you you need those. -- Kevin E. Thorpe Biostatistician/Trialist, Applied Health Research Centre (AHRC) Li Ka Shing Knowledge Institute of St. Michael's Assistant Professor, Dalla Lana School of Public Health University of Toronto email: kevin.tho...@utoronto.ca Tel: 416.864.5776 Fax: 416.864.3016 __ 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] X11 problem
both. But it worked for R-2-10. I added deb http://cran.ma.imperial.ac.uk/bin/linux/ubuntu lucid/ into /etc/apt/sources.list and ran apt-get update as root and got the following error message: W: GPG error: http://cran.ma.imperial.ac.uk lucid/ Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 51716619E084DAB9 W: GPG error: http://ppa.launchpad.net lucid Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B22AB97AF1CDFA9 - Original Message - From: Kevin E. Thorpe kevin.tho...@utoronto.ca To: carol white wht_...@yahoo.com Cc: r-h...@stat.math.ethz.ch r-h...@stat.math.ethz.ch Sent: Thursday, August 25, 2011 3:00 PM Subject: Re: [R] X11 problem On 08/25/2011 08:49 AM, carol white wrote: Thanks for your reply. I used the following commands: sudo apt-get update sudo apt-get install r-base Is that how you installed R-2-10 or how you tried to install 2.13.1? - Original Message - From: Kevin E. Thorpekevin.tho...@utoronto.ca To: carol whitewht_...@yahoo.com Cc: r-h...@stat.math.ethz.chr-h...@stat.math.ethz.ch Sent: Thursday, August 25, 2011 2:34 PM Subject: Re: [R] X11 problem On 08/25/2011 08:27 AM, carol white wrote: Hello, TO update R under Ubuntu on my macchine, I downloaded R-2.13.1. When running ./configure, I got the following error message: checking for X... no configure: error: --with-x=yes (default) and X11 headers/libs are not available But I could use X11() function in R-2-10. So where does the problem come from? Cheers, Carol It looks like you're compiling from source and your system does not have the header files required installed. Did you compile your previous version or use a pre-built (binary) package? A binary package would not require the headers. I don't use Ubuntu, so I don't know what the name of packages you need for the headers. Typically the packages have the devel versions separate, you you need those. -- Kevin E. Thorpe Biostatistician/Trialist, Applied Health Research Centre (AHRC) Li Ka Shing Knowledge Institute of St. Michael's Assistant Professor, Dalla Lana School of Public Health University of Toronto email: kevin.tho...@utoronto.ca Tel: 416.864.5776 Fax: 416.864.3016 __ 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] X11 problem
gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9 gpg: requesting key E084DAB9 from hkp server keyserver.ubuntu.com gpgkeys: HTTP fetch error 7: couldn't connect to host gpg: no valid OpenPGP data found. gpg: Total number processed: 0 How to solve the problem? Cheers, Carol - Original Message - From: Alexander Engelhardt a...@chaotic-neutral.de To: carol white wht_...@yahoo.com Cc: r-h...@stat.math.ethz.ch r-h...@stat.math.ethz.ch Sent: Thursday, August 25, 2011 3:31 PM Subject: Re: [R] X11 problem Am 25.08.2011 15:05, schrieb carol white: both. But it worked for R-2-10. I added deb http://cran.ma.imperial.ac.uk/bin/linux/ubuntu lucid/ into /etc/apt/sources.list and ran apt-get update as root and got the following error message: W: GPG error: http://cran.ma.imperial.ac.uk lucid/ Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 51716619E084DAB9 W: GPG error: http://ppa.launchpad.net lucid Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B22AB97AF1CDFA9 Hey there, I had some problems with this just a few days ago. You need to import that GPG key. See the section secure APT here: http://cran.r-project.org/bin/linux/ubuntu/ Cheers, Alex __ 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] X11 problem
Thanks I ran your command but still get the same error message when I run ./configure configure: error: --with-x=yes (default) and X11 headers/libs are not available - Original Message - From: Linlin Yan (颜林林) yanlinli...@gmail.com To: carol white wht_...@yahoo.com Cc: r-h...@stat.math.ethz.ch r-h...@stat.math.ethz.ch Sent: Thursday, August 25, 2011 3:41 PM Subject: Re: [R] X11 problem In order to build R-2.13.1 from source with X11, I guess you need to install X11 develop library. Please try this: sudo apt-get install libx11-dev On Thu, 2011-08-25 at 05:49 -0700, carol white wrote: Thanks for your reply. I used the following commands: sudo apt-get update sudo apt-get install r-base - Original Message - From: Kevin E. Thorpe kevin.tho...@utoronto.ca To: carol white wht_...@yahoo.com Cc: r-h...@stat.math.ethz.ch r-h...@stat.math.ethz.ch Sent: Thursday, August 25, 2011 2:34 PM Subject: Re: [R] X11 problem On 08/25/2011 08:27 AM, carol white wrote: Hello, TO update R under Ubuntu on my macchine, I downloaded R-2.13.1. When running ./configure, I got the following error message: checking for X... no configure: error: --with-x=yes (default) and X11 headers/libs are not available But I could use X11() function in R-2-10. So where does the problem come from? Cheers, Carol It looks like you're compiling from source and your system does not have the header files required installed. Did you compile your previous version or use a pre-built (binary) package? A binary package would not require the headers. I don't use Ubuntu, so I don't know what the name of packages you need for the headers. Typically the packages have the devel versions separate, you you need those. __ 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] X11 problem
Thanks I could run configure and make but got warning after running configure: configure: WARNING: you cannot build DVI versions of the R manuals configure: WARNING: you cannot build DVI versions of all the help pages configure: WARNING: you cannot build info or HTML versions of the R manuals configure: WARNING: you cannot build PDF versions of the R manuals configure: WARNING: you cannot build PDF versions of all the help pages The 2.13.1 version is installed but likely I will have probelm with manuals. Cheers, - Original Message - From: Linlin Yan (颜林林) yanlinli...@gmail.com To: carol white wht_...@yahoo.com Cc: r-h...@stat.math.ethz.ch r-h...@stat.math.ethz.ch Sent: Thursday, August 25, 2011 4:08 PM Subject: Re: [R] X11 problem Sorry for the wrong package name. It should be: sudo apt-get install xorg-dev On Thu, 2011-08-25 at 06:51 -0700, carol white wrote: Thanks I ran your command but still get the same error message when I run ./configure configure: error: --with-x=yes (default) and X11 headers/libs are not available - Original Message - From: Linlin Yan (颜林林) yanlinli...@gmail.com To: carol white wht_...@yahoo.com Cc: r-h...@stat.math.ethz.ch r-h...@stat.math.ethz.ch Sent: Thursday, August 25, 2011 3:41 PM Subject: Re: [R] X11 problem In order to build R-2.13.1 from source with X11, I guess you need to install X11 develop library. Please try this: sudo apt-get install libx11-dev On Thu, 2011-08-25 at 05:49 -0700, carol white wrote: Thanks for your reply. I used the following commands: sudo apt-get update sudo apt-get install r-base - Original Message - From: Kevin E. Thorpe kevin.tho...@utoronto.ca To: carol white wht_...@yahoo.com Cc: r-h...@stat.math.ethz.ch r-h...@stat.math.ethz.ch Sent: Thursday, August 25, 2011 2:34 PM Subject: Re: [R] X11 problem On 08/25/2011 08:27 AM, carol white wrote: Hello, TO update R under Ubuntu on my macchine, I downloaded R-2.13.1. When running ./configure, I got the following error message: checking for X... no configure: error: --with-x=yes (default) and X11 headers/libs are not available But I could use X11() function in R-2-10. So where does the problem come from? Cheers, Carol It looks like you're compiling from source and your system does not have the header files required installed. Did you compile your previous version or use a pre-built (binary) package? A binary package would not require the headers. I don't use Ubuntu, so I don't know what the name of packages you need for the headers. Typically the packages have the devel versions separate, you you need those. __ 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] too many var in lm
Hello, It might be an easy question but if you have many variables to fit in the lm function, how do you take all without specifying var1+var2+...+var2100 in the terms parameter in response ~ terms? Cheers, Carol __ 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] too many var in lm
Thanks for your all replies. Actually, I have more than this number of variables. I want to make a selection of variables with anova and I thought that I can apply anova to the object obtained by lm. The purpose is to select the genes discriminting control samples from disease. Best, Carol - Original Message - From: Eik Vettorazzi e.vettora...@uke.uni-hamburg.de To: carol white wht_...@yahoo.com Cc: r-h...@stat.math.ethz.ch r-h...@stat.math.ethz.ch Sent: Wednesday, August 17, 2011 3:39 PM Subject: Re: [R] too many var in lm Hi Carol, it might be another question if it is sensible to use 2100 regression parameters, but you can use . to regress one response against all other variables in a data frame as in: lm(formula = mpg ~ ., data = mtcars) and you can even exclude specific variables using - lm(formula = mpg ~ . - wt, data = mtcars) cheers. Am 17.08.2011 15:23, schrieb carol white: Hello, It might be an easy question but if you have many variables to fit in the lm function, how do you take all without specifying var1+var2+...+var2100 in the terms parameter in response ~ terms? Cheers, Carol __ 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. -- Eik Vettorazzi Department of Medical Biometry and Epidemiology University Medical Center Hamburg-Eppendorf Martinistr. 52 20246 Hamburg T ++49/40/7410-58243 F ++49/40/7410-57790 __ 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] questions about rpart
Hi, I have applied rpart to my data set and for cp=.01, the cross-validation error (xerr) is less (min 0.05) than for other cp. However, in the final tree, an important predictor is not retained. Moreover, another predictor contains missing values in 40% of samples. So I don't know if the important predictor is not retained as the result of missing values or if I should have selected other values of cp. Note that the data contains binary class. Another question is that how it is possible to interpret the relative or cross-validation error for ex by the number of samples. I know that they are scaled to 1 at the root node of the tree but for any number of splits, how much error we make for each sample (but we don't know the number of sample in each split retured by printcp). Any other information is welcome. Look forward to your reply, Carol __ 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] Fw: questions about rpart - cont.
Forgot to specify that the cross-val error cannot be decreased lower than 0.91. Note that for smaller values of cp than 0.01, the cross-val error increases. Is the cross-val error sum of squared error or relative error for classification problem (method = class in rpart function) or another type of error? Is it possible to determine the true positive, false positive using rpart? Thanks - Forwarded Message From: carol white wht_...@yahoo.com To: r-h...@stat.math.ethz.ch Sent: Wed, May 25, 2011 9:06:15 AM Subject: questions about rpart Hi, I have applied rpart to my data set and for cp=.01, the cross-validation error (xerr) is less (min 0.05) than for other cp. However, in the final tree, an important predictor is not retained. Moreover, another predictor contains missing values in 40% of samples. So I don't know if the important predictor is not retained as the result of missing values or if I should have selected other values of cp. Note that the data contains binary class. Another question is that how it is possible to interpret the relative or cross-validation error for ex by the number of samples. I know that they are scaled to 1 at the root node of the tree but for any number of splits, how much error we make for each sample (but we don't know the number of sample in each split retured by printcp). Any other information is welcome. Look forward to your reply, Carol __ 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] Evaluation of variable assigned to a function name
Hi, I have defined a function (my.func) which is used as parameter (f) of another function. As I want to give the user the possibility to define his own function instead of my.func, how can I find out if in other functions, the parameter f has the my.func value (if the user has defined a new function or not)? Moreover, I think I should impose to the user to use another function name than my.func for this (?). Or a boolean variable is better to be used to indicate if my function (my.func) or user-defined function is used? Thanks Carol __ 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] Evaluation of variable assigned to a function name
In fact, what the function is returning is the most important. So knowing that the parameters and the number of parameters of my.func defined by the user could be different from one definition to another, how to use what my.func returns in other functions? Moreover, if the function is defined by the user in an R session, it is then defined globally. In this case, does it need to be passed as a parameter? Note that my.func defined by me is loaded before. Carol - Original Message From: Uwe Ligges lig...@statistik.tu-dortmund.de To: carol white wht_...@yahoo.com Cc: r-h...@stat.math.ethz.ch Sent: Mon, January 10, 2011 2:11:48 PM Subject: Re: [R] Evaluation of variable assigned to a function name Wel, just let the user give the function in form of an argument, say foo, and use your code so that bar - function(x, ., foo){ if(missing(foo)) foo - Namespace::my.func . } but perhaps I misunderstood your question. Uwe Ligges On 10.01.2011 13:47, carol white wrote: Hi, I have defined a function (my.func) which is used as parameter (f) of another function. As I want to give the user the possibility to define his own function instead of my.func, how can I find out if in other functions, the parameter f has the my.func value (if the user has defined a new function or not)? Moreover, I think I should impose to the user to use another function name than my.func for this (?). Or a boolean variable is better to be used to indicate if my function (my.func) or user-defined function is used? Thanks Carol __ 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-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] Evaluation of variable assigned to a function name
Let the following definitions: # my definition my.func - function (x,y,z){ return (v) } # user-defined definition my.func - function (x){ ... return(v) } Considering that my.func can have different parameters but always return a vector, how to use v in bar by initializing parameters when calling my.func (x = 2 or a = 3,y=4,z=5)? How can my.func could be invoked in bar and v could be used? bar- function(x, ., foo){ if(missing(foo)) foo- Namespace::my.func . } - Original Message From: Uwe Ligges lig...@statistik.tu-dortmund.de To: carol white wht_...@yahoo.com Cc: r-h...@stat.math.ethz.ch Sent: Mon, January 10, 2011 2:48:04 PM Subject: Re: [R] Evaluation of variable assigned to a function name On 10.01.2011 14:39, carol white wrote: In fact, what the function is returning is the most important. So knowing that the parameters and the number of parameters of my.func defined by the user could be different from one definition to another, how to use what my.func returns in other functions? Moreover, if the function is defined by the user in an R session, it is then defined globally. In this case, does it need to be passed as a parameter? Note that my.func defined by me is loaded before. It depends. 1. The output of a function can always be wrapped in a list. 2. You should always pass objects that you want to use in another environment unless you really know what you are doing - and reading does not suggest you are too sure about it. 3. In this case, if your package has a Namespace, your own function rather than a user generated one in the .GlobalEnv will be found. Note that defining stuff in .GlobalEnv and relying on the fact that this version is found by another function would imply you really have to get it from the specific environment. Best, Uwe Carol - Original Message From: Uwe Liggeslig...@statistik.tu-dortmund.de To: carol whitewht_...@yahoo.com Cc: r-h...@stat.math.ethz.ch Sent: Mon, January 10, 2011 2:11:48 PM Subject: Re: [R] Evaluation of variable assigned to a function name Wel, just let the user give the function in form of an argument, say foo, and use your code so that bar- function(x, ., foo){ if(missing(foo)) foo- Namespace::my.func . } but perhaps I misunderstood your question. Uwe Ligges On 10.01.2011 13:47, carol white wrote: Hi, I have defined a function (my.func) which is used as parameter (f) of another function. As I want to give the user the possibility to define his own function instead of my.func, how can I find out if in other functions, the parameter f has the my.func value (if the user has defined a new function or not)? Moreover, I think I should impose to the user to use another function name than my.func for this (?). Or a boolean variable is better to be used to indicate if my function (my.func) or user-defined function is used? Thanks Carol __ 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-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.