Re: [R] Contrasts for 2x4 interaction in mixed effects model

2012-09-08 Thread Stephen Politzer-Ahles
Rich, Thank you very much for your response and the example! I think this solved my problem completely. I am using lmer rather than aov for my model, though (I have crossed random effects for subjects and items), so I'd just like to check and make sure I'm understanding the model output correctly,

Re: [R] Apply a function to columns of a matrix

2012-09-08 Thread arun
Hi, You can also use sapply() sapply(split(t(a),1:ncol(a)),function(x) sum(diff(b)*(x[-1]+x[-length(x)]))/2) #   1    2    3    4    5    6    7    8    9   10   #99  279  459  639  819  999 1179 1359 1539 1719 A.K. - Original Message - From: Andras Farkas To: "r-help@r-project.org"

Re: [R] Apply a function to columns of a matrix

2012-09-08 Thread arun
Hi, Sorry, there was a mistake in my previous code: f1<-function(x) sum(diff(b)*(x[-1]+x[-length(x)]))/2 a1<-split(t(a),1:ncol(a)) mapply(f1,a1) #   1    2    3    4    5    6    7    8    9   10   #99  279  459  639  819  999 1179 1359 1539 1719 A.K. - Original Message - From: Andras

Re: [R] Using predict() After Adding a Factor to a glm.nb() Model

2012-09-08 Thread David L Carlson
Actually the first one did not work. You left out the warning message: > py<-data.frame(seq(from=min(data$year), to=max(data$year), by=1)) > p1<-predict(model_a, newdata=py, se.fit=TRUE, type='response') Warning message: 'newdata' had 20 rows but variable(s) found have 22 rows Since py did not co

Re: [R] Apply a function to columns of a matrix

