Re: [R] paste adjacent elements matching string

2009-12-05 Thread Jill Hollenbach
thanks so much, this did the trick! Jill Gabor Grothendieck wrote: Try this which assumes that comma does not appear in any of the strings. You can substitute a different non-appearing character if a comma does appear in any of the strings: strsplit(gsub(string,, string, paste(vec,

Re: [R] categorical vs numerical

2009-12-05 Thread DispersionMap
Thanks, however the group sizes are really big (each a,b,c.. category has 60,000 observations). Its hard to see whats going on withe the jittered stripchart, i just get big black blobs. Any other suggestions? Peter Ehlers wrote: If your group sizes are not too large, I would use jittered

Re: [R] categorical vs numerical

2009-12-05 Thread Peter Ehlers
You could try density plots: If dat is your dataframe, y is your numerical vector and g is your factor, library(lattice) trellis.device(height=9, width=7) densityplot(~g|y, data=dat, plot.points=FALSE, layout=c(1,4)) See ?densityplot, ?panel.densityplot -Peter Ehlers DispersionMap wrote:

[R] HELP boxplot for time class

2009-12-05 Thread uvilla
hi again I will try this time to explain my problem clearly I have the following data from the file skiing.csv (3 first rows) protokollid datestart end 14 2/23/2009 8:50:10 15:17:30 24 2/24/2009 9:47:00 13:52:25 35 3/22/2009 8:51:25

Re: [R] categorical vs numerical

2009-12-05 Thread Peter Ehlers
Whoops, that should be densityplot(~y|g, data=dat, plot.points=FALSE, layout=c(1,4)) -Peter Ehlers Peter Ehlers wrote: You could try density plots: If dat is your dataframe, y is your numerical vector and g is your factor, library(lattice) trellis.device(height=9, width=7)

[R] Using rgl to put a graphic beneath a plot

2009-12-05 Thread Colin Wyers
I've written a very simple bit of code to plot a trajectory using rgl: x - (c(0,-5.947,-11.496,-16.665,-21.474,-25.947,-30.116,-34.017,-37.684,-41.148,-44.435,-47.568,-50.567,-53.448,-56.223,-58.906)) y -

Re: [R] Using rgl to put a graphic beneath a plot

2009-12-05 Thread Duncan Murdoch
On 05/12/2009 3:07 AM, Colin Wyers wrote: I've written a very simple bit of code to plot a trajectory using rgl: x - (c(0,-5.947,-11.496,-16.665,-21.474,-25.947,-30.116,-34.017,-37.684,-41.148,-44.435,-47.568,-50.567,-53.448,-56.223,-58.906)) y -

Re: [R] categorical vs numerical

2009-12-05 Thread DispersionMap
Thanks, ill give them whirl...when i was installing the lattice package i got the error in bold below...why does it say permission denied and what effect does this have? utils:::menuInstallLocal() package 'lattice' successfully unpacked and MD5 sums checked updating HTML package descriptions

Re: [R] HELP boxplot for time class

2009-12-05 Thread Gabor Grothendieck
Try this: Lines - protokollid datestart end 4 2/23/2009 8:50:10 15:17:30 4 2/24/2009 9:47:00 13:52:25 5 3/22/2009 8:51:25 12:00:05 library(chron) skiers - read.table(textConnection(Lines), header = TRUE, as.is = TRUE) skiers - transform(skiers, date = dates(date), start

Re: [R] paste adjacent elements matching string

2009-12-05 Thread Gray Calhoun
A different approach than those other people listed would be to change the vector into a matrix (by setting its dimension, if you don't need to keep the original vector) and then applying paste along one of the dimensions. Obviously, you'd need to pad the end of the vector with NAs or empty

Re: [R] paste adjacent elements matching string

2009-12-05 Thread Henrique Dallazuanna
Try this also: sapply(grep(string$, vec), function(idx)paste(vec[idx + 0:1], collapse = )) On Fri, Dec 4, 2009 at 11:42 PM, Jill Hollenbach jil...@sbcglobal.net wrote: Hi all, I would like to combine elements of a vector: vec - c(astring,  b, cstring,  d, e)   vec [1] astring b      

[R] R CMD BATCH continue after an error in the script

2009-12-05 Thread Veronesi, Fabio
Hi, I have a problem with R CMD BATCH, because I created a .bat file to run a script: C:\R\R-2.9.2\bin\R CMD BATCH C:\Scrip_test.R It work perfectly but after 3 lines of script there is a line with a nls() function that cannot be fitted and this end in an error message. I'm not bother by the

Re: [R] R CMD BATCH continue after an error in the script

2009-12-05 Thread Hrishi Mittal
Fabio, If you're not using the nls() function's result, then why don't you comment it out from the script? That way, there will be no error and the script will work fine. Please post your script if you need further help. Veronesi, Fabio wrote: Hi, I have a problem with R CMD BATCH,

Re: [R] R CMD BATCH continue after an error in the script

2009-12-05 Thread David Winsemius
On Dec 5, 2009, at 9:21 AM, Veronesi, Fabio wrote: Hi, I have a problem with R CMD BATCH, because I created a .bat file to run a script: C:\R\R-2.9.2\bin\R CMD BATCH C:\Scrip_test.R It work perfectly but after 3 lines of script there is a line with a nls() function that cannot be fitted

Re: [R] Partial correlations and p-values

2009-12-05 Thread Juliet Hannah
Your R code looks correct. Because this is a straightforward calculation, I would be surprised if there were any differences with SPSS. It may be worthwhile to check if SPSS gives partial correlations or semipartial correlations. For example, if you take the correlation between py - resid(lm(y

[R] Referencing variable names rather than column numbers

2009-12-05 Thread John-Paul Ferguson
I apologize for how basic a question this is. I am a Stata user who has begun using R, and the syntax differences still trip me up. The most basic questions, involving as they do general terms, can be the hardest to find solutions for through search. Assume for the moment that I have a dataset

Re: [R] Referencing variable names rather than column numbers

2009-12-05 Thread baptiste auguie
Hi, Try this, cor(pollute[ ,c(Pollution,Temp,Industry)]) and ?[ in particular, Character vectors will be matched to the names of the object HTH, baptiste 2009/12/5 John-Paul Ferguson ferguson_john-p...@gsb.stanford.edu: I apologize for how basic a question this is. I am a Stata user who

Re: [R] categorical vs numerical

2009-12-05 Thread Peter Ehlers
pkg:lattice is installed as part of the base R distribution. You don't need to install it. DispersionMap wrote: Thanks, ill give them whirl...when i was installing the lattice package i got the error in bold below...why does it say permission denied and what effect does this have? I guess that

Re: [R] Referencing variable names rather than column numbers

2009-12-05 Thread Ista Zahn
As baptiste noted, you can do cor(pollute[ ,c(Pollution,Temp,Industry)]). But cor(pollute[,Pollution:Industry]) will not work. For that you can do cor(pollute[ ,which(names(pollute)==Pollution):which(names(pollute)==Industry)]) -Ista On Sat, Dec 5, 2009 at 11:22 AM, John-Paul Ferguson

Re: [R] Referencing variable names rather than column numbers

2009-12-05 Thread Jorge Ivan Velez
Dear John-Paul, Take a look at https://stat.ethz.ch/pipermail/r-help/2009-July/204027.html It contains different ways to do (in part) what you want. HTH, Jorge On Sat, Dec 5, 2009 at 11:22 AM, John-Paul Ferguson wrote: I apologize for how basic a question this is. I am a Stata user who has

Re: [R] Referencing variable names rather than column numbers

2009-12-05 Thread Marc Schwartz
Alternatively, you can use subset(), which supports the : operator for the 'select' argument: cor(subset(iris, select = Sepal.Length:Petal.Length)) Sepal.Length Sepal.Width Petal.Length Sepal.Length1.000 -0.11756980.8717538 Sepal.Width-0.1175698 1.000

Re: [R] Referencing variable names rather than column numbers

2009-12-05 Thread David Winsemius
On Dec 5, 2009, at 11:30 AM, baptiste auguie wrote: Hi, Try this, cor(pollute[ ,c(Pollution,Temp,Industry)]) and ?[ in particular, Character vectors will be matched to the names of the object John-Paul; In the time it took me to compose this, I see that others have already pointed out

Re: [R] Referencing variable names rather than column numbers

2009-12-05 Thread John-Paul Ferguson
Holy Cats, those were four quick responses! And the question, basically, is answered: 1. When in doubt, try quoting column names where you would try using unquoted column indexes. 2. Subset() seems, overall, the most flexible analog to Stata's variable-referencing syntax. I appreciate the help.

[R] three plots as one JEPG?

2009-12-05 Thread Walther, Alexander
Dear List, i have a question concerning these device-related function (i.e. pdf(),jpeg(), etc.). Currently, I plot three graphs, one below the other into a /single/ window by using par(). I would like to save this figure now as JPEG or PNG. By now, code looks as follows: jepg(...) par(...)

[R] Refresh with default x11() cairo

2009-12-05 Thread Marc Chiarini (Tufts)
Greetings R community: Since R 2.9.0+ I have noticed that when I use the default cairo x11() device, if I obscure a device window (or switch virtual desktops), the window does not refresh. I need to move it or resize it to make it redraw. This behavior did not happen before 2.9.0. It also

Re: [R] categorical vs numerical

2009-12-05 Thread DispersionMap
im using w7 ultimate Peter Ehlers wrote: pkg:lattice is installed as part of the base R distribution. You don't need to install it. DispersionMap wrote: Thanks, ill give them whirl...when i was installing the lattice package i got the error in bold below...why does it say permission

Re: [R] three plots as one JEPG?

2009-12-05 Thread Marc Schwartz
On Dec 5, 2009, at 11:21 AM, Walther, Alexander wrote: Dear List, i have a question concerning these device-related function (i.e. pdf(),jpeg(), etc.). Currently, I plot three graphs, one below the other into a /single/ window by using par(). I would like to save this figure now as JPEG

Re: [R] three plots as one JEPG?

2009-12-05 Thread Duncan Murdoch
On 05/12/2009 12:21 PM, Walther, Alexander wrote: Dear List, i have a question concerning these device-related function (i.e. pdf(),jpeg(), etc.). Currently, I plot three graphs, one below the other into a /single/ window by using par(). I would like to save this figure now as JPEG or PNG. By

Re: [R] three plots as one JEPG?

2009-12-05 Thread Marc Schwartz
On Dec 5, 2009, at 11:34 AM, Marc Schwartz wrote: On Dec 5, 2009, at 11:21 AM, Walther, Alexander wrote: Dear List, i have a question concerning these device-related function (i.e. pdf(),jpeg(), etc.). Currently, I plot three graphs, one below the other into a /single/ window by using

Re: [R] HELP boxplot for time class

2009-12-05 Thread uvilla
Thanks a lot Gabor, now I could finally plot the as time data. I just have one more question, and I hope it is the last. In the script of the boxplot, bp - boxplot(as.numeric(skiers$start), yaxt = n) axis(2, bp$stats, times(bp$stats), las = 2, cex.axis = 0.5) I have been trying to add a main

Re: [R] Partial correlations and p-values

2009-12-05 Thread Charles C. Berry
On Sat, 5 Dec 2009, Juliet Hannah wrote: Your R code looks correct. There are a couple of hiccups. First the degrees of freedom for the partial correlation would be wrong even if there was no missing data. Because this is a straightforward calculation, I would be surprised if there were

Re: [R] Partial correlations and p-values

2009-12-05 Thread David Freedman
you might look at partial.r in the psych package dadrivr wrote: I'm trying to write code to calculate partial correlations (along with p-values). I'm new to R, and I don't know how to do this. I have searched and come across different functions, but I haven't been able to get any of

[R] regression tests still fail for R version 2.10.0

2009-12-05 Thread Oliver Kullmann
Hello, on Mon Nov 9 17:57:04 CET 2009 I've sent an e-mail to the R mailing list (see below), about a failing regression test. Yet nobody replied, while (obviously) the situation didn't change (installation still fails, and might continue to do so in the future). I wonder whether somebody has to

Re: [R] regression tests still fail for R version 2.10.0

2009-12-05 Thread David Winsemius
The question lacks so many specifics that would be needed to address problem that I suspect persons with sufficient knowledge to address it (and I am probably not among that group) simply passed it over and waited for you to get sufficiently motivated to actually read the Posting Guide.

Re: [R] Installing RandomForest on SuSe Linux - warnings

2009-12-05 Thread Uwe Ligges
If the package passes the checks (R CMD check) on your macine, it should be fine. Some compiler warnings are expected. Best wishes, Uwe Ligges NCS wrote: I installed RF on Linux OpenSuSe 11.1 and while it did install and did run a model I had created on Windows correctly, it gave me a lot

Re: [R] Rounding a Measurement to be Consistent with its Uncertainty

2009-12-05 Thread Uwe Ligges
Tom La Bone wrote: I have a measurement of 8165.666 and an uncertainty of 338.9741 (the units of both are unimportant). I can easily round the uncertainty to two significant digits with signif(338.9741,2), which gives 340. Is there a function in R that will take 8165.666 and round it to be

Re: [R] How to draw a big heatmap?

2009-12-05 Thread Uwe Ligges
Ning Ma wrote: Hi everyone. How can I draw a big heatmaps? png(foo.png,1,1) heatmap(x) dev.off() where x is a big matrix, say 200*200. The code above generates a small heatmap in the middle of the png file and leaves big margins. I expect it to take up more space so that the labels

Re: [R] Problem with date x-axis

2009-12-05 Thread Uwe Ligges
PtitBleu wrote: Hello, I have a friday problem. I'm trying to plot the number of measures by day with this command between the 2008-07-31 and the 2009-11-13 (it works) : plot(unique(as.Date(strptime(data$date, format=%Y-%m-%d %H:%M:%S))), measuresbyday) then I would like to plot vertical

[R] Announcing a new R news site: R-bloggers.com

2009-12-05 Thread Tal Galili
Hello everyone. After some good time of work, I am proud to present: www.r-bloggers.com What is R-Bloggers.com? R-Bloggers.com hopes to serve the R community by presenting (in one place) all the new articles (posts) written (in English) about R in the R blogosphere. How does R-Bloggers operate?

Re: [R] Announcing a new R news site: R-bloggers.com

2009-12-05 Thread Dirk Eddelbuettel
On 5 December 2009 at 21:38, Tal Galili wrote: | R-Bloggers.com hopes to serve the R community by presenting (in one place) | all the new articles (posts) written (in English) about R in the R | blogosphere. But how is that different from http://PlanetR.stderr.org which has

Re: [R] HELP boxplot for time class

2009-12-05 Thread Gabor Grothendieck
Use the title function: title(My main, xlab = My X, ylab = My Y) On Sat, Dec 5, 2009 at 12:38 PM, uvilla maruchave...@hotmail.com wrote: Thanks a lot Gabor, now I could finally plot the as time data. I just have one more question, and I hope it is the last. In the script of the boxplot,

Re: [R] Announcing a new R news site: R-bloggers.com

2009-12-05 Thread Tal Galili
Hi Dirk, I wish to emphasis that I came across PlanetR over a year ago, but completely forgot it existed when working on R-bloggers. Also, when I contacted the bloggers about this idea, non of them actually wrote to me about it (which makes me feel better about not remembering it). I apologies if

Re: [R] Announcing a new R news site: R-bloggers.com

2009-12-05 Thread Daniel Nordlund
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Tal Galili Sent: Saturday, December 05, 2009 11:38 AM To: r-help@r-project.org Subject: [R] Announcing a new R news site: R-bloggers.com Hello everyone. After some good time

Re: [R] Announcing a new R news site: R-bloggers.com

2009-12-05 Thread Tal Galili
Hi Daniel. In short: no. In more words: 1) I have zone alarm also on my computer and it gives me no warnings. 2) The only two external scripts the site has are of woopra and google analytics, both are known external statistics services. 3) It could be (although not likely) that the site is

Re: [R] Rounding a Measurement to be Consistent with its Uncertainty

2009-12-05 Thread Tom La Bone
Uwe Ligges-3 wrote: Tom La Bone wrote: I have a measurement of 8165.666 and an uncertainty of 338.9741 (the units of both are unimportant). I can easily round the uncertainty to two significant digits with signif(338.9741,2), which gives 340. Is there a function in R that will take

[R] R packages and assess to data in packages

2009-12-05 Thread Tariq Perwez
Hi Everyone, I have two very basic questions and would appreciate your help. 1. I would like to see/access the data that comes with a given R package by using a function like read.table(). For example, I just installed car package from CRAN. I know that somewhere within the package, there is

Re: [R] Announcing a new R news site: R-bloggers.com

2009-12-05 Thread Romain Francois
On 12/05/2009 09:32 PM, Tal Galili wrote: Hi Dirk, I wish to emphasis that I came across PlanetR over a year ago, but completely forgot it existed when working on R-bloggers. Also, when I contacted the bloggers about this idea, non of them actually wrote to me about it (which makes me feel

[R] Incorrect number of dimensions

2009-12-05 Thread Sarah
I am trying to fit a linear model with seasonal effects but keep getting 'Incorrect number of dimensions'. I have no idea what this means or how to fix it. I am following instructions received from an instructor and it worked for him, so I assume it has something to do with my data. Here is my

[R] R example for ancova

2009-12-05 Thread syrvn
Hi list, does anybody know a easy to understand example in R which shows how to perfom an ANCOVA? I already tried to understand the example which you get when you type ?aov, but I did not really understand the output. Best, syrvn -- View this message in context:

[R] integrate function

2009-12-05 Thread li li
Hello, I have some trouble in terms of using integrate function in R. f1 is a function of p and x where x is supposed to be a vector. (See the code). Then I want to write function f2 which is a function of the vector x after I integrate out p. Can some one give me some help? Many thanks!

Re: [R] integrate function

2009-12-05 Thread David Winsemius
On Dec 5, 2009, at 4:59 PM, li li wrote: Hello, I have some trouble in terms of using integrate function in R. f1 is a function of p and x where x is supposed to be a vector. (See the code). Then I want to write function f2 which is a function of the vector x after I integrate out p.

Re: [R] Announcing a new R news site: R-bloggers.com

2009-12-05 Thread Daniel Nordlund
I don’t have comments as yet, because I didn’t stay around the site too long. I will go back and look at it using a spare Ubuntu box and let you know what I think. Dan Daniel Nordlund Bothell, WA USA _ From: Tal Galili [mailto:tal.gal...@gmail.com] Sent: Saturday,

Re: [R] Announcing a new R news site: R-bloggers.com

2009-12-05 Thread Tal Galili
Hi Romain, First - I'd like to say that you where one of the bloggers I wanted to e-mail and didn't get to it. I still remember our short session in useR 2009 where you showed me your plans for an R editor - I am still waiting to see it once it comes out. Regarding the rest of what you wrote,

[R] plot data from tapply

2009-12-05 Thread dwwc
i have three data, x coordinate, y coordinate and signal strength i use tapply() function to get the average ss in the give x,y location x=c(1,2,3,1) y=c(1,2,3,1) ss=c(55,NA,55,88) ss_byxy_test=tapply( ss, list( x, y), mean) and I get this table 1 2 3 1 71.5 NA NA 2 NA NA NA 3

Re: [R] R packages and assess to data in packages

2009-12-05 Thread Sharpie
Tariq Perwez wrote: Hi Everyone, I have two very basic questions and would appreciate your help. 1. I would like to see/access the data that comes with a given R package by using a function like read.table(). For example, I just installed car package from CRAN. I know that somewhere

[R] Forest Plot

2009-12-05 Thread Xin Ge
Hi All, I want to produce a similar Forest Plot as it is on the following link, but my data would be having only two columns (one for Estimate and other for Std. Dev). Can anyone suggest some function() {Package} which can take such file as an input and give following forest plot:

Re: [R] Forest Plot

2009-12-05 Thread Viechtbauer Wolfgang (STAT)
The figure that you linked to was produced with the metafor package. It can also be used to produce a forest plot if you have means and corresponding standard errors of the means. The standard error of a mean is equal to SD / sqrt(n), so as long as you also know the sample sizes (n), you can

Re: [R] Forest Plot

2009-12-05 Thread Xin Ge
Thanks for your reply. Which function I should explore in metafor package for this kind of plot. Also I have to do a forest plot for regressions estimates (betas) and corresponding sqrt(var). I hope in this case there is no difference between std. error and std. deviation? So, a 95% confidence

Re: [R] integrate function

2009-12-05 Thread li li
Thank you very much for your reply! It is not an assignment. What I want to do is what we often do. If we have a bivariate function of x and p, I first fix x and integrate out p. Then the resultant function is only in terms of x. Here f1 is a bivariate function of x and p. f1 - function (p,x)

[R] STATISTICAL ANALYSIS OF TEXT EMAILS Re: Refreshments after SOMS Seminar Friday 3:30-4:30 in HBB 334

2009-12-05 Thread ajay ohri
Dear Professor Frank Guess, Why did you call me a Curious George? What is a curious george as in American context? Why did you address this email only to Laura and me. Why did you not answer my early query on what is a curious George? Why do you also send me emails saying I and Gandhi are

[R] barchart() {lattice} help.

2009-12-05 Thread Peng Cai
Hi, I'm plotting grouped barplot using following code and data. I need help with re-ordering the labels. 1. On x-axis the factor AGE is grouped in order 0--4, 15--18, 5--14; whereas I would like to have it in 0--4, 5--14, 15--18. 2. If I need to re-order RACE variable. How can I do it assuming

[R] SAS datalines or cards statement equivalent in R?

2009-12-05 Thread Gary Miller
Hi R Users, Is there a equivalent command in R where I can read in raw data? For example I'm looking for equivalent R code for following SAS code: DATA survey; INPUT id sex $ age inc r1 r2 r3 ; DATALINES; 1 F 35 17 7 2 2 17 M 50 14 5 5 3 33 F 45 6 7 2 7 49 M 24 14 7 5 7 65 F

Re: [R] SAS datalines or cards statement equivalent in R?

2009-12-05 Thread Jorge Ivan Velez
Dear Gary, Here is a suggestion using read.table() and textConnection(): toread - id sex age inc r1 r2 r3 1 F 35 17 7 2 2 17 M 50 14 5 5 3 33 F 45 6 7 2 7 49 M 24 14 7 5 7 65 F 52 9 4 7 7 81 M 44 11 7 7 7 2 F 34 17 6 5 3 18 M 40 14 7 5 2 34 F 47 6 6 5 6 50 M 35

Re: [R] integrate function

2009-12-05 Thread Ravi Varadhan
Here is how you can do it: f1 - function (p,x) { sapply(p, function(p) prod( p*x+(1-p)*x^2) ) # the function should be vectorized for `integrate' } f2 - function(x) { integrate(f1, 0, 1, x)$val # you need to only return the `value' of integration } f2(x=1:3) Hope this helps, Ravi.

Re: [R] integrate function

2009-12-05 Thread li li
Thank you all very much! Yes, f2 is the function I wanted to write. I tried to do use Vectorize function to f1, it did not work. f2 - function(x) + { + integrate(Vectorize(f1,vectorize.args =p), lower=0,upper=1, x) + } f2(c(2,3)) Error in Vectorize(f1, vectorize.args = p) :

Re: [R] integrate function

2009-12-05 Thread David Winsemius
I did get it to work with Vectorize. My problem was that I don't know if the answer made sense because I could not tell what mathematical underpinnings were being studied. -- David. On Dec 5, 2009, at 10:05 PM, li li wrote: Thank you all very much! Yes, f2 is the function I wanted to

[R] Error in eval(expr, envir, enclos) : object 'N' not found

2009-12-05 Thread hansoffate
I'm running an LSODA to generate some graphs, but I need to stop at a certain point and use those values to generate another LSODA output. This is working fine, but when I try to run the second LSODA, I get the Error in eval(expr, envir, enclos) : object 'N' not found. Any ideas what can be

[R] Error in eval(expr, envir, enclos) : object 'N' not found

2009-12-05 Thread hansoffate
I'm running an LSODA to generate some graphs, but I need to stop at a certain point and use those values to generate another LSODA output. This is working fine, but when I try to run the second LSODA, I get the Error in eval(expr, envir, enclos) : object 'N' not found. Any ideas what can be

Re: [R] integrate function

2009-12-05 Thread Berend Hasselman
li li-13 wrote: Yes, f2 is the function I wanted to write. I tried to do use Vectorize function to f1, it did not work. f2 - function(x) + { + integrate(Vectorize(f1,vectorize.args =p), lower=0,upper=1, x) + } f2(c(2,3)) Error in Vectorize(f1, vectorize.args = p) :