Re: [R] Group rows by common ID and plot?

2011-02-25 Thread Scott Chamberlain
I imagine you want the ggplot2 package. something like: ggplot(dataframe, aes(x = yourxvar, y = youryvar)) + geom_point() + facet_wrap(~ ProbeSet.ID) Or facet_grid(), either of which makes a different panel for each unique level of ProbeSet.ID see gggplot help here: http://had.co.nz/ggplot2/

Re: [R] group by in data.frame

2011-02-25 Thread zem
Hi Ivan, thanks for your replay! but the problem is there that the dataframe has 2 rows and ca. 2000 groups, but i dont have the column with the groupnames, because the groups are depending on 2 onother columns ... any other idea or i didnt understand waht are you posted ... :( -- View th

Re: [R] Group rows by common ID and plot?

2011-02-25 Thread Mike Marchywka
> Date: Thu, 24 Feb 2011 13:28:18 -0800 > From: dannyb...@gmail.com > To: r-help@r-project.org > Subject: Re: [R] Group rows by common ID and plot? > does this do what you want?  library("lattice") df<-data.frame(x=1:100,y=1.0/(1:100),f=floor

Re: [R] lm - log(variable) - skip log(0)

2011-02-25 Thread agent dunham
Apologies, I'm really new with R, Can you help me with the syntax? here is my data.frame in which I introduce independent variables: > varind <- > data.frame(datpos$hdom2,datpos$NumPies,datpos$InHart,datpos$CV,datpos$CA,datpos$FCC) varind has dimensions(194, 6), in case that's necessary. Then

[R] nls

2011-02-25 Thread Abeer Fadda
hi, I would like to find the x value (independent variable) for a certain dependent value using the fitted model with nls. with (predict) I can find y that corresponds to a list of x. I need the other way around. can it be done? thanks, afadda __ R-hel

Re: [R] lm - log(variable) - skip log(0)

2011-02-25 Thread agent dunham
Apologies, I'm really new with R, Can you help me with the syntax? here is my data.frame in which I introduce independent variables: > varind <- > data.frame(datpos$hdom2,datpos$NumPies,datpos$InHart,datpos$CV,datpos$CA,datpos$FCC) varind has dimensions(194, 6), in case that's necessary. Then I

Re: [R] Interpreting the example given by Prof Frank Harrell in {Design} validate.cph

2011-02-25 Thread Frank Harrell
Here's the way I would explore this, and some of the code is made more tidy. Note that also you could vectorize your simulation. I have used set.seed multiple times to make bootstrap samples the same across runs. -Frank . . . if (data[i, 3] == 4) data[i, 5] <- sample(c(0, 1), 1, prob=c(.06, .

Re: [R] Visualizing Points on a Sphere

2011-02-25 Thread Matt Shotwell
That's interesting. You might also like: http://en.wikipedia.org/wiki/Von_Mises%E2%80%93Fisher_distribution I'm not sure how to plot the wireframe sphere, but you can visualize the points by transforming to Cartesian coordinates like so: u <- runif(1000,0,1) v <- runif(1000,0,1) theta <- 2 * pi *

Re: [R] Visualizing Points on a Sphere

2011-02-25 Thread Duncan Murdoch
On 25/02/2011 8:21 AM, Lorenzo Isella wrote: Dear All, I need to plot some points on the surface of a sphere, but I am not sure about how to proceed to achieve this in R (or if it is suitable for this at all). In any case, I am not looking for really fancy visualizations; for instance you can con

Re: [R] BFGS versus L-BFGS-B

2011-02-25 Thread Ben Bolker
Brian Tsai gmail.com> writes: > > Hi all, > > I'm trying to figure out the effective differences between BFGS and L-BFGS-B > are, besides the obvious that L-BFGS-B should be using a lot less memory, > and the user can provide box constraints. > > 1) Why would you ever want to use BFGS, if L-BF

Re: [R] accuracy of measurements

2011-02-25 Thread Dennis Murphy
And in that vein, the recently released MethComp package by Bendix Carstensen may be of service. HTH, Dennis On Fri, Feb 25, 2011 at 5:39 AM, Marc Schwartz wrote: > On Feb 24, 2011, at 4:50 PM, Denis Kazakiewicz wrote: > > > Dear R people > > Could you please help with following > > > > Trying

Re: [R] accuracy of measurements

2011-02-25 Thread Marc Schwartz
On Feb 24, 2011, at 4:50 PM, Denis Kazakiewicz wrote: > Dear R people > Could you please help with following > > Trying to compare accuracy of tumor size evaluation by different > methods. So data looks like > > id true metod1 method2 ... > 1 2 2 2.5 > 2 1.52 2 > 3 2 2

Re: [R] speed up process

2011-02-25 Thread Ivan Calandra
Ha... it was way too simple! I thought it would be like system.time()... my bad. Thanks for the tip! As we thought, foo_reg() takes most of the computing time, and I cannot improve that. Any ideas of how to improve the rest? Thanks again for your help Ivan Le 2/25/2011 14:29, jim holtman a é

Re: [R] speed up process

2011-02-25 Thread jim holtman
You invoke Rprof, run your code and then terminate it: Rprof() ... code you want to profile Rprof(NULL) # generate output summaryRprof() example: > Rprof() > for (i in 1:1e6) sin(i) + cos(i) + sqrt(i) > Rprof(NULL) > summaryRprof() $by.self self.time self.pct total.time total.pct sin

[R] Visualizing Points on a Sphere

2011-02-25 Thread Lorenzo Isella
Dear All, I need to plot some points on the surface of a sphere, but I am not sure about how to proceed to achieve this in R (or if it is suitable for this at all). In any case, I am not looking for really fancy visualizations; for instance you can consider the images between formulae 5 and 6 a

[R] R 2.12.2 is released

2011-02-25 Thread Peter Dalgaard
I've rolled up R-2.12.2.tar.gz a short while ago. This is an update release, which fixes a number of mostly minor issues, and one major issue in which complex arithmetic was being messed up on some compiler platform. You can get it from http://cran.r-project.org/src/base/R-2/R-2.12.2.tar.gz or

Re: [R] count data

2011-02-25 Thread ONKELINX, Thierry
Dear Sacha, Do you revisit the same locations per site? If so, use (1|site/location) as random effect. Otherwise use just (1|site). You might want to add a crossed random effect (1|date) if you can expect an effect of phenology. Best regards, Thierry PS R-sig-mixed-models is a better list for

[R] limma function problem

2011-02-25 Thread Sukhbir Rattan
Hi, I have two data set of normalized Affymetrix CEL files, wild type vs Control type.(each set have further three replicates). > wild.fish AffyBatch object size of arrays=712x712 features (10 kb) cdf=Zebrafish (15617 affyids) number of samples=3 number of genes=15617 annotation=zebrafish notes=

[R] count data

2011-02-25 Thread Sacha Viquerat
hello dear list! I wonder about the layout of my csv for my study design: i have 11 different sites. each site had been visited 9 times. on each visit, 6 distinctive water parameters had been taken ONCE on each visit (as continuous variables). on each visit, the fish abundance was counted us

Re: [R] group by in data.frame

2011-02-25 Thread Ivan Calandra
Hi, I think ave() might do what you want: df <- data.frame(a=rep(c("this","that"),5), b1=rnorm(10), b2=rnorm(10)) ave(df[,2], df[,1], FUN=mean) For all columns, you could do that: d <- lapply(df[,2:3], FUN=function(x)ave(x,df[,1],FUN=mean)) df2 <- cbind(df, d) HTH, Ivan Le 2/25/2011 12:11, zem

Re: [R] lm - log(variable) - skip log(0)

2011-02-25 Thread Liaw, Andy
You need to use "==" instead of "=" for testing equality. While you're at it, you should check for positive values, not just screening out 0s. This works for me: R> mydata = data.frame(x=0:10, y=runif(11)) R> fm = lm(y ~ log(x), mydata, subset=x>0) Andy > -Original Message- > From:

Re: [R] speed up process

2011-02-25 Thread Ivan Calandra
Dear Jim, I've tried to use Rprof() as you advised me, but I don't understand how it works. I've done this: Rprof(for (i in seq_along(seq.yvar)){ all_my_commands }) summaryRprof() But I got this error: Error in summaryRprof() : no lines found in ‘Rprof.out’ I couldn't really understand from

Re: [R] select element from vector

2011-02-25 Thread zem
Hi Jessica, try this: Q[k:c(k+3)] -- View this message in context: http://r.789695.n4.nabble.com/select-element-from-vector-tp3323725p3324286.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://s

[R] group by in data.frame

2011-02-25 Thread zem
Hi all, i have a little problem, and i think it is really simple to solve, but i dont know exactly how to. here is the "challange": i have a data.frame with n colum, i have to group 2 of them and calculate the mean value of the 3. one. so far so good, that was easy - i used aggregate function to

[R] lm - log(variable) - skip log(0)

2011-02-25 Thread agent dunham
I want to do a lm regression, some of the variables are going to be affected with log, I would like not no take into account the values which imply doing log(0) for just one variable I have done the following but it doesn't work: lmod1.lm <- lm(log(dat$inaltu)~log(dat$indiam),subset=(!(dat$in

Re: [R] color code in loop for piecharts plotting

2011-02-25 Thread Jim Lemon
On 02/25/2011 09:33 PM, Lucia Rueda wrote: Hi, I am using this loop par(mfrow=c(3,3)) annos<-c(2001:2007,2009) for (i in annos) { t<-subset(masia,YEAR==i) t$FAMILIA<-drop.levels(t$FAMILIA) pie(table(t$FAMILIA),main=i) } To make piecharts of species composition among years (my data frame is

Re: [R] speed up process

2011-02-25 Thread Jim Holtman
use Rprof to find where time is being spent. probably in 'plot' which might imply it is not the 'for' loop and therefore beyond your control. Sent from my iPad On Feb 25, 2011, at 6:19, Ivan Calandra wrote: > Thanks Nick for your quick answer. > It does work (no missed bracket!) but unfortuna

Re: [R] speed up process

2011-02-25 Thread Ivan Calandra
Thanks Nick for your quick answer. It does work (no missed bracket!) but unfortunately doesn't really speed up anything: with my real data, it takes 82.78 seconds with the double lapply() instead of 83.59s with the double loop (about 0.8 s). It looks like my double loop was not that bad. Does

[R] time series with NA - acf - tsdiag - Ljung-Box

2011-02-25 Thread Cecilia Reyna
Hi all, I am modelling a time series with missing data. *Q1)* However, I am not sure if I should use the next *graphics* to understand my data: *a)* ACF & PACF (original series) *b)* ACF & PACF (residuals) * * *Q2)* I am using *tsdiag*, so I obtain a graphic with 3 plots: stand. residuals vs time