2012-09-08 Thread jim holtman
Is this what you wanted? You had two arguments to your function, but only supplying one via the 'apply'. Also your argument names were the same as your variables which was confusing. > a <-matrix(c(1:100),ncol=10) > b <-matrix(c(2,4,6,8,10,12,14,16,18,20)) > > apply(a,2,function(y,x) sum(diff(x)

Re: [R] calcular SVD de una matriz que no entra en memoria

2012-09-08 Thread Steve Lianoglou
Hi, 2012/9/8 federico ferreyra : > Hola como andan? estuve leyendo un poco la documentacion de la libreria > BigMemory y no me quedan claro algunas cosas, le planteo mi problema, tengo > un matriz en disco que pesa 2gb con coeficientes float愀, solo numeros, y > tengo que hallar la descomposicio

[R] Apply a function to columns of a matrix

2012-09-08 Thread Andras Farkas
Dear All,   as a follow up to my previous e-mail (I think I am getting closer...):   I am trying to apply the trapezoidal functions to a matric column by column. I have the following code:   a <-matrix(c(1:100),ncol=10) b <-matrix(c(2,4,6,8,10,12,14,16,18,20))   apply(a,2,function(b,a) sum(diff(b)

Re: [R] Help: a matrix exponential

2012-09-08 Thread Daniel Malter
This is a matrix algebra problem, not an R problem. ej fails because betaligne and ZIcolone are not conformable matrices. dim(betaligne) 1 2 dim(ZIcolone) 76 1 Let a matrix be m x n, then you can only matrix multiply it with a matrix that is n x k (where m and k are arbitrary positive integers,

[R] Using predict() After Adding a Factor to a glm.nb() Model

2012-09-08 Thread 077315q
# Hello, # I have a data set that looks something like the following: site<-c(rep('a',5),rep('b',2),rep('c',4),rep('d',11)) year<-c(1980, 1981, 1982, 1993, 1995, 1980, 1983, 1981, 1993, 1995, 1999, c(1980:1990)) count<-c(60,35,36,12,8,112,98,20,13,15,15,65,43,49,51,34,33,33,33,40,11,0) data<

[R] calculate svd of a matrix larger then memory

2012-09-08 Thread federico ferreyra
Hello How are you? I was reading  BigMemory´s  library documentation and I have no clear some things, challenged my problem, I have a disk array with 2GB weighing coefficients float's, just numbers, and I have to find the singular value decomposition this matrix, basically the question is: how t

Re: [R] method or package to make special boxplot

2012-09-08 Thread Greg Snow
The symbols function allows you to place boxplot symbols at specified x,y coordinates. Would that do what you want? On Sat, Sep 8, 2012 at 8:14 AM, Zhang Qintao wrote: > Hi, All, > > I am trying to use R to make the following type of boxplot while I couldn't > find a way to do it. > > My dataset

Re: [R] Producing a table with mean values

2012-09-08 Thread arun
HI John, I got it.  Please disregard my previous email. I guess the code should be: tabx <-  ddply(meltx, .(Seamount, variable),  summarize, mean = mean(value), sd = sd(value)) A.K. - Original Message - From: John Kane To: Tinus Sonnekus ; r-help@r-project.org Cc: Sent: Saturday, Se

Re: [R] How to insert vertical space between lines of tables created with the R package 'tables'?

2012-09-08 Thread Marius Hofert
Duncan Murdoch writes: > > The + means concatenation, so that spec says to put the RowFactor above the > d*beta rows. Not sure why that causes an error, but it's likely because > you've > got the wrong number of items. > > This should work, but it doesn't give you the extra spacing properly.

Re: [R] How to insert vertical space between lines of tables created with the R package 'tables'?

2012-09-08 Thread Duncan Murdoch
On 12-09-08 11:41 AM, Marius Hofert wrote: I have the data frame... df <- cbind(expand.grid(d=as.factor(c(2,5)), n=c(100, 200), beta=as.factor(c(0.2, 0.8)), group=LETTERS[1:2]), value=runif(16)) ... which I would like to display in a table like ... require(tables) tabular(d * beta ~ group * me

Re: [R] Thanks for helping - back to the community?

2012-09-08 Thread R. Michael Weylandt
I think more important to R-core is that you cite R in the paper directly as well as packages used (use citation() to get the relevant info). There's not an official R wiki that I know of, but sciviews has one (http://rwiki.sciviews.org/doku.php?id=start) you might use. Not sure if there are better

Re: [R] Producing a table with mean values

2012-09-08 Thread John Kane
x <- " Seamount PicoNano MicroTotal_Ch Off_Mount1 0.0691 0.24200 0.00100 0.31210 Off_Mount1 0.0938 0.00521 0.02060 0.11961 Off_Mount1 0.1130 0.2 0.06620 0.37920 Off_Mount1 0.0864 0.15900 0.22300 0.46840 Off_Mount1 0.0262 0.04570 0.00261 0.07451 Off_Mount2 0.0314 0.17400 0

Re: [R] How to Rename Column Labels?

2012-09-08 Thread John Kane
You seem to be trying to do something from the file on disk and you want to do it to the table in the R environment. Example of what you probably want mydata <- sample(c("A1", "A2", "A3", "A4", "A5"), 45, replace = TRUE) mytable <- table(mydata) mytable names(mytable) <- c("Mike", "Kate",

Re: [R] method or package to make special boxplot

2012-09-08 Thread David Winsemius
On Sep 8, 2012, at 7:14 AM, Zhang Qintao wrote: > Hi, All, > > I am trying to use R to make the following type of boxplot while I couldn't > find a way to do it. > > My dataset looks like X1 Y1 X2 Y2 SPLIT. The split highlights my > experiment details and both x and y are continuous numeric

Re: [R] method or package to make special boxplot

2012-09-08 Thread John Kane
Please supply some sample data and preferably the code that you have used so far. To supply data the best way is probably to use the dput() function. If your data is 'mydata' simply do : dput(mydata) and paste the results into your email John Kane Kingston ON Canada > -Original Messag

[R] How to insert vertical space between lines of tables created with the R package 'tables'?

2012-09-08 Thread Marius Hofert
I have the data frame... df <- cbind(expand.grid(d=as.factor(c(2,5)), n=c(100, 200), beta=as.factor(c(0.2, 0.8)), group=LETTERS[1:2]), value=runif(16)) ... which I would like to display in a table like ... require(tables) tabular(d * beta ~ group * mean * Heading() * value, data=df) Now I would

[R] Help on calculating AUC with caTools trapz(a,b) command

2012-09-08 Thread Andras Farkas
Dear All,   I have the following example:   a <-matrix(c(1:100),ncol=10) b <-matrix(c(2,4,6,8,10,12,14,16,18,20))   trapz(b,a)   will give me a result of 99, which it seems to me is the AUC of the 1st column only. Is it possible to get the AUC results by columns of "a" using the same "b" values i

[R] method or package to make special boxplot

2012-09-08 Thread Zhang Qintao
Hi, All, I am trying to use R to make the following type of boxplot while I couldn't find a way to do it. My dataset looks like X1 Y1 X2 Y2 SPLIT. The split highlights my experiment details and both x and y are continuous numerical values. I need to plot y vs. x with split as legend and boxp

[R] calcular SVD de una matriz que no entra en memoria

2012-09-08 Thread federico ferreyra
Hola como andan? estuve leyendo un poco la documentacion de la libreria BigMemory y no me quedan claro algunas cosas, le planteo mi problema, tengo un matriz en disco que pesa 2gb con coeficientes float´s, solo numeros, y tengo que hallar la descomposicion en valores singulares de esta matriz, b

[R] Grid package: how to customize cell spacing?

2012-09-08 Thread Giovanni Azua
Hello, I am using the recipe below to place plots side by side: http://wiki.stdout.org/rcookbook/Graphs/Multiple%20graphs%20on%20one%20page%20%28ggplot2%29/ How can I reduce or customize the horizontal spacing between the grid cells? I have researched the Grid package but can't find the way to

Re: [R] metafor package: study level variation

2012-09-08 Thread Michael Dewey
At 15:02 07/09/2012, Jarrett Byrnes wrote: Hello. A quick question about incorporating variation due to study in the metafor package. I'm working with a particular data set for meta-analysis where some studies have multiple measurements. Others do not. So, let's say the effect I'm looking a

Re: [R] Can I make spss.get reencode from Windows-1252?

2012-09-08 Thread peter dalgaard
On Sep 8, 2012, at 05:17 , Dan Delaney wrote: > Hi all. I have an SPSS file that I'm loading into R with the Hmisc spss.get > function. The trouble is that the SPSS file uses the Windows-1252 character > set (which I think is the default for SPSS on Windows) instead of plain-ol' > Latin-1, and

[R] Thanks for helping - back to the community?

2012-09-08 Thread Richard Müller
DeaR R-fellows, I got a lot of help from you concerning the generation of heat maps, so I was able to write and work with a script for this purpose at last. Some visitors of our Ecological Station asked about the generation of the graphs and so I decided to write down a small description. Is it ad

Re: [R] Can I make spss.get reencode from Windows-1252?

2012-09-08 Thread Rui Barradas
Hello, If all you need is the column labels, read.spss does return them as an attribute of the list/data.frame. You can write an extractor function: variable.labels <- function(x) attr(x, "variable.labels") and then dfr <- read.spss(file.choose(), reencode = 'Windows-1252', to.data.frame =

Re: [R] Is something wrong wiht draw.circle()?

2012-09-08 Thread Jim Lemon
On 09/08/2012 02:04 AM, Chris82 wrote: Hey R users, I am a little bit confused. require(plotrix) plot(0,xlim=c(-10,10),ylim=c(-10,10),type="n",xlab="",ylab="") draw.circle(0,0,5) lines(c(0,0),c(0,5)) lines(c(0,5),c(0,0)) This is not really a circle with a radius of 5. Hi Chris82, If you