Re: [R] Sampling problem

2010-11-16 Thread wangwallace
Michael, I really appreciate your help. but I got the following error message when I wan trying to run the function written by you: Error in out[i, ] - apply(help[, c(grp1 + 1, grp2 + 5)], 2, sample, 1) : number of items to replace is not a multiple of replacement length I am not quite sure

[R] simulate survival data using median survival time

2010-11-16 Thread Kere Klein
Dear All, I like to know how to simulate survival data using median (or mean) survival time. Any help will be greatly appreciated. Best wishes, Kere Kerenaftali Klein PhD| Biostatistician | Queensland Clinical Trials Biostatistics Centre The University of Queensland | School of Population

Re: [R] Sampling problem

2010-11-16 Thread Michael Bedward
On 16 November 2010 16:10, wangwallace talentt...@gmail.com wrote: Michael, I really appreciate your help. but I got the following error message when I wan trying to run the function written by you: Error in out[i, ] - apply(help[, c(grp1 + 1, grp2 + 5)], 2, sample, 1) :  number of items

Re: [R] Integrate to 1? (gauss.quad)

2010-11-16 Thread Enrico Schumann
gauss--hermite weights the function f(x) to be integrated by exp(-nodes^2), ie, it uses the 'trick' that exp(nodes^2) * exp(-nodes^2) = 1. so your sum should be exp(qq$nodes^2) * exp(-qq$nodes^2) * f(qq$nodes^2) = exp(qq$nodes^2) * qq$weights * f(qq$nodes). hence sum(exp(qq$nodes^2) *

Re: [R] simulate survival data using median survival time

2010-11-16 Thread Michael Bedward
Hi Kere, Step 1 is choose an appropriate distribution :) Do you have one in mind ? Or are you interested in examining the effects of survival times having the same mean but generated with alternative distributions ? One ready-rolled alternative is the SimSurv method in package prodlim. To find

[R] problem with PDF/postcript, cannot change paper size: ‘mode(width)’ and ‘mod e(height)’ differ between new and previous

2010-11-16 Thread Emmanuel Levy
Hi, The pdf function would not let me change the paper size and gives me the following warning: pdf(figure.pdf, width=6, height=10) Warning message: ‘mode(width)’ and ‘mode(height)’ differ between new and previous == NOT changing ‘width’ ‘height’ If I use the option paper = a4r,

[R] glmer, Error: Downdated X'X is not positive definite,49

2010-11-16 Thread Annika
Dear list, I am new to this list and I am new to the world of R. Additionally I am not very firm in statistics either but have to deal. So here is my problem: I have a dataset (which I attach at the end of the post) with a binomial response variable (alive or not) and three fixed factors

Re: [R] problem with PDF/postcript, cannot change paper size: ‘mode(width)’ and ‘mod e(height)’ differ between new and previous

2010-11-16 Thread Emmanuel Levy
Update - sorry for the stupid question, let's say it's pretty late. For those who may be as tired as I am and get the same warning, the paper size should be given as an integer! On 16 November 2010 04:17, Emmanuel Levy emmanuel.l...@gmail.com wrote: Hi, The pdf function would not let me

[R] Who uses R with multicore, SNOW or CUDA package for resource intense computing?