Re: [R] scatter graph of more than one value

2011-02-25 Thread Ivan Calandra
Hi, Take a look at ?points, ?legend and ?par (specifically col and pch) HTH, Ivan Le 2/25/2011 11:58, amir a écrit : Hi, I have two X1,X2 and Y1,Y2 and I want to draw them ((X1,Y1), (X2,Y2)) in a scatter graph. How can I draw both of them in a same graph with different legends? And is there

[R] color code in loop for piecharts plotting

2011-02-25 Thread Lucia Rueda
Hi, I am using this loop par(mfrow=c(3,3)) annos<-c(2001:2007,2009) for (i in annos) { t<-subset(masia,YEAR==i) t$FAMILIA<-drop.levels(t$FAMILIA) pie(table(t$FAMILIA),main=i) } To make piecharts of species composition among years (my data frame is called "masia"). So I get 1 piechart of

[R] scatter graph of more than one value

2011-02-25 Thread amir
Hi, I have two X1,X2 and Y1,Y2 and I want to draw them ((X1,Y1), (X2,Y2)) in a scatter graph. How can I draw both of them in a same graph with different legends? And is there any way to show different labels on each point? Regards, Amir __ R-help@r-pr

Re: [R] Substituting inside expression

2011-02-25 Thread Gabor Grothendieck
On Fri, Feb 25, 2011 at 4:11 AM, zbynek.jano...@gmail.com wrote: > > I am having following problem: > I´m constructing model for calculation of area of triangle. > I know sides a, b, and gamma angle. > I wish to calculate the area using heron´s formula: > S <- sqrt(s*(s-a)*(s-b)*(s-c)) > where > s

