Re: [R] Derivative

2010-08-11 Thread TGS
This following works for me but I still favor the quick and dirty method suggested originally by David. options(scipen = 10) x <- seq(0,2, by = .01) f <- expression(5*cos(2*x)-2*x*sin(2*x)) D(f, 'x') f.prime <- function(x){ -(5 * (sin(2 * x) * 2) + (2 * sin(2 * x) + 2 * x * (cos(2 * x) *

Re: [R] drawing dot plots with size, shape affecting dot characteristics

2010-08-11 Thread Michael Bedward
Try running this and see if it does what you want. It just uses plain old plot with the cex arg for size and the col arg for colour... greyDots <- function() { # make up some data x <- runif(50, 0, 10) y <- runif(50, 0, 10) valueMax <- 100 value <- sample(valueMax, 50) # edit these to

Re: [R] using functions with multiple arguments in the "apply" family

2010-08-11 Thread casalott
I can actually answer this!! I was trying to figure out how to use sapply for a function I wrote with multiple arguments. Suppose the function is called FUN(a,b), where "a" is a number and "b" is a number You can use mapply(FUN, a = VECTOR, b = VECTOR) where each vector is your input arguments.

[R] drawing dot plots with size, shape affecting dot characteristics

2010-08-11 Thread Brian Tsai
Hi all, I'm interested in doing a dot plot where *both* the size and color (more specifically, shade of grey) change with the associated value. I've found examples online for ggplot2 where you can scale the size of the dot with a value: http://had.co.nz/ggplot2/graphics/6a053f23cf5bdfe5155ab53d3

Re: [R] Derivative

2010-08-11 Thread David Winsemius
On Aug 12, 2010, at 12:49 AM, Dennis Murphy wrote: Hi: Try the following: f <- function(x) 5*cos(2*x)-2*x*sin(2*x) curve(f, -5, 5) abline(0, 0, lty = 'dotted') This shows rather clearly that your function has multiple roots, which isn't surprising given that it's a linear combination of si

Re: [R] help to polish plot in ggplot2

2010-08-11 Thread baptiste auguie
Hi, One way you could do it is to create a separate graph for each category. The y axis labels would replace the strip labels. You could then stack the graphs on the page, and add a common legend. The tricky part would be to make sure the different panels have the same width and height. Another o

Re: [R] Derivative

2010-08-11 Thread Dennis Murphy
Hi: Try the following: f <- function(x) 5*cos(2*x)-2*x*sin(2*x) curve(f, -5, 5) abline(0, 0, lty = 'dotted') This shows rather clearly that your function has multiple roots, which isn't surprising given that it's a linear combination of sines and cosines. To find a specific root numerically, use

Re: [R] assignment functions with inherited class error

2010-08-11 Thread Martin Morgan
On 08/11/2010 04:42 AM, egc wrote: > # Two test for a class like this: > setClass("XXX", > representation=representation( > "matrix" > ) > ) > > i<-new("XXX"); > m=matrix(); > colnames(m)<-c("colA"); > i...@.data=m; > # >i > # An object of class “XXX” > # colA > #[1,] NA > #_

Re: [R] How to calculate the concentration

2010-08-11 Thread Dennis Murphy
Hi: Try this from package plyr: library(plyr) # function to compute sum of squares f <- function(df) with(df, sum((tapply(value, type, sum)/sum(value))^2)) # apply it to each type of food: ddply(data, .(food), conc = f(data)) food type value market_con 1 drink water 5 0.5987654 2 drin

Re: [R] Append to csv without header

2010-08-11 Thread harsh yadav
Hi, Thanks a lot. It worked with:- write.table(data, file = outputModelFilePath, append=T, sep=",", col.names=F) Regards, Harsh Yadav On Wed, Aug 11, 2010 at 11:53 PM, David Winsemius wrote: > > On Aug 11, 2010, at 10:29 PM, harsh yadav wrote: > > Hi, >> >> I am writing a function that writes

Re: [R] Append to csv without header

2010-08-11 Thread David Winsemius
On Aug 11, 2010, at 10:29 PM, harsh yadav wrote: Hi, I am writing a function that writes to a csv file for every call. However, for the subsequent calls, I want to append the data to the existing csv file without appending the column names again. I tried searching in the previous posts, b

Re: [R] Append to csv without header

2010-08-11 Thread Wu Gong
Hi, It seems that write.csv doesn't support append now. Use write.table() write.table(dataF, file = outputFilePath, append=T,col.names =F) Regards, Wu - A R learner. -- View this message in context: http://r.789695.n4.nabble.com/Append-to-csv-without-header-tp2322115p2322172.html Sent

Re: [R] Need help to understand integrate function

2010-08-11 Thread Ravi Varadhan
Try this: options(digits=10) > integrate(f=powerLaw2, lower=0, upper=Inf, l1=1.8980185, l2=-0.0804259, c0=1, > t0=259.78, rel.tol=1.e-10) 0.01089019946 with absolute error < 3.7e-11 Ravi. Ravi Varadhan, Ph.D. Assistant Profe

Re: [R] How to building my own datafile

2010-08-11 Thread Michael Bedward
Hello Stephen, Please reply to the list, not to me directly so you can get feedback from others as well. > Whether you suggested; > > RSQLite 0.9-2 on CRAN > http://cran.r-project.org/web/packages/RSQLite/NEWS > > SQLite FTS3 Extension > http://www.sqlite.org/fts3.html > > Package ‘RSQLite’ > Jul

[R] normality tests

2010-08-11 Thread Geoffrey Smith
Hello, does anyone know how to compute the following two normality tests using R: (1) the Kiefer-Salmon (1983) statistic, Economics Letters 11, p. 123-127 (2) the modified Shapiro-Wilk statistic? Thank you very much. Geoff [[alternative HTML version deleted]] __

Re: [R] Creating vectors

2010-08-11 Thread Michael Bedward
Here's another way... x <- c(2,2,4,6,2,4,4,6,8,6) match(x, unique(x)) Produces... [1] 1 1 2 3 1 2 2 3 4 3 On 12 August 2010 01:48, clips10 wrote: > > I didn't really know what to post as the topic subject, but I have a vector, > for instance (2,2,4,6,2,4,4,6,8,6) and I want to create another v

Re: [R] How to building my own datafile

2010-08-11 Thread Michael Bedward
Hi Stephen, If you are working with just a single file (database table) or a small number I'd suggest you look at the RSQLite package. It will probably do everything you want and there is good tutorial info available (google is your friend). Michael On 12 August 2010 12:13, Stephen Liu wrote: >

[R] Append to csv without header

2010-08-11 Thread harsh yadav
Hi, I am writing a function that writes to a csv file for every call. However, for the subsequent calls, I want to append the data to the existing csv file without appending the column names again. I tried searching in the previous posts, but I am stuck with different errors. Here is what I am

Re: [R] Derivative

2010-08-11 Thread David Winsemius
On Aug 11, 2010, at 9:21 PM, TGS wrote: How would I numerically find the x value where the derivative of the function below is zero? x <- seq(1,2, by = .01) y <- 5*cos(2*x)-2*x*sin(2*x) plot(x,abs(y), type = "l", ylab = "|y|") Two ideas: ---minimize abs(diff(y)) abline(v=x[which.min(abs(

[R] How to building my own datafile

2010-08-11 Thread Stephen Liu
Hi folks, I'm prepared building my own datafiles, simple file at start, for testing wondering how to process? Which software will be used, MySQL/MS-SQL/MS-Excel/Open Office-Calc etc? On searching I found r-cran-rmysql on Ubuntu repo. Further searching I found; RMySQL: R interface to the My

[R] Need help to understand integrate function

2010-08-11 Thread R_help Help
Hi, I'm running into a wall when trying to use the integrate function. I have the following setting: powerLaw2 <- function(x,l1,l2,c0,t0) { idx <- which(x <= 0); if (length(idx) > 0) { x[idx] <- 0; } xl <- (-l1+l2)*log(x/t0); L <- log(c0)-l1*log(x)-log(1+exp(xl)); L <- e

[R] Derivative

2010-08-11 Thread TGS
How would I numerically find the x value where the derivative of the function below is zero? x <- seq(1,2, by = .01) y <- 5*cos(2*x)-2*x*sin(2*x) plot(x,abs(y), type = "l", ylab = "|y|") __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman

Re: [R] question on contour function

2010-08-11 Thread David Winsemius
On Aug 11, 2010, at 11:16 AM, ba ba wrote: Dear All, I tried to plot contour lines using R function contour, but got the results which are not expected. require(RTOMO) x <- seq(-1,1,0.1) y <- seq(-1,1,0.1) xy <- meshgrid(x,y) z <- xy$x^2+ 3*xy$y^2 contour(x,y,z,col="blue",xlab="x",ylab="y

Re: [R] Creating vectors

2010-08-11 Thread Ben Bolker
clips10 lancaster.ac.uk> writes: > I didn't really know what to post as the topic subject, but I have a vector, > for instance (2,2,4,6,2,4,4,6,8,6) [... snip to make gmane happy ...], > so my new vector would be (1,1,2,3,1,2,2,3,4,3). x <- c(2,2,4,6,2,4,4,6,8,6) as.numeric(factor(x)) [1] 1 1

Re: [R] question on contour function

2010-08-11 Thread Duncan Murdoch
On 11/08/2010 11:16 AM, ba ba wrote: Dear All, I tried to plot contour lines using R function contour, but got the results which are not expected. require(RTOMO) x <- seq(-1,1,0.1) y <- seq(-1,1,0.1) xy <- meshgrid(x,y) z <- xy$x^2+ 3*xy$y^2 contour(x,y,z,col="blue",xlab="x",ylab="y") The abo

Re: [R] Bigmemory: Error Running Example

2010-08-11 Thread harsh yadav
Hi, Yes, I am using the 32-bit version of R (version 2.10.0 RC). The OS used is Windows-7 32 bit. And I preprocessed the airline csv file using the utilities provided on bigmemory.org. The R-environment is empty, with no other objects in memory. When I test the code provided by you, I am able t

Re: [R] Hi!

2010-08-11 Thread Ben Bolker
leepama hanmail.net> writes: > I found some amazing package called "lqa" [enthusiasm snipped] > Can I use this package in linaer model(not GLM)? It's helpful to use informative subject lines in your posts to the list. A linear model is a special case of a generalized linear model with fami

Re: [R] storing the results of an apply call

2010-08-11 Thread Joshua Wiley
On Wed, Aug 11, 2010 at 4:51 PM, Lorenzo Cattarino wrote: > Hi R-users, > > > > I have a function (myfun) that I want to apply to the rows of a matrix. > Basically, "myfun" takes the values from the matrix ("exp.des"), which > represent the different combinations of my experimental design, and pas

Re: [R] storing the results of an apply call

2010-08-11 Thread David Winsemius
On Aug 11, 2010, at 7:51 PM, Lorenzo Cattarino wrote: Hi R-users, I have a function (myfun) that I want to apply to the rows of a matrix. Basically, "myfun" takes the values from the matrix ("exp.des"), which represent the different combinations of my experimental design, and pass them as

Re: [R] problem with Bitmap

2010-08-11 Thread David Winsemius
On Aug 11, 2010, at 1:16 PM, kayj wrote: Hi, if I use the jpeg driver directly like one <- read.table("sample.txt",sep="\t") jpeg(file="sample.JPG) plot(V2 ~ V1,one) and it did not plot anything! why is that? Because you did not "finish the job". Try adding: dev.off() the version of

Re: [R] Graphic Dispersion - Colored Points

2010-08-11 Thread Jorge Ivan Velez
Hi Marcio, Try this: x <- rnorm(5) y <- rnorm(5) ind <- c(1,0,0,1,0) plot(x, y, col = ind + 1, pch = 16) # 1 is black, 2 is red Take a look at the col argument under ?par. Also, ?plot might be of interest in this case. HTH, Jorge On Wed, Aug 11, 2010 at 7:41 PM, Mestat <> wrote: > > Hey fol

[R] storing the results of an apply call

2010-08-11 Thread Lorenzo Cattarino
Hi R-users, I have a function (myfun) that I want to apply to the rows of a matrix. Basically, "myfun" takes the values from the matrix ("exp.des"), which represent the different combinations of my experimental design, and pass them as arguments to some other functions (fun1 and fun2). As I wan

[R] Graphic Dispersion - Colored Points

2010-08-11 Thread Mestat
Hey folks, I have a graphic of dispersion... I would like to color some specific points (x,y) according to another indicator variable, for example: x<-rnorm(5) y<-rnorm(5) ind<-(1,0,0,1,0) plot(x,y) Any suggestion, thanks... Marcio -- View this message in context: http://r.789695.n4.nabble.c

[R] Hi!

2010-08-11 Thread leepama
I found some amazing package called "lqa" one question!!! Can I use this package in linaer model(not GLM)? -- View this message in context: http://r.789695.n4.nabble.com/Hi-tp2321809p2321809.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] How to calculate the concentration

2010-08-11 Thread Wu Gong
Hi, The code seems complicate, but it's understandable. ## food=c('fruit','fruit','fruit','drink','drink','drink') type=c('apple','apple','orange','water','soda','soda') value=c(2,3,1,5,7,6) data=data.frame(food,type,value) share=c((2+3)/(2+3+1),5/6,1/6,5/(5+7+6),13/18,13/18) market_con=c(re

Re: [R] problem with Bitmap

2010-08-11 Thread kayj
Hi, if I use the jpeg driver directly like one <- read.table("sample.txt",sep="\t") jpeg(file="sample.JPG) plot(V2 ~ V1,one) and it did not plot anything! why is that? the version of ghostscript that I installed i from the following link http://pages.cs.wisc.edu/~ghost/doc/GPL/gpl871.htm

Re: [R] a question regarding updating formulas with coefficients

2010-08-11 Thread Charles C. Berry
On Wed, 11 Aug 2010, David Winsemius wrote: On Aug 11, 2010, at 6:45 PM, Charles C. Berry wrote: On Wed, 11 Aug 2010, David Winsemius wrote: > > On Aug 11, 2010, at 6:03 PM, Jarrett Byrnes wrote: > > > I have formulae with coefficents that I would like to update. However, > > I get some

[R] Regression Error Characteristic Curves

2010-08-11 Thread Giuseppe Amatulli
Hi, i'm searching for an R library able to calculate the Regression Error Characteristic Curves as explained in: http://www.google.it/url?sa=t&source=web&cd=1&ved=0CBgQFjAA&url=http%3A%2F%2Fciteseerx.ist.psu.edu%2Fviewdoc%2Fdownload%3Fdoi%3D10.1.1.93.2744%26rep%3Drep1%26type%3Dpdf&ei=d89iTPrxLMn54

Re: [R] odfWeave Issue.

2010-08-11 Thread Xu Wang
an error in the document format? Good job figuring it out. Did you submit a bug report? -- View this message in context: http://r.789695.n4.nabble.com/odfWeave-Issue-tp2321369p2321833.html Sent from the R help mailing list archive at Nabble.com. __ R-

[R] Colour Point Plot

2010-08-11 Thread Turn & Fall
Simple question. How do you change the standard plotting function so that points are solid and can have a pretty colour? Thanks for the help -- View this message in context: http://r.789695.n4.nabble.com/Colour-Point-Plot-tp2321433p2321433.html Sent from the R help mailing list archive at Nabb

[R] Creating vectors

2010-08-11 Thread clips10
I didn't really know what to post as the topic subject, but I have a vector, for instance (2,2,4,6,2,4,4,6,8,6) and I want to create another vector which is just numbers from 1 to 4 since there are only 4 unique numbers in my vector, so for instance 2 would be 1, 4 would be 2, 6 would be 3, and 8

[R] question on contour function

2010-08-11 Thread ba ba
Dear All, I tried to plot contour lines using R function contour, but got the results which are not expected. require(RTOMO) x <- seq(-1,1,0.1) y <- seq(-1,1,0.1) xy <- meshgrid(x,y) z <- xy$x^2+ 3*xy$y^2 contour(x,y,z,col="blue",xlab="x",ylab="y") The above code gave me the contour graph for z

[R] help to polish plot in ggplot2

2010-08-11 Thread Mahbubul Majumder
Hi, I wanted to generate a plot which is almost like the plot generated by the following codes. category <- paste("Geographical Category", 1:10) grp1 <- rnorm(10, mean=10, sd=10) grp2 <- rnorm(10, mean=20, sd=10) grp3 <- rnorm(10, mean=15, sd=10) grp4 <- rnorm(10, mean=12, sd=10) mydat <- data.f

[R] assignment functions with inherited class error

2010-08-11 Thread egc
# Two test for a class like this: setClass("XXX", representation=representation( "matrix" ) ) i<-new("XXX"); m=matrix(); colnames(m)<-c("colA"); i...@.data=m; # >i # An object of class “XXX” # colA #[1,] NA # #First Test

Re: [R] non-linear regression for 3D data

2010-08-11 Thread szisziszilvi
oh, god, please don't tell anybody... -- View this message in context: http://r.789695.n4.nabble.com/non-linear-regression-for-3D-data-tp2320982p2321082.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] a question regarding updating formulas with coefficients

2010-08-11 Thread David Winsemius
On Aug 11, 2010, at 6:45 PM, Charles C. Berry wrote: On Wed, 11 Aug 2010, David Winsemius wrote: On Aug 11, 2010, at 6:03 PM, Jarrett Byrnes wrote: I have formulae with coefficents that I would like to update. However, I get some strange results. For example, see the following: For t

Re: [R] a question regarding updating formulas with coefficients

2010-08-11 Thread Charles C. Berry
On Wed, 11 Aug 2010, David Winsemius wrote: On Aug 11, 2010, at 6:03 PM, Jarrett Byrnes wrote: I have formulae with coefficents that I would like to update. However, I get some strange results. For example, see the following: For the formula y ~ d+ 3*r+t Did you really get meaningful re

Re: [R] How to calculate the concentration

2010-08-11 Thread Yi
Thank you for reminding me. ## food=c('fruit','fruit','fruit','drink','drink','drink') type=c('apple','apple','orange','water','soda','soda') value=c(2,3,1,5,7,6) data=data.frame(food,type,value) share=c((2+3)/(2+3+1),5/6,1/6,5/(5+7+6),13/18,13/18) market_con=c(rep(0.833^2+0.167^2,3),r

Re: [R] How to calculate the concentration

2010-08-11 Thread Wu Gong
Hi Yi, It would be helpful for others to provide a solution if you give your formulas that calculating the value of share and concentration. ?apply will helps. Regards, Wu - A R learner. -- View this message in context: http://r.789695.n4.nabble.com/How-to-calculate-the-concentration-

Re: [R] a question regarding updating formulas with coefficients

2010-08-11 Thread David Winsemius
On Aug 11, 2010, at 6:03 PM, Jarrett Byrnes wrote: I have formulae with coefficents that I would like to update. However, I get some strange results. For example, see the following: For the formula y ~ d+ 3*r+t Did you really get meaningful results from that formula? Care to provide an

[R] a question regarding updating formulas with coefficients

2010-08-11 Thread Jarrett Byrnes
I have formulae with coefficents that I would like to update. However, I get some strange results. For example, see the following: For the formula y ~ d+ 3*r+t I want to add a variable p, so > update(y~d+0*r+t, .~.+p) produces y ~ d + t + p - 1 If the coefficient is not 0, but rather, somet

Re: [R] Data manipulation search

2010-08-11 Thread Erik Iverson
?match, look at the %in% operator. Mestat wrote: Hi listers, I made some search, but i didn`t find in the forum. I have a data set. I would like to make a search (conditon) on my data set. x<-c(1,2,3,4,5,6,7,8,9,10) count<-0 if (CONDITON){count<-1}else{count<-0} My CONDITION would be: is there

[R] Data manipulation search

2010-08-11 Thread Mestat
Hi listers, I made some search, but i didn`t find in the forum. I have a data set. I would like to make a search (conditon) on my data set. x<-c(1,2,3,4,5,6,7,8,9,10) count<-0 if (CONDITON){count<-1}else{count<-0} My CONDITION would be: is there number 5 in my data set? Thanks in advance, Marci

Re: [R] Using command line --file or -f

2010-08-11 Thread Gene Leynes
I'll respond to everyone, but Duncan's response worked, so I'll put that first. Thank you *everyone* for responding, I really appreciate it Duncan: Great idea, it's simple and works. Using the --args causes the final flags to be ignored by R, but you can still retreive them using commandArgs()

[R] How to calculate the concentration

2010-08-11 Thread Yi
Hi, folks, ## food=c('fruit','fruit','fruit','drink','drink','drink') type=c('apple','apple','orange','water','soda','soda') value=c(2,3,1,5,7,6) data=data.frame(food,type,value) share=c((2+3)/(2+3+1),5/6,1/6,5/(5+7+6),13/18,13/18) market_con=c(rep(0.833^2+0.167^2,3),rep(0.278^2+0

Re: [R] Creating vectors

2010-08-11 Thread Wu Gong
Hi, Try ?unique please. x <- c(2,2,9,4,6,2,4,4,6,8,6) # Original vector unique(x) #New vector only has unique elements sort(unique(x)) # Ordered Regards, Wu - A R learner. -- View this message in context: http://r.789695.n4.nabble.com/Creating-vectors-tp2321440p2321884.html Sent fro

Re: [R] Bigmemory: Error Running Example

2010-08-11 Thread Jay Emerson
It seems very likely you are working on a 32-bit version of R, but it's a little surprising still that you would have a problem with any single year. Please tell us the operating system and version of R. Did you preprocess the airline CSV file using the utilities provided on bigmemory.org? If you

Re: [R] Colour Point Plot

2010-08-11 Thread Wu Gong
Hi, ?plot will help you. plot(0:18,col="white") points(0:18,0:18,pch=0:18,col=rainbow(19),cex=2) Turn & Fall wrote: > > How do you change the standard plotting function so that points are solid > and can have a pretty colour? > - A R learner. -- View this message in context: http://r

Re: [R] Using command line --file or -f

2010-08-11 Thread Duncan Murdoch
On 11/08/2010 4:13 PM, Gene Leynes wrote: *What I want to do: *Create a windows shortcut that will start the R gui **and** simultaneously source a file *What I have already tried: *This almost works, but it's not the interactive R GUI: R --no-save --sdi -file="C:\SomePath\example.R" These

Re: [R] Using command line --file or -f

2010-08-11 Thread David Winsemius
On Aug 11, 2010, at 4:13 PM, Gene Leynes wrote: *What I want to do: *Create a windows shortcut that will start the R gui **and** simultaneously source a file Can't you set the file associations to start up RGUI when you launch an .R file? *What I have already tried: *This almost works,

Re: [R] Using command line --file or -f

2010-08-11 Thread Erik Iverson
Gene Leynes wrote: *What I want to do: *Create a windows shortcut that will start the R gui **and** simultaneously source a file *What I have already tried: *This almost works, but it's not the interactive R GUI: R --no-save --sdi -file="C:\SomePath\example.R" These open the R GUI, but d

[R] Using command line --file or -f

2010-08-11 Thread Gene Leynes
*What I want to do: *Create a windows shortcut that will start the R gui **and** simultaneously source a file *What I have already tried: *This almost works, but it's not the interactive R GUI: R --no-save --sdi -file="C:\SomePath\example.R" These open the R GUI, but doesn't recognize -f --f

[R] Time Series and fExtremes

2010-08-11 Thread Susana Santos
Hi. I need to convert data to time series. My problem is that when I converted my data to time series the data comes with time. I just want the date because doesn't work with "blockMaxima()". > data(bmwRet) > BMW=as.timeSeries(bmwRet) > head(BMW) GMT BMW.RET 1973-01-02 0.047704097 1973-01-03 0.00

Re: [R] sem & psych

2010-08-11 Thread John Fox
Dear Gui, Because you're wrapping the calls to summary() in try(), the errors there shouldn't stop your simulation. It probably makes sense to test whether the object returned by try() is of class "try-error", and possibly to specify the argument silent=TRUE, examining the error messages in your c

Re: [R] Growth Curves with lmer

2010-08-11 Thread Frank Harrell
Classification accuracy is an improper scoring rule, and one of the problems with it is that the proportional classified correctly can be quite good even if the model uses no predictors. [Hence omitting the intercept is also potentially problematic.] Frank E Harrell Jr Professor and Chair

Re: [R] Sweeping a zoo series

2010-08-11 Thread Gabor Grothendieck
On Wed, Aug 11, 2010 at 2:44 PM, Gabor Grothendieck wrote: > On Wed, Aug 11, 2010 at 2:38 PM, steven mosher wrote: >> The colMeans comes closest, >> for a single series the assume you have 100 years of monthly data. >> The mean you want to scale by is the mean for a restricted period in the >> ce

Re: [R] odfWeave Issue.

2010-08-11 Thread Axolotl9250
Hi, sorry I've gotten around the issue, I there was an error with the document format itself, I managed to correct by making a new file. -- View this message in context: http://r.789695.n4.nabble.com/odfWeave-Issue-tp2321369p2321789.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Adding points sequentially to multiple graphs in one window (device)

2010-08-11 Thread Greg Snow
The simplest thing to do is just recreate the plot(s) from scratch at each iteration with all the accumulated data. Most graphics devices are fast enough now that you will not notice the redraw. If you really just want to add to the plots, you can save and restore the graphics parameters, some

Re: [R] Running something without a loop when the result from the previous iteration is require for the current iteration

2010-08-11 Thread Adrienne Wootten
If it were just one loop by itself and I was doing the calculation for just one month for all of my 317 stations, I would agree with. However, this function itself is inside another loop which goes through each month and year that I need the calculation for each of the stations. If you have any s

[R] Growth Curves with lmer

2010-08-11 Thread Michael Scharkow
Dear all, I have some growth curve data from an experiment that I try to fit using lm and lmer. The curves describe the growth of classification accuracy with the amount of training data t, so basically y ~ 0 + t (there is no intercept because y=0 at t0) Since the growth is somewhat nonlinear *a

Re: [R] Running something without a loop when the result from the previous iteration is require for the current iteration

2010-08-11 Thread Greg Snow
What is wrong with using a loop? It used to be that loops were much slower than some of the alternatives, but now days a well crafted loop runs almost as fast (sometime faster) than the apply functions. So if the loop is working for you, use it and don't worry about it (though there may be way

[R] Adding points sequentially to multiple graphs in one window (device)

2010-08-11 Thread elinder
Dear R-help list: I have want seems to be a simple task, but can't find a solution. I tried querying the archives, but did not succeed. My goal is to set up two (or more) graphs in one graph window, and then during execution of a sequential algorithm add points sequentially to these graphs. The

Re: [R] Sweeping a zoo series

2010-08-11 Thread Gabor Grothendieck
On Wed, Aug 11, 2010 at 2:38 PM, steven mosher wrote: > The colMeans comes closest, > for a single series the assume you have 100 years of monthly data. > The mean you want to scale by is the mean for a restricted period in the > center > of the series.. say 1950-1960 > for this period you have th

Re: [R] Sweeping a zoo series

2010-08-11 Thread steven mosher
The colMeans comes closest, for a single series the assume you have 100 years of monthly data. The mean you want to scale by is the mean for a restricted period in the center of the series.. say 1950-1960 for this period you have the average jan (1950-1960) average feb, ect. your final series w

Re: [R] Arbitrary number of covariates in a formula

2010-08-11 Thread Bert Gunter
suppose covnames is a vector containing your covariate names (e.g. as character strings) Then (warning: untested) rhs <- paste(covnames, collapse="+") ## makes them into a single string separated by "+"-es and form <- formula(paste("y", rhs, sep="~")) ## creates your formula. ?substitute can

Re: [R] Running something without a loop when the result from the previous iteration is require for the current iteration

2010-08-11 Thread Wu Gong
Hi Adrienne, I guess apply should be better than for loop. Code like this: event.gen2 = function(genmat,use1,use2,num,ortho_obs_used){ onerow.gen <- function(one.row, use1){ one.row[num] <- ifelse(...} genmat[,num] <- NA ##Add one row with NA values apply(

Re: [R] Arbitrary number of covariates in a formula

2010-08-11 Thread Henrique Dallazuanna
This shoul work: coxph(Surv(intx, status) ~ . + strata(sex) - sex, test1) On Wed, Aug 11, 2010 at 1:54 PM, Mendolia, Franco wrote: > Hello! > > I have something like this: > > test1 <- data.frame(intx=c(4,3,1,1,2,2,3), > status=c(1,1,1,0,1,1,0), > x1=c(0,2,1

Re: [R] Sweeping a zoo series

2010-08-11 Thread Gabor Grothendieck
On Wed, Aug 11, 2010 at 12:22 PM, steven mosher wrote: > Given a long zoo matrix, the goal is to "sweep" out a statistic from the > entire length of the > sequences. > >  longzoomatrix<-zoo(matrix(rnorm(720),ncol=6),as.yearmon(outer(1900,seq(0,length=120)/12,"+"))) >  cnames<-c(12345,23456,34567,4

Re: [R] Arbitrary number of covariates in a formula

2010-08-11 Thread Mendolia, Franco
Thanks for your hint. This works: form <- formula(paste("Surv( time, event,) ~",paste(covar, collapse="+"),"+strata(stratum)", sep=" ") ) Franco From: David Winsemius [dwinsem...@comcast.net] Sent: Wednesday, August 11, 2010 1:05 PM To: Mendolia, Franco Cc

Re: [R] Plotting confidence bands around regression line

2010-08-11 Thread Frank Harrell
I may be missing something but I don't see how P&B handles errors in variables any differently than other regression methods that ignore this problem. Frank Frank E Harrell Jr Professor and ChairmanSchool of Medicine Department of Biostatistics Vanderbilt Uni

Re: [R] Arbitrary number of covariates in a formula

2010-08-11 Thread David Winsemius
On Aug 11, 2010, at 1:53 PM, Mendolia, Franco wrote: I could do that. However, the function f that I mentioned below is part of a bigger program and is nested inside another function, say function A. In function A I determine the covariates that I want to use and then call my function f.

[R] fExtremes

2010-08-11 Thread Susana Santos
Hi. I need to convert data to time series. My problem is that when I converted my data to time series the data comes with time. I just want the date because doesn't work with "blockMaxima()". > data(bmwRet) > BMW=as.timeSeries(bmwRet) > head(BMW) GMT BMW.RET 1973-01-02 0.047704097 1973-01-03 0.00

Re: [R] Arbitrary number of covariates in a formula

2010-08-11 Thread Mendolia, Franco
I could do that. However, the function f that I mentioned below is part of a bigger program and is nested inside another function, say function A. In function A I determine the covariates that I want to use and then call my function f. So even if I use a formula as single argument, I would stil

Re: [R] Matrix Plot and linear regression

2010-08-11 Thread Jorge Ivan Velez
Hi As hz, The following might get you started: http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=137 Also, see ?pairs. HTH, Jorge On Wed, Aug 11, 2010 at 1:34 PM, ashz <> wrote: > > Hi, > > Is it possible to do a Matrix Plot and in the cell perform a linear > regression also addi

[R] Matrix Plot and linear regression

2010-08-11 Thread ashz
Hi, Is it possible to do a Matrix Plot and in the cell perform a linear regression also adding to the cell the r2 and the equation. If so, how? Thanks, As hz -- View this message in context: http://r.789695.n4.nabble.com/Matrix-Plot-and-linear-regression-tp2321613p2321613.html Sent from the R

[R] mean by year of ts object

2010-08-11 Thread Sebastian Kruk
Dear R-help list users, I have a ts object and I would like to make a new one that contain mean by year. Is there a direct way of do it? Thks, Sebastián. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] Plotting confidence bands around regression line

2010-08-11 Thread S Ellison
>>> Frank Harrell 11/08/2010 17:02:03 >>> > This problem seems to cry out for one of the many available robust > regression methods in R. Not sure that would be much more appropriate, although it would _appear_ to work. The P&B method is a sort of nonparametric/robust approach to an errors-in

[R] sem & psych

2010-08-11 Thread Guilherme Wood
Dear R users, I am trying to simulate some multitrait-multimethod models using the packages sem and psych but whatever I do to deal with models which do not converge I always get stuck and get error messages such as these: "Error in summary.sem(M1) : coefficient covariances cannot be computed

[R] sem & psych

2010-08-11 Thread chegadesalzburg
Dear R users, I am trying to simulate some multitrait-multimethod models using the packages sem and psych but whatever I do to deal with models which do not converge I always get stuck and get error messages such as these: "Error in summary.sem(M1) : coefficient covariances cannot be computed"

Re: [R] Arbitrary number of covariates in a formula

2010-08-11 Thread Erik Iverson
Are you for some reason against writing your function to accept a single argument, a formula, that you simply pass on to coxph? Mendolia, Franco wrote: Hello! I have something like this: test1 <- data.frame(intx=c(4,3,1,1,2,2,3), status=c(1,1,1,0,1,1,0),

[R] Arbitrary number of covariates in a formula

2010-08-11 Thread Mendolia, Franco
Hello! I have something like this: test1 <- data.frame(intx=c(4,3,1,1,2,2,3), status=c(1,1,1,0,1,1,0), x1=c(0,2,1,1,1,0,0), x2=c(1,1,0,0,2,2,0), sex=c(0,0,0,0,1,1,1)) and I can easily fit a cox mo

[R] Running something without a loop when the result from the previous iteration is require for the current iteration

2010-08-11 Thread Adrienne Wootten
Hello Everyone! Here's what I'm trying to do. I'm working on generating occurrences of precipitation based upon precipitation occurrence for a station during the previous day and two stations that have already been generated by joint probablities and 1st order Markov chains or by the same generat

Re: [R] odfWeave Issue.

2010-08-11 Thread Max Kuhn
> What does this mean? It's impossible to tell. Read the posting guide and figure out all the details that you left out. If we don't have more information, you should have low expectations about the quality of any replies to might get. -- Max __ R-he

[R] Sweeping a zoo series

2010-08-11 Thread steven mosher
Given a long zoo matrix, the goal is to "sweep" out a statistic from the entire length of the sequences. longzoomatrix<-zoo(matrix(rnorm(720),ncol=6),as.yearmon(outer(1900,seq(0,length=120)/12,"+"))) cnames<-c(12345,23456,34567,45678,56789,67890) colnames(longzoomatrix)<-cnames longzoomatrix[

Re: [R] Plotting confidence bands around regression line

2010-08-11 Thread Frank Harrell
Frank E Harrell Jr Professor and ChairmanSchool of Medicine Department of Biostatistics Vanderbilt University On Wed, 11 Aug 2010, Michal Figurski wrote: Peter, Frank, David and others, Thank you all for your ideas. I understand your lack of trust in P&B meth

Re: [R] Plotting confidence bands around regression line

2010-08-11 Thread Michal Figurski
Peter, Frank, David and others, Thank you all for your ideas. I understand your lack of trust in P&B method. Setting that aside (it's beyond me anyways), please see below what I have finally came up with to calculate the CI boundaries. Given the slope and intercept with their 05% & 95% CIs, an

[R] odfWeave Issue.

2010-08-11 Thread Axolotl9250
Hi, I'm trying to put a document through odfWeave that has some R code for coursework in it: > library(odfWeave) Loading required package: lattice Loading required package: XML > inFile = "~/Documents/Squirrel.odf" > outFile = "~/Documents/ Squirrel Out.odt" > inFile = "~/Documents/Squirrel.odt"

Re: [R] question about bayesian model selection for quantile regression

2010-08-11 Thread Xin__ Li
> > Hello: > I try to use function "bms" to select the best model with the biggest posterior probability for different quantile. I have one return and 16 variables. However, I can just select for the linear model, how to change the code for quantile: > >bma1=bms(rq(y~.,tau=0.25,data=EQT), burn

Re: [R] Std. error of correlation coefficients

2010-08-11 Thread Joshua Wiley
Hi, Look at ?cor.test, it does not give you the standard error, but it does give you a confidence interval around the correlation coefficient and a significance test (which is my best guess of what you are probably looking to do with the standard error). You could also get it out of a simple regr

Re: [R] [OT] R on Atlas library

2010-08-11 Thread Matthias Gondan
Hi Allan, Thank you for your response. Finally I succeeded. These were the commands to compile Atlas and R: Atlas: ../configure -t 4 -Fa alg -fPIC make make install (-fPIC is needed to wrap some of objects of lapack.a as into a shared lib) R: ../configure --with-blas="/usr/local/lib/libptf

  1   2   >