2010-11-16 Thread erik
Hi, who of you in this forum uses R (http://www.r-project.org/) with the multicore, SNOW or CUDA packages, so for advanced calculations that need more power than a workstation CPU? On which hardware do you compute these scripts? At home/ at work or do you have data center access somewhere? The

[R] odfWeave - Format error discovered in the file in sub-document content.xml at 2, 4047 (row, col)

2010-11-16 Thread Søren Højsgaard
When using odfWeave on an OpenOffice input document, I can not open the output document. I get the message Format error discovered in the file in sub-document content.xml at 2,4047 (row,col) Can anyone help me on this? (Apologies if this has been discussed before; I have not been able to find

Re: [R] odfWeave - Format error discovered in the file in sub-document content.xml at 2, 4047 (row, col)

2010-11-16 Thread Mike Marchywka
From: soren.hojsga...@agrsci.dk To: r-h...@stat.math.ethz.ch Date: Tue, 16 Nov 2010 11:32:06 +0100 Subject: [R] odfWeave - Format error discovered in the file in sub-document content.xml at 2, 4047 (row, col) When using odfWeave on an OpenOffice

[R] LATTICE. On skip, index.cond with a formula like Y~X|A+B

2010-11-16 Thread ottorino
Dear invaluable R-list, my present problem is arranging/removing some panels in a lattice plot. Please consider the following: df.data - cbind.data.frame(expand.grid(SUBJ=1:5, TREAT=LETTERS[1:4], REF=letters[1:4]

[R] Offset in glm poisson using R vs Exposure in Stata

2010-11-16 Thread Columbine Caroline Waring
R-helpers, I am hoping to find someone who uses both R and program Stata for GLMs. I am a beginner R user, finding my own way through; learning code etc. at the same time as learning the statistics I need to complete my project. What I have is the code from Stata and am trying to reproduce

Re: [R] Debugging segfault in foreach

2010-11-16 Thread Duncan Murdoch
On 15/11/2010 10:53 PM, Steve Lianoglou wrote: Hi, I'm using R-2.12 on a linux 64bit machine. When I run a chunk of code inside a foreach() %do% { ...} or %dopar% {...} (with doMC backend) I keep getting a segfault. Running the *same* code within lapply(something, function(x) ... ) doesn't

[R] scatterplot with filled circles

2010-11-16 Thread DrCJones
for a simple scatterplot: plot(X ~ Y, type = 'p', col = 'red') this produces red-edged circles, but I want to fill in the circles. can this be done? I checked '? plot' already but couldn't find what I was looking for. cheers -- View this message in context:

Re: [R] Force evaluation of variable when calling partialPlot

2010-11-16 Thread Tim Howard
Greg, Two thoughts: 1. It might be possible that 'vars' is a reserved word of sorts and if you change the name of your vector RF might be happier 2. A way that works for me is to call importance as follows: sel.imp - importance(sel.rf, class=NULL, scale=TRUE, type=NULL) and then use the

Re: [R] AOV/LME

2010-11-16 Thread Tal Galili
Hi janesense, You might find it useful to go through the tutorial listed here for help: http://www.r-statistics.com/2010/04/repeated-measures-anova-with-r-tutorials/ Cheers, Tal Contact Details:--- Contact me:

Re: [R] Debugging segfault in foreach

2010-11-16 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/16/2010 04:53 AM, Steve Lianoglou wrote: Hi, I'm using R-2.12 on a linux 64bit machine. When I run a chunk of code inside a foreach() %do% { ...} or %dopar% {...} (with doMC backend) I keep getting a segfault. Running the *same* code

Re: [R] scatterplot with filled circles

2010-11-16 Thread B.-Markus Schuller
Hey, the parameter in the plot command you are looking for is pch. For filled circles type: plot(X ~ Y, type = 'p', col = 'red', pch=16) The 16 determines the filled circles. Cheers, Mango - B.-Markus Schuller aka Mango Sensory Ecology Group

Re: [R] scatterplot with filled circles

2010-11-16 Thread Ben Bolker
DrCJones matthias.goddard at gmail.com writes: for a simple scatterplot: plot(X ~ Y, type = 'p', col = 'red') this produces red-edged circles, but I want to fill in the circles. plot(X ~ Y, type = 'p', col = 'red', pch=16) Are you sure you want X~Y and not Y~X?

Re: [R] Offset in glm poisson using R vs Exposure in Stata

2010-11-16 Thread Ben Bolker
Columbine Caroline Waring caquilegia at hotmail.com writes: I am hoping to find someone who uses both R and program Stata for GLMs. [snip] What I have is the code from Stata and am trying to reproduce the same analysis in R - my program of choice. . glm count md ms rf sg,

Re: [R] scatterplot with filled circles

2010-11-16 Thread DrCJones
Fantastic thanks! -- View this message in context: http://r.789695.n4.nabble.com/scatterplot-with-filled-circles-tp3044690p3044772.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] scatterplot with filled circles

2010-11-16 Thread DrCJones
Are you sure you want X~Y and not Y~X? You are right of course - sorry that was just a typo ;) -- View this message in context: http://r.789695.n4.nabble.com/scatterplot-with-filled-circles-tp3044690p3044776.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] odfWeave - Format error discovered in the file in sub-document content.xml at 2, 4047 (row, col)

2010-11-16 Thread Søren Højsgaard
Dear Mike, Good point - thanks. The lines that caused the error mentioned above are simply: = x - 1:10 x @ I could add that the document 'simple.odt' (which comes with odfWeave) causes the same error - but at row=109, col=1577 sessionInfo() R version 2.12.0 (2010-10-15) Platform:

Re: [R] scatterplot with filled circles

2010-11-16 Thread Dennis Murphy
Try adding pch = 16 to your plot call. HTH, Dennis On Tue, Nov 16, 2010 at 4:28 AM, DrCJones matthias.godd...@gmail.comwrote: for a simple scatterplot: plot(X ~ Y, type = 'p', col = 'red') this produces red-edged circles, but I want to fill in the circles. can this be done? I checked

[R] Question about readLines

2010-11-16 Thread romzero
Can i use readLines to extract only the linees with a specific word within? If yes, how? Tnx for help. -- View this message in context: http://r.789695.n4.nabble.com/Question-about-readLines-tp3044701p3044701.html Sent from the R help mailing list archive at Nabble.com.

[R] renaming a list of data frames y calculating with lapply

2010-11-16 Thread David Mendez
Hello everyone I'm a new R user and have some questions about lists indexing, names and the lapply function. first have a look to my data (names changed) it's a rainfall record for 67 stations, str(data) List of 67 $ e.somename.xx.txt :'data.frame': 456 obs. of 5

Re: [R] Question about readLines

2010-11-16 Thread David Winsemius
On Nov 16, 2010, at 7:37 AM, romzero wrote: Can i use readLines to extract only the linees with a specific word within? If yes, how? Just use: lines - readLines( appropriate-arguments ) desired - lines[grep(word, lines] Tnx for help. -- View this message in context:

Re: [R] Question about readLines

2010-11-16 Thread jim holtman
x - readLines('yourFile') x - x[grepl('myWord', x)] On Tue, Nov 16, 2010 at 7:37 AM, romzero romz...@yahoo.it wrote: Can i use readLines to extract only the linees with a specific word within? If yes, how? Tnx for help. -- View this message in context:

[R] Breslow-Day test

2010-11-16 Thread Robert Ruser
Dear R Users, I'm looking for a package that allows to test hypothesis about a homogeneity of odds ratio in k 2x2 tables. I know that Breslow-Day is suitable but does anybody could me point out a package? I found diffR, but as far as I see this package is for IRT theory. Best, Robert

[R] R article in forbes

2010-11-16 Thread Mark Leeds
Here's an article in Forbes about R in case anyone's interested. http://blogs.forbes.com/smcnally/2010/11/10/names-you-need-to-know-in-2011-r-data-analysis-software/ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] Breslow-Day test

2010-11-16 Thread David Winsemius
On Nov 16, 2010, at 10:08 AM, Robert Ruser wrote: Dear R Users, I'm looking for a package that allows to test hypothesis about a homogeneity of odds ratio in k 2x2 tables. I know that Breslow-Day is suitable but does anybody could me point out a package? I found diffR, but as far as I see this

[R] Re : interpretation of coefficients in survreg AND obtaining the hazard function for an individual given a set of predictors

2010-11-16 Thread Vincent Vinh-Hung
Thanks for sharing the questions and responses! Is it possible to appreciate how much the coefficients matter in one or the other model? Say, using Biau's example, using coxph, as.factor(grade2 == high)TRUE gives hazard ratio 1.27 (rounded). As clinician I can grasp this HR as 27% relative

Re: [R] plot.dendrogram() plot margins

2010-11-16 Thread Uwe Ligges
On 15.11.2010 18:35, francois fauteux wrote: Hello, Is it possible to remove those extra margins on the sample axis from plot.dendrogram: par(oma=c(0,0,0,0),mar=c(0,0,0,0)) ddr-as.dendrogram(hclust(dist(matrix(sample(1:1000,200),nrow=100

Re: [R] Breslow-Day test

2010-11-16 Thread Marc Schwartz
On Nov 16, 2010, at 9:18 AM, David Winsemius wrote: On Nov 16, 2010, at 10:08 AM, Robert Ruser wrote: Dear R Users, I'm looking for a package that allows to test hypothesis about a homogeneity of odds ratio in k 2x2 tables. I know that Breslow-Day is suitable but does anybody could me

Re: [R] [klaR package] [NaiveBayes] warning message numerical 0 probability

2010-11-16 Thread Fabon Dzogang
Thank you very much for this clarification, Sincerely, Fabon Dzogang. 2010/11/15 Uwe Ligges lig...@statistik.tu-dortmund.de: On 03.11.2010 16:26, Fabon Dzogang wrote: Hi, I run R 2.10.1 under ubuntu 10.04 LTS (Lucid Lynx) and klaR version 0.6-4. I compute a model over a 2 classes

[R] Simple error handling in R

2010-11-16 Thread Aleksey Naumov
Hi R experts, I am looking for a simple error handling approach, whereby I could stop function execution with a customized error message. For example: for (i in 1:10) { if (i == 5) # I'd like to be able to stop right here with an error message I have complete control over } The problem

Re: [R] Integrating functions / vector arithmetic

2010-11-16 Thread Eduardo de Oliveira Horta
Thanks, I'll try that. Regarding your question Why are you using assignments to indicate the return values of functions?, I'd probably answer that it is a matlab vice... But I'll change my habits soon enough! Best regards, Eduardo Horta On Tue, Nov 16, 2010 at 12:27 PM, Erich Neuwirth

Re: [R] R article in forbes

2010-11-16 Thread Bogaso Christofer
Thanks Mark, for sharing such a great article. Really feeling proud that I am also part of that great community. BTW can anyone share the code on how to draw the picture displayed there (blur surface plot)? Thanks, -Original Message- From: r-help-boun...@r-project.org

[R] Odp: Sampling problem

2010-11-16 Thread Petr PIKAL
Hi Here is one way (If I understood what you did ask). test-read.table(clipboard, header=T) test SubID CSE1 CSE2 CSE3 CSE4 WSE1 WSE2 WSE3 WSE4 1 165626224 2 264726623 3 355555545 4

Re: [R] Simple error handling in R

2010-11-16 Thread David Winsemius
On Nov 16, 2010, at 10:58 AM, Aleksey Naumov wrote: Hi R experts, I am looking for a simple error handling approach, whereby I could stop function execution with a customized error message. For example: for (i in 1:10) { if (i == 5){ #Then insert: cat(Informative error message) ;

Re: [R] randomForest parameters for image classification

2010-11-16 Thread Deschamps, Benjamin
I have modified my code since asking my original question. The classifier is now generated correctly (with a good, low error rate, as expected). However, I am running into two issues: 1) I am getting an error at the prediction stage, I get only NA's when I try to run data down the forest; 2) I

Re: [R] Simple error handling in R

2010-11-16 Thread ottorino
Il giorno mar, 16/11/2010 alle 10.58 -0500, Aleksey Naumov ha scritto: for (i in 1:10) { if (i == 5) # I'd like to be able to stop right here with an error message I have complete control over } I'm far from expert, but perhaps this is near what you are looking for for(i in

Re: [R] R article in forbes/ somewhat OT

2010-11-16 Thread Mike Marchywka
From: bogaso.christo...@gmail.com To: marklee...@gmail.com; r-help@r-project.org Date: Tue, 16 Nov 2010 21:48:10 +0530 Subject: Re: [R] R article in forbes Thanks Mark, for sharing such a great article. Really feeling proud that I am also part

Re: [R] rotate column names in large matrix

2010-11-16 Thread Lara Poplarski
Thank you both, these are very helpful hints. Chris, could you please suggest how to modify what you sent to also show the same labels as (horizontal) row names? I have not yet mastered the details of R graphics... Many thanks in advance, Lara On Mon, Nov 15, 2010 at 3:25 PM, Chris Stubben

[R] Simple error handling in R

2010-11-16 Thread Aleksey Naumov
David, Thank you for your help. I agree, stop right here is ambiguous, let me clarify. I am at a terminal session, calling my top-level function f(). At any point inside f() I'd like to be able to generate an error message, print it to the terminal and stop execution of f() (but still remain in

[R] help using function merge_all()

2010-11-16 Thread arjun
Hi, I want to merge 4 data frames with one column in common but I am getting error message while using this function. Can any one help me out. merge_all(Br,Ki,Lu,Pr,by=Genes) Error: could not find function merge_all I have installed the package: reshape but I still get this error --

[R] Pass character vector to function argument

2010-11-16 Thread Kevin Ummel
A bit embarrassed to post this seemingly trivial question, but I can't find anything in the archive that's quite relevant: a1=1 a2=2 obs=objects(pattern=glob2rx(a?)) I want to utilize 'obs' as a function argument to produce something like: sum(a1,a2) Obviously, sum(obs) doesn't work, but

Re: [R] Sampling problem

2010-11-16 Thread wangwallace
yes, the data.frame is exactly the same as the one I posted earlier. I was trying to see if the loop function works. And I got that message. here below is the syntax I was trying to run, followed by the error message at the end: sampleX-function(X,nGrp1,nsamples){if(nGrp1=4)stop(can't sample

[R] how to do linear regression when dimension is high

2010-11-16 Thread poko2000
Hi I am a newbie in R. I have data with dim of 20. How to use lm if i want to do regression with the whole design matrix? My y is the first column. the left are xs. Thanks a lot. -- View this message in context:

Re: [R] Simple error handling in R

2010-11-16 Thread Aleksey Naumov
Ottorino, Thank you for your suggestion. I am not really looking to do any debugging, but merely to issue an informative error message and stop execution of my top-level function, called at an R terminal. See me response to David for more details... Thank you, Aleksey On Tue, Nov 16, 2010 at

Re: [R] Pass character vector to function argument

2010-11-16 Thread David Winsemius
On Nov 16, 2010, at 10:34 AM, Kevin Ummel wrote: A bit embarrassed to post this seemingly trivial question, but I can't find anything in the archive that's quite relevant: a1=1 a2=2 obs=objects(pattern=glob2rx(a?)) I want to utilize 'obs' as a function argument to produce something

[R] plot vs print ??

2010-11-16 Thread skan
Hello What's the differente betwen using plot and using print in order to plot a graph? For example in order to plot the result of a histogram. cheers -- View this message in context: http://r.789695.n4.nabble.com/plot-vs-print-tp3045256p3045256.html Sent from the R help mailing list archive

Re: [R] R article in forbes

2010-11-16 Thread John Fox
Dear David and Bogasso, The image is from http://socserv.mcmaster.ca/jfox/Courses/R-course/index.html, as you'd see by clicking on the graph in the Forbes article, and it was indeed produced with scatter3d() in the car package. Best, John John Fox Senator

Re: [R] Pass character vector to function argument

2010-11-16 Thread Ivan Calandra
Hi, It would have been nice to see what you've tried. Here is what I got (maybe not the easiest, but looks like it works) a1 - 1 a2 - 2 obs - objects(pattern=glob2rx(a?)) sum(unlist(mget(obs, envir=.GlobalEnv))) [1] 3 It also works with vectors: a1 - 1:10 a2 - 11:20 sum(unlist(mget(obs,

[R] Revolutions Blog: October Roundup

2010-11-16 Thread David Smith
I write about R every weekday at the Revolutions blog: http://blog.revolutionanalytics.com and every month I post a summary of articles from the previous month of particular interest to readers of r-help. In case you missed them, here are some articles related to R from the month of October:

Re: [R] how to do linear regression when dimension is high

2010-11-16 Thread Douglas Bates
On Tue, Nov 16, 2010 at 10:30 AM, poko2000 quan.poko2...@gmail.com wrote: Hi I am a newbie in R. I have data with dim of 20. How to use lm if i want to do regression with the whole design matrix? My y is the first column. the left are xs. Thanks a lot. Do you have the data stored in a

Re: [R] Force evaluation of variable when calling partialPlot

2010-11-16 Thread Greg Dillon
Tim, Thanks for the suggestions. I tried them both, and while neither solved my problem directly, they helped me to get to a solution. What I've realized is that partialPlots, for some reason, always looks to the Global environment when evaluating the x.var argument. So any variables created

Re: [R] plot vs print ??

2010-11-16 Thread Joshua Wiley
Hi, It really depends, but almost always to plot a graph you would use plot() (or some similar graphing function). print() is usually more for displaying data in the console, not graphically. There are some cases (e.g., inside a for loop), where you need to wrap the call to plot (or similar

Re: [R] R article in forbes/ somewhat OT

2010-11-16 Thread Gabor Grothendieck
On Tue, Nov 16, 2010 at 11:20 AM, Mike Marchywka marchy...@hotmail.com wrote: In many cases, the problem is not the R code but actually getting the data you need to make real-life decisions or form opinions. I sent a link to one of my rants to the OP on this topic but it is a bit political so

Re: [R] plot vs print ??

2010-11-16 Thread Douglas Bates
On Tue, Nov 16, 2010 at 11:09 AM, skan juanp...@gmail.com wrote: What's the differente betwen using plot and using print  in order to plot a graph? For example in order to plot the result of a histogram. Could you give an example? It seems that you are referring to graphics functions in

Re: [R] How to Read a Large CSV into a Database with R

2010-11-16 Thread Seth Falcon
Hi Abhijit, [I've cc'd R-help to keep the discussion on the list] On Tue, Nov 16, 2010 at 8:06 AM, Abhijit Dasgupta adasgu...@araastat.com wrote: Seth, I was looking for something like this too. I've a question. If you're reading the data from a connection, does R start reading the next

Re: [R] plot vs print ??

2010-11-16 Thread David Winsemius
http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-graphics-not-work_003f On Nov 16, 2010, at 12:09 PM, skan wrote: Hello What's the differente betwen using plot and using print in order to plot a graph? For example in order to plot the result of a histogram.

Re: [R] Non-positive definite cross-covariance matrices

2010-11-16 Thread Jeff Bassett
Giovanni, Both matrices describing the points (A and B in my example) are the same size, so the resulting matrix will always be square. Also, the equation I'm using is essentially the following identity: Var(A + B) = Var(A) + Var(B) + Cov(A, B) + Cov(B, A) All the covariance matrices that

Re: [R] glmer, Error: Downdated X'X is not positive definite,49

2010-11-16 Thread Douglas Bates
It is often more effective to send questions about lmer or glmer to the r-sig-mixed-mod...@r-project.org mailing list, which I am cc:ing on this response. On Tue, Nov 16, 2010 at 3:25 AM, Annika annika.opperb...@jyu.fi wrote: Dear list, I am new to this list and I am new to the world of R.

Re: [R] Simple error handling in R

2010-11-16 Thread Gabor Grothendieck
On Tue, Nov 16, 2010 at 10:58 AM, Aleksey Naumov anau...@gmail.com wrote: Hi R experts, I am looking for a simple error handling approach, whereby I could stop function execution with a customized error message. For example: for (i in 1:10) {   if (i == 5)      # I'd like to be able to

Re: [R] rotate column names in large matrix

2010-11-16 Thread Chris Stubben
Just increase the margins on the left side and add the rownames x - cor(matrix(rnorm(600), 60, 100)) rownames(x)-paste(row, 1:100) op-par(mar=c(1,5,1,1), xpd=TRUE) image(t(x[nrow(x):1,]), axes=FALSE) text(-0.01, seq(0,1,length=nrow(x) ), rownames(x), pos = 2, offset = 0, cex = .7) Another

Re: [R] help using function merge_all()

2010-11-16 Thread Joshua Wiley
Hi, Did you also load the package (you'll need to load it every session you want to use it)? ## load reshape package library(reshape) ## now try merge_all(Br, Ki, Lu, Pr, by=Genes) If this does not resolve your problem, please run: sessionInfo() at your console and report the output (it will

[R] Please help me on a simple avg question

2010-11-16 Thread facehappywy
Thanks every one first. I have a dataset like this YearMonth Day HourDIR SPD (m/s) SKYCOVERTEMP (C)RH(%) 20091 1 0 310 13.858243 -5 23 20091 1 1 330 14.305283

Re: [R] Non-positive definite cross-covariance matrices

2010-11-16 Thread Peter Langfelder
On Tue, Nov 16, 2010 at 9:40 AM, Jeff Bassett jbass...@cs.gmu.edu wrote: Giovanni, Both matrices describing the points (A and B in my example) are the same size, so the resulting matrix will always be square.  Also, the equation I'm using is essentially the following identity: Var(A + B) =

Re: [R] Please help me on a simple avg question

2010-11-16 Thread Henrique Dallazuanna
Try this: aggregate(TEMP ~ Year + Month + Day, DF, mean) On Tue, Nov 16, 2010 at 4:48 PM, facehappywy yiw...@gmail.com wrote: Thanks every one first. I have a dataset like this YearMonth Day HourDIR SPD (m/s) SKYCOVER TEMP (C)RH(%) 20091 1

[R] Error: invalid type(list) for variable when using lm()

2010-11-16 Thread Tianchan Niu
Dear All,I would like to do multiple regression in R. I used: lm(y~X), where y is a n by 1 vector, and X is a n by m matrix. I kept getting the error message:Error in model.frame.default(formula = y ~ X,  :  invalid type (list) for variable 'X'. However, when I used:

Re: [R] Pass character vector to function argument

2010-11-16 Thread David Winsemius
On Nov 16, 2010, at 1:04 PM, Kevin Ummel wrote: Sorry, I shouldn't have used 'sum' as an example; I am looking for a solution in the case of functions that do not result in simple vectors or matrices. The real-world example is something like the following using the 'raster' package,

[R] DBLEPR?

2010-11-16 Thread Prof. John C Nash
Ravi Varadhan and I have been looking at UCMINF to try to identify why it gives occasional (but not reproducible) errors, seemingly on Windows only. There is some suspicion that its use of DBLEPR for finessing the Fortran WRITE() statements may be to blame. While I can find DBLEPR in Venables

Re: [R] Error: invalid type(list) for variable when using lm()

2010-11-16 Thread Henrique Dallazuanna
Try this: y - rnorm(100) X - matrix(runif(100 * 10), ncol = 10) lm(y ~ ., data = cbind.data.frame(y, X)) On Tue, Nov 16, 2010 at 5:07 PM, Tianchan Niu n...@isis.georgetown.eduwrote: Dear All,I would like to do multiple regression in R. I used: lm(y~X), where y is a n by 1 vector, and X is a

Re: [R] Error: invalid type(list) for variable when using lm()

2010-11-16 Thread Phil Spector
Tianchan - Your X is not a matrix -- it's a dataframe. Probably the simplest solution is to use lm(y~as.matrix(X)) but you should also learn the difference between a data frame and a matrix. - Phil Spector

[R] Extending a plot in a loop (With attachment)

2010-11-16 Thread Nasrin Pak
My problem is that I have a data set for every day of measurement in a seperate file and I want to plot one parameter of the data for all the days in one graph. I tried to use for loop but only the last data remains in the program memory, I don`t know how to plot each day`s data continusly after

Re: [R] Pass character vector to function argument

2010-11-16 Thread Kevin Ummel
Sorry, I shouldn't have used 'sum' as an example; I am looking for a solution in the case of functions that do not result in simple vectors or matrices. The real-world example is something like the following using the 'raster' package, though (I think) any command producing an S4 object could

[R] Anyone can help with this question

2010-11-16 Thread Mariana
Hi there: I am a total beginner in R, and I have a simple question: I have a table with thousands of lines that represent locations, and two columns: latitude and longitude. I need to randomly sample 1000 lines. How do I do it? I know the command sample, but it samples elements independently, not

[R] discriminant function analysis

2010-11-16 Thread Mike Gibson
My objective is to look at differences in two species of fish from morphometric measurements. My morphometric measurements are head length, eye diameter, snout length, and measurements from tail to each fin. I want to use discrimanant function analyis to determine if there are differences

Re: [R] Odp: Sampling problem

2010-11-16 Thread wangwallace
Fabulicious! It worked!!! One more question, in the following data frame as posted above: SubIDCSE1 CSE2 CSE3 CSE4 WSE1 WSE2 WSE3 WSE4 1 6 5 6 2 6 22 4 2 6 4 7 2 6 6

[R] Playwith-problem with loading

2010-11-16 Thread Fencl, Martin
Helllo, I am having trouble with running the library Playwith in the R-2.12.0. running under 32bit Windows XP. After calling the library the error message The procedure entry point gdk_cairo_reset_clip could not be located in the dynamic library libgdk-win32-2.0-0.dll. occurs and the R asks for

Re: [R] Anyone can help with this question

2010-11-16 Thread David Winsemius
On Nov 16, 2010, at 12:13 PM, Mariana wrote: Hi there: I am a total beginner in R, Time to read the Posting Guide. (Especially since Nabble appears to deficient in providing an introductory document, at least judging from the email behavior of some of its users.) and I have a simple

Re: [R] Pass character vector to function argument

2010-11-16 Thread Kevin Ummel
Thanks, David. That does, indeed, work. It didn't occur to me that a list would do the job as an argument. Thanks for the fix! kevin On Nov 16, 2010, at 6:58 PM, David Winsemius wrote: On Nov 16, 2010, at 1:04 PM, Kevin Ummel wrote: Sorry, I shouldn't have used 'sum' as an example; I

[R] format secondary axis for dates

2010-11-16 Thread Jannis
Dear List, this may be a Newbi question and may have been asked several times, but i am too stupid to find the posts. I have a plot of values against POSIXct time steps. If I want to add a second x axis to the top margin of the plot, only numbers are at the tickmarks. Is there a

Re: [R] Pass character vector to function argument

2010-11-16 Thread Henrique Dallazuanna
Using David's examples: do.call(stack, lapply(obs, get)) On Tue, Nov 16, 2010 at 4:04 PM, Kevin Ummel kevinum...@gmail.com wrote: Sorry, I shouldn't have used 'sum' as an example; I am looking for a solution in the case of functions that do not result in simple vectors or matrices. The

Re: [R] Pass character vector to function argument

2010-11-16 Thread Kevin Ummel
On second glance, while it works for 'stack', it doesn't appear to work for 'overlay': overlay(sapply(obs,get)) Error in function (classes, fdef, mtable) : unable to find an inherited method for function overlay, for signature list, missing At this point, this may be more of a 'raster'

[R] Computing Rolling Average

2010-11-16 Thread Paolo Rossi
Hi, Can anyone suggest a clever way to compute a rolling weekly average of the columns in a matrix? The column bit is straightforward – use apply given a function which does what you want on a column. With regard to a particular column, the obvious way is to run a for loop indexing the last 7

Re: [R] Anyone can help with this question

2010-11-16 Thread Henrique Dallazuanna
Try this: DF[sample(seq(nrow(DF)), 1000),] Where DF is your data On Tue, Nov 16, 2010 at 3:13 PM, Mariana mvale@gmail.com wrote: Hi there: I am a total beginner in R, and I have a simple question: I have a table with thousands of lines that represent locations, and two columns:

Re: [R] help using function merge_all()

2010-11-16 Thread arjun
Hi Josh, Thanks for your reply. While I am loading the package, it says package plyr is required and I tried to install plyr package but I am unable to do so because it is giving an error message as shown below. Please help me. library(reshape) Loading required

Re: [R] Anyone can help with this question

2010-11-16 Thread Jonathan P Daily
assuming your data takes the form of locationlatitudelongitude string num num string2 num num try: sub - dat[sample.int(length(dat$location), 1000),] -- Jonathan P. Daily Technician - USGS Leetown Science Center 11649 Leetown Road

Re: [R] Extending a plot in a loop (With attachment)

2010-11-16 Thread Peter Alspach
Tena koe Nasrin Try points() instead of plot() in your second and subsequent calls to plot(). points() and lines() adds to the current plot by default. Of course you may have difficulties with setting the x and y limits by that's another matter. HTH Peter Alspach -Original

Re: [R] help using function merge_all()

2010-11-16 Thread arjun
Hi Josh, I thought of giving up and started writing code in excel using VBA but then I saw ur message and gave a try in R. I got it, the location from which I am calling the package plyr is not working out so called from different CRANmirror location and then I was able load the

[R] Sweave: \Sexpr and variables with special chars

2010-11-16 Thread Ralf B
I am using \Sexpr to include a variable in a title of a Sweave document: \documentclass[a4paper]{article} echo=false, results=hide= #mytitlevar - Stuff # case 1, everything is find mytitlevar - Stuff_first # case 2, f is turned into sub-text @ \title{MyTitle: \\ \Sexpr{mytitlevar} }

[R] Help fitting spatial glmm with correlated random effects

2010-11-16 Thread Elijah DePalma
Greetings, May you please suggest a package or function to use for fitting a GLMM (generalized linear mixed model) with spatially correlated random effects? Thank you, Elijah DePalma [[alternative HTML version deleted]] __

Re: [R] Re : interpretation of coefficients in survreg AND obtaining the hazard function for an individual given a set of predictors

2010-11-16 Thread Thomas Lumley
A coefficient of -0.4 means that survival times are multiplied by exp(-0.4), that is, people survival only 67% as long. -thomas On Wed, Nov 17, 2010 at 4:32 AM, Vincent Vinh-Hung anhx...@gmail.com wrote: Thanks for sharing the questions and responses! Is it possible to appreciate how

Re: [R] Computing Rolling Average

2010-11-16 Thread Ray Brownrigg
On Wed, 17 Nov 2010, Paolo Rossi wrote: Hi, Can anyone suggest a clever way to compute a rolling weekly average of the columns in a matrix? The column bit is straightforward – use apply given a function which does what you want on a column. With regard to a particular column, the obvious

Re: [R] Offset in glm poisson using R vs Exposure in Stata

2010-11-16 Thread Columbine Caroline Waring
Ben, Thank you, it WAS a typo of sorts. Officially I tried: glm(count~md+ms+rf+sg+offset(log(Eff)),family=poisson,data=DepthHabGen) glm(count~md+ms+rf+sg, offset=(log(Eff)),family=poisson,data=DepthHabGen) (which of course are the same as eachother) glm(count~md+ms+rf+sg,

Re: [R] format secondary axis for dates

2010-11-16 Thread David Winsemius
On Nov 16, 2010, at 2:32 PM, Jannis wrote: Dear List, this may be a Newbi question and may have been asked several times, but i am too stupid to find the posts. I have a plot of values against POSIXct time steps. If I want to add a second x axis to the top margin of the plot, only

Re: [R] Computing Rolling Average

2010-11-16 Thread David Winsemius
On Nov 16, 2010, at 2:33 PM, Paolo Rossi wrote: Hi, Can anyone suggest a clever way to compute a rolling weekly average of the columns in a matrix? The column bit is straightforward – use apply given a function which does what you want on a column. With regard to a particular column,

  1   2   >