Re: [R] speed up process

2011-02-25 Thread Nick Sabbe
Simply avoiding the for loops by using lapply (I may have missed a bracket here or there cause I did this without opening R)... Haven't checked the speed up, though. lapply(seq.yvar, function(k){ plot(mydata1[[k]]~mydata1[[ind.xvar]], type="p", xlab=names(mydata1)[ind.xvar], ylab=names(mydata1)

Re: [R] Substituting inside expression

2011-02-25 Thread Ivan Calandra
Hi, If I follow you correctly, you could write a function: foo <- function(a,b,gamma){ c <- sqrt(a^2 + b^2 -2*a*b*cos(gamma)) s <- (a+b+c)/2 A <- sqrt(s*(s-a)*(s-b)*(s-c)) return(A) } I hope I didn't make mistakes, but it can still help you, I guess. Ivan Le 2/25/2011 10:11, zbynek.jano..

[R] speed up process

2011-02-25 Thread Ivan Calandra
Dear users, I have a double for loop that does exactly what I want, but is quite slow. It is not so much with this simplified example, but IRL it is slow. Can anyone help me improve it? The data and code for foo_reg() are available at the end of the email; I preferred going directly into the

Re: [R] Selecting data based on the range of dates

2011-02-25 Thread Rob Tirrell
Try my.date <- strptime("20/2/06 11:16:16.683", "%d/%m/%y %H:%M:%OS") Then you can examine my.date$mon. -- Robert Tirrell | r...@stanford.edu | (607) 437-6532 Program in Biomedical Informatics | Butte Lab | Stanford University On Thu, Feb 24, 2011 at 14:12, Belle wrote: > > I think I got it,

[R] Substituting inside expression

2011-02-25 Thread zbynek.jano...@gmail.com
I am having following problem: I´m constructing model for calculation of area of triangle. I know sides a, b, and gamma angle. I wish to calculate the area using heron´s formula: S <- sqrt(s*(s-a)*(s-b)*(s-c)) where s <- (a+b+c)/2 and c is calculated using law of cosines: c <- sqrt(a^2 + b^2 -2*a*

Re: [R] Compatibility with R for Windows 2.12.2

2011-02-25 Thread Rob Tirrell
I can't think of a reason why they would... Rob Tirrell On Thu, Feb 24, 2011 at 23:56, Vedajit Boyd wrote: > Hi, > > Please someone let me know that the installation of both R for Windows > 2.12.2 and MS office 2010 on the same system will interfere each other or > not. > In short, are these t

Re: [R] GLM, how to get an R2 to explain how much of data explained by one variable

2011-02-25 Thread Clare Embling
Hi Celine, GLM outputs usually give the null deviance and residual deviance in the summary() term - so you can work out % deviance explained for a variable/model from this. Hope this helps. Best wishes, Clare Dr Clare B Embling Visiting Research Fellow Marine Inst

Re: [R] Compatibility with R for Windows 2.12.2

2011-02-25 Thread Prof Brian Ripley
On Fri, 25 Feb 2011, Vedajit Boyd wrote: Hi, Please someone let me know that the installation of both R for Windows 2.12.2 and MS office 2010 on the same system will interfere each other or not. In short, are these two tools compatible to each other? There is nothing special about R, but you

Re: [R] Variable names AS variable names?

2011-02-25 Thread Patrick Burns
One of my hypotheses of what you want is: for(code in codes) { get(code) } The other one is: for(code in codes) { as.name(code) } On 25/02/2011 06:55, Noah Silverman wrote: How can I dynamically use a variable as the name for another variable? I realize this sounds cryptic,

[R] Compatibility with R for Windows 2.12.2

2011-02-25 Thread Vedajit Boyd
Hi, Please someone let me know that the installation of both R for Windows 2.12.2 and MS office 2010 on the same system will interfere each other or not. In short, are these two tools compatible to each other? Thanks in advance. Best Regards, Vedajit [[alternative HTML version deleted]]

[R] I have a Quick question about biometics

2011-02-25 Thread William Hammack
Hello, I was searching online to find more info about Biometics and I came across your information. Can you tell me, are you still involved with Biometics? If you are, how are things going for you? Please let me know. Sincerely, Will Hammack __

Re: [R] Selecting data based on the range of dates

2011-02-25 Thread Belle
I think I got it, I post it here see if you have better way, please let me know. index <- rep(0, length(mydata[,1])) index[as.Date(mydata3$Date) < as.Date("2006-11-30 23:29:29 PM") & as.Date(mydata3$Date) > as.Date("2006-09-01 00:00:00 AM")] <- 1 index[as.Date(mydata3$Date) < as.Date("2007-11-30

[R] Selecting data based on the range of dates

2011-02-25 Thread Belle
Hi: I want to give an index with all the dates between Sept. to Nov. as 1, and anything else is 0. It doesn't matter which year it is, as long as it is between Sept. to Nov, then set up to 1, otherwise is 0. My data frame looks like below: ID Date 201 1/1/05 6:07 AM 201 3/27/09 9:4

[R] Multivariate integration

2011-02-25 Thread shree sonal
Hello, I came across a package called cubature ( http://cran.r-project.org/web/packages/cubature/index.html) to perform multivariate integration. I was not able to understand few stuff: What is the need for package flags under src/Makevars? What is the purpose of fWrapper in the rcubature.c file?

Re: [R] Creating objects (data.frames) with names stored in character vector

2011-02-25 Thread David Winsemius
On Feb 24, 2011, at 3:38 PM, Kent Alleman wrote: Hello, I'm fairly new to R. I'm a chemist, not a programmer so please bear with me. I have a large data.frame that I want to break down (subset) into smaller data.frames for analysis. I would like to give the data.frames descriptive na

Re: [R] Variable names AS variable names?

2011-02-25 Thread David Winsemius
On Feb 25, 2011, at 1:55 AM, Noah Silverman wrote: How can I dynamically use a variable as the name for another variable? I realize this sounds cryptic, so an example is best: #Start with an array of "codes" codes <- c("a1", "b24", "q99") Is there some reason not to use list(a1, b24, q99)?

[R] Sweave trim output

2011-02-25 Thread Dimitris Rizopoulos
Dear All, I'd like to trim the output produced in a Sweave code chunk. For instance, in fit <- lm(conc ~ . - Plant, data = CO2) summary(fit) I'd like, skip the info after the coefficients' table, and possibly replace it with '...'. I've created this small function to do this, which is base

<    1   2