[R] using for loops with ggplot

2012-04-05 Thread Tarek Haddad
Hi all, I have been using ggplot for a few months and ran into this porblem, I am trying to use ggplot in a for loop and it is not working. if I do the following: data=as.data.frame(cbind(rnorm(10),rnorm(10),rnorm(10))) pp=ggplot(data, aes(x=(1:10), y=data[,1]))

[R] Extract fitted values with and without offset from glm

2012-04-05 Thread Chris Beeley
Hello- In the notes for the lm function it states Offsets specified by offset will not be included in predictions by predict.lm, whereas those specified by an offset term in the formula will be. I would like to extract fitted values in just this way from a glm model, those with the offset

[R] Odp: identify with mfcol=c(1,2)

2012-04-05 Thread Petr PIKAL
Hi It seems to me that probably split.screen or layout is preferable if you want specify graph for identification. But I am not an expert in this and after some testing identification does not work well with splitted screen. So you are probably out of luck. Regards Petr Please forgive my

Re: [R] Shapiro-Wilk cpoefficients: 2 Qs

2012-04-05 Thread Ted Harding
[See at end] On 05-Apr-2012 00:34:30 Peter Ehlers wrote: Hi Ted, On 2012-04-04 15:06, Ted Harding wrote: Greetings! I want to have the coefficients that R uses in shapiro.test() for the Shapiro-Wilk test for a prticular sample size, i.e. the a[i] in W = Sum(a[i]*x[i])/(Sum(x[i] -

Re: [R] using for loops with ggplot

2012-04-05 Thread Kohske Takahashi
This is because of lazy evaluation. Try this: pp=ggplot(data, aes(x=(1:10), y=data[,1])) for(i in 1:3){ pp=pp+geom_line(aes(x, y), data = data.frame(x=1:10,y = data[,i]),lty=2) } print(pp) 2012年4月5日14:36 Tarek Haddad tarekdhad...@gmail.com: pp=ggplot(data, aes(x=(1:10), y=data[,1])) for(i in

Re: [R] spaghetti plots in R

2012-04-05 Thread uday
Hi Rui, Thanks a lot it works -- View this message in context: http://r.789695.n4.nabble.com/spaghetti-plots-in-R-tp4532021p4534110.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

[R] Bloomberg API functions BAddPeriods Binterpol Bcountperiods in RBloomberg

2012-04-05 Thread arvanitis.christos
Hi to all, Is there a way to use the API bloomberg functions BAddPeriods Binterpol Bcountperiods in RBloomberg? tnks -- View this message in context: http://r.789695.n4.nabble.com/Bloomberg-API-functions-BAddPeriods-Binterpol-Bcountperiods-in-RBloomberg-tp4534163p4534163.html Sent from the R

Re: [R] meaning of sigma from LM, is it the same as RMSE

2012-04-05 Thread Mark Difford
On Apr 05, 2012; 1:47am John Sorkin wrote: Is the sigma from a lm...the RMSE (root mean square error) John, RMSE is usually calculated using the number of observations/cases, whereas summary.lm()$sigma is calculated using the residual degrees of freedom. See below: ## Helps to study the

[R] API Baddperiods in RBloomberg

2012-04-05 Thread arvanitis.christos
Hi to all, Do you know how I can use Baddperiods from RBloomberg tnks -- View this message in context: http://r.789695.n4.nabble.com/API-Baddperiods-in-RBloomberg-tp4534175p4534175.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] Remove carriage return in writing tab-delimited file.

2012-04-05 Thread Patrick Connolly
On Wed, 04-Apr-2012 at 02:58PM -0700, kickout wrote: | Having problems with the write.table function. I can write a tab delimited | file just fine, but for each line in my matrix its inputs a carriage return | when i dont want it to. | | For example my matrix might be: | | ID V1 V2 V3 |

Re: [R] identify with mfcol=c(1,2)

2012-04-05 Thread Sarah Goslee
Hi, Some additional information from you would make it more likely that the list can help you. What's your sessionInfo? Does the same thing occur if you don't wrap both plots in a single function? Can you provide a small reproducible example so we can try it out? Sarah On Apr 4, 2012, at 7:48

[R] xyplot with different pch and col in each panel and additional line

2012-04-05 Thread Camarda, Carlo Giovanni
Dear R-users, I'd like to use an xyplot(lattice) in which in each panel I have points with different point-character and color, and additional lines with the same color. Please find below a toy example in which I did not manage to change such parameters, and the associated basic plot() in

Re: [R] xyplot with different pch and col in each panel and additional line

2012-04-05 Thread Jim Lemon
On 04/05/2012 08:41 PM, Camarda, Carlo Giovanni wrote: Dear R-users, I'd like to use an xyplot(lattice) in which in each panel I have points with different point-character and color, and additional lines with the same color. Please find below a toy example in which I did not manage to change

Re: [R] STAR Spatio Temporal AutoRegressive models

2012-04-05 Thread Roger Bivand
vasilis vasilis.dakos at gmail.com writes: Hi there, do you know if there is a package that fits spatio temporal autoregressive models in R? If by spatio temporal autoregressive models, you mean spatial panel models, please see the splm package on R-Forge:

[R] Apply function to every 'nth' element of a vector

2012-04-05 Thread Michael Bach
Dear R users, how do I e.g. square each second element of a vector with an even number of elements? Or more generally to apply a function to every 'nth' element of a vector. I looked into the apply functions, but found no hint. For example: v - c(1, 2, 3, 4) mysquare - function (x) { return

Re: [R] using metafor for meta-analysis of before-after studies

2012-04-05 Thread Michael Dewey
At 18:39 04/04/2012, mp.sylves...@gmail.com wrote: Greetings, I wish to conduct a meta-analysis for which the outcome is a continuous variable measured on the same individuals before and after an intervention. Hence, the comparison is not made between two groups, but within groups, at diffrent

Re: [R] Apply function to every 'nth' element of a vector

2012-04-05 Thread Ista Zahn
Good morning Michael, On Thu, Apr 5, 2012 at 7:01 AM, Michael Bach pha...@gmail.com wrote: Dear R users, how do I e.g. square each second element of a vector with an even number of elements? Or more generally to apply a function to every 'nth' element of a vector. I looked into the apply

Re: [R] using metafor for meta-analysis of before-after studies

2012-04-05 Thread Viechtbauer Wolfgang (STAT)
To add to Michael's response: There are several things you can do: 1) If the dependent variable is the same in each study, then you could conduct the meta-analysis with the (raw) mean changes, i.e., yi = m1i - m2i, where m1i and m2i are the means at time 1 and 2, respectively. The sampling

Re: [R] Apply function to every 'nth' element of a vector

2012-04-05 Thread ken knoblauch
Michael Bach phaebz at gmail.com writes: how do I e.g. square each second element of a vector with an even number of elements? Or more generally to apply a function to every 'nth' element of a vector. I looked into the apply functions, but found no hint. For example: v - c(1, 2, 3, 4)

Re: [R] Apply function to every 'nth' element of a vector

2012-04-05 Thread ken knoblauch
ken knoblauch ken.knoblauch at inserm.fr writes: Michael Bach phaebz at gmail.com writes: how do I e.g. square each second element of a vector with an even number of elements? Or more generally to apply a function to every 'nth' element of a vector. I looked into the apply

Re: [R] meta-analysis, outcome = OR associated with a continuous independent variable

2012-04-05 Thread Viechtbauer Wolfgang (STAT)
I do not see any major difficulties with this case either. Suppose you have OR = 1.5 (with 95% CI: 1.19 to 1.90) indicating that the odds of a particular outcome (e.g., disease) is 1.5 times greater when the (continuous) exposure variable increases by one unit. Then you can back-calculate the

Re: [R] table: output: all variables in rows

2012-04-05 Thread Marion Wenty
Hello David, yes! this is what I was looking for! Thank you very much for your help. Marion 2012/4/2 David Winsemius dwinsem...@comcast.net On Apr 2, 2012, at 7:11 AM, Marion Wenty wrote: Dear people, I would like to create a table out of a data.frame. How can I determine, which

Re: [R] meta-analysis, outcome = OR associated with a continuous independent variable

2012-04-05 Thread ya
LIKE:) On 2012-4-5 15:03, Viechtbauer Wolfgang (STAT) wrote: I do not see any major difficulties with this case either. Suppose you have OR = 1.5 (with 95% CI: 1.19 to 1.90) indicating that the odds of a particular outcome (e.g., disease) is 1.5 times greater when the (continuous) exposure

[R] Extended Nelson Siegel model SMC with R-POMP

2012-04-05 Thread arvanitis.christos
Hi to everyone, Recently I became aware of an R package for Sequential Monte Carlo particle filtering called pomp [Check the CRAN site] I have found hard to learn and understand the package at a first passage and I was wondering if someone of you would like to share her/his experience of a

Re: [R] Bloomberg API functions BAddPeriods Binterpol Bcountperiods in RBloomberg

2012-04-05 Thread John Laing
Hello, These functions are not available in RBloomberg. As far as I can tell, Bloomberg does not expose these functions in the general API; they are specific to the Excel version. R has other mechanisms for performing date arithmetic, both in the Date class and the POSIXct/POSIXlt classes. This

[R] GMM package error

2012-04-05 Thread arvanitis.christos
Hi to all I am using GEL function of GMM package to fit a ts I use gmm to feed initial values to GEL as: temp3M=gmm(fgmm,rf3M[[i]],tet03M[[i]],wmatrix=ident)$coef gel3M[[i]]=gel(g=fgmm, # Function GMM x=rf3M[[i]], #

[R] need explaination on Rpart

2012-04-05 Thread santoshdvn
Hi, I am learning decisions trees using R ..I used RPART to create decision maps. when i saw the summary .. i got CPnsplit rel errorxerror xstd Could anyone make me understand terms here CP,relerror xerror and xstand. or could you please provide the detailed blog where i can

[R] help in paste command

2012-04-05 Thread arunkumar1111
i have a character variable tablename=DressMaterials var1=(red,blue,green,white) My output should be like select * from DressMaterialswhere colors in (red,blue,green,white) i'm not able to get the where part. my code paste(select * from , tablename , where colors in ,paste(var1,

[R] constrained optimization with vectors using the package alabama

2012-04-05 Thread Bjoern Guse
Hello everyone, I want to estimate a function for the relationship between the distance and the cross-correlation coefficients. This means that I have several pairs of distance and cross-correlation coefficients. Hence, I have a function which includes two vectors with the same length (for

Re: [R] using metafor for meta-analysis of before-after studies

2012-04-05 Thread MP . Sylvestre
Many thanks to both of you for the helpful responses to my post. The outcomes are all measured with the same units and I can indeed calculate the sampling variance from the 2 SDs I get from each study. MP Le , Viechtbauer Wolfgang (STAT) wolfgang.viechtba...@maastrichtuniversity.nl a écrit

Re: [R] meta-analysis, outcome = OR associated with a continuous independent variable

2012-04-05 Thread MP . Sylvestre
For some reason I was under the false impression that these packages were made for meta-analyses of RCT-like studies in which two groups are compared. I am glad to see that I was wrong and that I can use one of these packages. All studies reported using the same units for the exposure so

[R] is parallel computing possible for 'rollapplyr' job?

2012-04-05 Thread Pam
  Hi,   The code below does exactly what I want in sequential mode. But, it is slow and I want to run it in parallel mode. I examined some windows version packages (parallel, snow, snowfall,..) but could not solve my specific problem. As far as I understood, either I have to write a new

[R] reclaiming lost memory in R

2012-04-05 Thread Ramiro Barrantes
Dear list, I am trying to reclaim what I think is lost memory in R, I have been using gc(), rm() and also using Rprof to figure out where all the memory is going but I might be missing something. I have the following situation basic loop which calls memoryHogFunction: for i in (1:N) {

Re: [R] help in paste command

2012-04-05 Thread mlell08
Hello Arun, paste(select * from , tablename , where colors in (,paste(var1,collapse=,),)) [1] select * from DressMaterials where colors in ( red,blue,green,white ) Regards! __ R-help@r-project.org mailing list

Re: [R] Rgui maintains open file handles after Sweave error

2012-04-05 Thread Alexander Shenkin
Here is Dr. Leisch's advice for dealing with open handles (and it works): On 4/5/2012 4:22 AM, Friedrich Leisch wrote: ... You need to close the pdf device, not an open connection: R Sweave(test.Rnw) Writing to file test.tex Processing code chunks with options ... 1 : keep.source term

Re: [R] meta-analysis, outcome = OR associated with a continuous independent variable

2012-04-05 Thread Viechtbauer Wolfgang (STAT)
You can get an OR from a 2x2 table (which is equivalent to doing logistic regression with a single dummy variable that indicates the group) or from some continuous exposure (where the logistic regression model will then include that continuous variable). The various packages are set up to

Re: [R] Apply function to every 'nth' element of a vector

2012-04-05 Thread David Winsemius
On Apr 5, 2012, at 7:01 AM, Michael Bach wrote: Dear R users, how do I e.g. square each second element of a vector with an even number of elements? Or more generally to apply a function to every 'nth' element of a vector. I looked into the apply functions, but found no hint. For example: v

Re: [R] help in paste command

2012-04-05 Thread David Winsemius
On Apr 5, 2012, at 8:55 AM, arunkumar wrote: i have a character variable tablename=DressMaterials var1=(red,blue,green,white) My output should be like select * from DressMaterialswhere colors in (red,blue,green,white) i'm not able to get the where part. ?match my code

Re: [R] is parallel computing possible for 'rollapplyr' job?

2012-04-05 Thread Gabor Grothendieck
On Thu, Apr 5, 2012 at 9:18 AM, Pam fkira...@yahoo.com wrote: Hi, The code below does exactly what I want in sequential mode. But, it is slow and I want to run it in parallel mode. I examined some windows version packages (parallel, snow, snowfall,..) but could not solve my specific

Re: [R] help in paste command

2012-04-05 Thread arunkumar1111
Thanks Lell It worked well. - Thanks in Advance Arun -- View this message in context: http://r.789695.n4.nabble.com/help-in-paste-command-tp4534756p4534925.html Sent from the R help mailing list archive at Nabble.com. __

[R] data normalize issue

2012-04-05 Thread uday
http://r.789695.n4.nabble.com/file/n4534914/Rplot01.png I have some dataset ak[1:3,] [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 0.3211745 0.4132568 0.5649930 0.6920562 0.7760113 0.8118568 0.8609301 0.9088819 0.9326736 [2,] 0.3159234

Re: [R] recover lost global function

2012-04-05 Thread Sam Steingold
* Duncan Murdoch zheqbpu.qha...@tznvy.pbz [2012-04-04 21:46:57 -0400]: On 12-04-04 5:15 PM, Sam Steingold wrote: * Duncan Murdochzheqbpu.qha...@tznvy.pbz [2012-04-04 17:00:32 -0400]: There's no warning when you mask a function with a non-function at top level, and little need for one,

Re: [R] recover lost global function

2012-04-05 Thread MacQueen, Don
To expand on Duncan's answer, you haven't replaced it. The following should make that clear: ## starting in a fresh session c function (..., recursive = FALSE) .Primitive(c) find('c') [1] package:base c - 1 find('c') [1] .GlobalEnv package:base c [1] 1 rm(c) find('c') [1] package:base

Re: [R] Apply function to every 'nth' element of a vector

2012-04-05 Thread Michael Bach
Thank you very much for your comments Ista and David! I will experiment and see which one serves my needs best. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] Sum of sd between matrix cols vs spearman correlation between them

2012-04-05 Thread ali_protocol
Hi all, I have a matrix (n*2), I want to compare 2 operators (2 normalization for array results) on these matrix. The 2 columns should ideally become the same after operations (normalization). So to compare operations, I do this for each normalization: s= sum (apply (normalized.matrix,

Re: [R] Subscript Error

2012-04-05 Thread z2.0
Thanks to you both. Calling recover (an option hitherto unknown to me) helped me identify the problem. For the record, the error occurred in the geom_path() line, not the list concatenation, as I had previously thought. It was a logic problem: when typeof == NULL the function jumped, but i

Re: [R] recover lost global function

2012-04-05 Thread luke-tierney
The compiler doesn't currently look beyond the first definition found (the generated code does the right thing, but the compiler won't optimize calls to functions masked by non-functions). I'll look into whether thechecking can be made to take this into account; it may be more trouble than it is

[R] help in match.fun

2012-04-05 Thread arunkumar1111
hi I have a dataframe and a parameter the parameter can have any one value min max mean sum hist i'm using the function match.fun fun=match.fun(input) fun(dataset) but if input is hist the plot pops up. is there any method to avoid it. else should use only if condition for histogram

Re: [R] help in match.fun

2012-04-05 Thread Sarah Goslee
Adding plot=FALSE to the hist() call will prevent it from being plotted. On Thu, Apr 5, 2012 at 10:52 AM, arunkumar akpbond...@gmail.com wrote: hi I have a dataframe and  a parameter the parameter can have any one value min max mean sum hist i'm using the function  match.fun  

Re: [R] recover lost global function

2012-04-05 Thread Sam Steingold
* yhxr-gvre...@hvbjn.rqh [2012-04-05 09:58:24 -0500]: I'll look into whether thechecking can be made to take this into account; it may be more trouble than it is worth though. Just to clarify: it would be nice if R noticed stupid mistakes like overriding functions in packages from the

[R] Best way to search r- functions and mailing list?

2012-04-05 Thread Jonathan Greenberg
R-helpers: It looks like http://finzi.psych.upenn.edu/search.html has stopped spidering the mailing lists -- this used to be my go-to site for searching for R solutions. Are there any good replacements for this? I want to be able to search both functions and mailing lists at the same time.

Re: [R] Imputing missing values using LSmeans (i.e., population marginal means) - advice in R?

2012-04-05 Thread Liaw, Andy
Don't know how you searched, but perhaps this might help: https://stat.ethz.ch/pipermail/r-help/2007-March/128064.html -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Jenn Barrett Sent: Tuesday, April 03, 2012 1:23 AM To:

Re: [R] unable to move temporary installation

2012-04-05 Thread Uwe Ligges
On 05.04.2012 17:40, Drew Tyre wrote: A final, final followup. Uwe, your suggestion is spot on - disabling the virus scanner fixes the problem. UNL recently changed virus scanning software, so this issue arose with Windows XP and Symantec Endpoint Protection. It can be readily disabled and

[R] ggplot2 error: arguments imply differing number of rows

2012-04-05 Thread Debbie Smith
This example is from The R Book by Michael J. Crawley. d=read.table( http://www.bio.ic.ac.uk/research/mjcraw/therbook/data/diminish.txt; ,header=TRUE) p=qplot(xv,yv,data=d); p m1=lm(yv~xv,data=d) p1=p + geom_abline(intercept=coefficients(m1)[1], slope=coefficients(m1)[2] ); p1 m2=lm(yv~xv +

Re: [R] unable to move temporary installation

2012-04-05 Thread Drew Tyre
A final, final followup. Uwe, your suggestion is spot on - disabling the virus scanner fixes the problem. UNL recently changed virus scanning software, so this issue arose with Windows XP and Symantec Endpoint Protection. It can be readily disabled and reenabled from the system tray, so not too

Re: [R] reclaiming lost memory in R

2012-04-05 Thread Drew Tyre
Ramiro I think the problem is the loop - R doesn't release memory allocated inside an expression until the expression completes. A for loop is an expression, so it duplicates fit and dataset on every iteration. An alternative approach that I have found successful in similar circumstances is to

Re: [R] Best way to search r- functions and mailing list?

2012-04-05 Thread R. Michael Weylandt
http://www.rseek.org/ perhaps. [Take a look at the tabs on the RHS after you do a search] Michael On Thu, Apr 5, 2012 at 11:36 AM, Jonathan Greenberg j...@illinois.edu wrote: R-helpers: It looks like http://finzi.psych.upenn.edu/search.html has stopped spidering the mailing lists -- this

Re: [R] Fisher's LSD multiple comparisons in a two-way ANOVA

2012-04-05 Thread Mendiburu, Felipe (CIP)
Dear Richard and Jinsong, Others output with library agricolae. See manual. ## library(agricolae) comp1 - LSD.test(x.aov,a, group=FALSE) comp2 - LSD.test(x.aov,b, group=TRUE) # interaction ab # Tukey's test comp3 - HSD.test(xi.aov,ab) # graphics par(mfrow=c(2,2)) bar.err(comp1,ylim=c(0,100),

Re: [R] API Baddperiods in RBloomberg

2012-04-05 Thread Prof Brian Ripley
On 05/04/2012 08:54, arvanitis.christos wrote: Hi to all, Do you know how I can use Baddperiods from RBloomberg Most of us cannot even use 'RBloomberg': it has been removed at the request of Bloomberg's lawyers. -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of

Re: [R] Rgui maintains open file handles after Sweave error

2012-04-05 Thread Duncan Murdoch
On 04/04/2012 3:25 PM, Alexander Shenkin wrote: Hello Folks, When I run the document below through sweave, rgui.exe/rsession.exe leaves a file handle open to the sweave-001.pdf graphic (as verified by process explorer). Pdflatex.exe then crashes (with a Permission Denied error) because the

Re: [R] Rgui maintains open file handles after Sweave error

2012-04-05 Thread Alexander Shenkin
Thanks for the nice ideas, Duncan. I think that would work nicely in most cases. The major issue with that workflow in my case is that the scripts to set up my workspace take around a half-hour to run (I really wish CUDA was working with my setup!), so running R each time in that case is

Re: [R] Best way to search r- functions and mailing list?

2012-04-05 Thread Kevin Wright
Use rseek.org On Thu, Apr 5, 2012 at 10:36 AM, Jonathan Greenberg j...@illinois.eduwrote: R-helpers: It looks like http://finzi.psych.upenn.edu/search.html has stopped spidering the mailing lists -- this used to be my go-to site for searching for R solutions. Are there any good

Re: [R] Best way to search r- functions and mailing list?

2012-04-05 Thread Sarah Goslee
I usually use http://www.rseek.org On Thu, Apr 5, 2012 at 11:36 AM, Jonathan Greenberg j...@illinois.edu wrote: R-helpers: It looks like http://finzi.psych.upenn.edu/search.html has stopped spidering the mailing lists -- this used to be my go-to site for searching for R solutions.  Are there

Re: [R] Sum of sd between matrix cols vs spearman correlation between them

2012-04-05 Thread Petr Savicky
On Thu, Apr 05, 2012 at 07:46:52AM -0700, ali_protocol wrote: Hi all, I have a matrix (n*2), I want to compare 2 operators (2 normalization for array results) on these matrix. The 2 columns should ideally become the same after operations (normalization). So to compare operations, I do

Re: [R] How to find best parameter values using deSolve n optim() ?

2012-04-05 Thread mhimanshu
Hi Thomas, Thank you so much for your suggestion. I tried your code and it is working fine. Now when I change the values of Y in yobs I am getting so many warnings. say, yobs - data.frame( time = 0:7, Y = c(0.00, 3.40, 4.60 ,5.80, 5.80, 6.00, 6.00 ), Z = c(0.1, 0.11, 0.119, 0.128, 0.136,

[R] how to do piecewise linear regression in R?

2012-04-05 Thread MANI
Dear all, I want to do piecewise CAPM linear regression in R: RRiskArb−Rf = (1−δ)[αMktLow+βMktLow(RMkt−Rf)] + δ[αMkt High +βMkt High(RMkt −Rf )] where δ is a dummy variable if the excess return on the value-weighted CRSP index is above a threshold level and zero otherwise.

Re: [R] random sample from list

2012-04-05 Thread Rui Barradas
Hello, #Here is how I have tried to sample but it is not sampling from the right part of the list bg- z_nonna[sample(1:length(z_nonna), 5000, replace=FALSE)] You are sampling from the length of z_nonna, with no guarantee that they are indices to unique list elements. Try this. # First,

Re: [R] random sample from list

2012-04-05 Thread David Winsemius
On Apr 5, 2012, at 12:00 AM, Daisy Englert Duursma wrote: random selection of cells in raster based on distance from xy locations Hi, I am trying to sample a raster for random cells that occur within a specific distance of point locations. I have successfully found multiple ways of

Re: [R] Best way to search r- functions and mailing list?

2012-04-05 Thread Spencer Graves
The sos package is designed to search help pages only and sort the results by package. It includes a vignette describing how to get the results as an Excel file giving an efficient summary of which packages contain help pages of interest including the latest date updated, etc. I designed the

Re: [R] ggplot2 error: arguments imply differing number of rows

2012-04-05 Thread ux.seo
As you got the error message, to use ggplot function, you had better make a data.frame with your data d. for example, d[ n x p], n : observations, p : variables n = dim(d) dd = data.frame(x=d[,2:n[2]], y=d[,1]) then, you may get the better result after apply dd to the ggplot function. p1 +

Re: [R] Best way to search r- functions and mailing list?

2012-04-05 Thread Sarah Goslee
sos is a great way to search help pages, agreed. But the question is about functions AND mailing list archives, which requires an online solution. (See subject line.) Sarah On Thu, Apr 5, 2012 at 12:56 PM, Spencer Graves spencer.gra...@prodsyse.com wrote: The sos package is designed to search

Re: [R] Rgui maintains open file handles after Sweave error

2012-04-05 Thread Yihui Xie
In terms of editors, I think RStudio is pretty good (http://www.rstudio.org/download/preview). Or LyX (http://yihui.name/knitr/demo/lyx/), or TeXmaker, WinEdit (http://yihui.name/knitr/demo/editors/)... All of them start a new R session when weaving the document, and all support one-click

[R] Multi part problem...array manipulation and sampling

2012-04-05 Thread Bcampbell99
Ok, I have a new, multipart problem that I need help figuring out. Part 1. I have a three dimensional array (species, sites, repeat counts within sites). Sampling effort per site varies so the array should be ragged. Maximum number of visits at any site = 22 Number of species = 161 Number of

Re: [R] Rgui maintains open file handles after Sweave error

2012-04-05 Thread Alexander Shenkin
Yep, I'm using RStudio, and have used Tinn-R in the past. RStudio does start a new R session when processing a sweave document via the RStudio GUI. In my case, this presented a problem for the reasons I stated before (i.e. that I need to run sweave in the main environment, not a new one).

Re: [R] Best way to search r- functions and mailing list?

2012-04-05 Thread Spencer Graves
Hi, Sarah: You were correct: I failed to read the question with sufficient care. Thanks for your original reply and for the correction. Spencer On 4/5/2012 10:11 AM, Sarah Goslee wrote: sos is a great way to search help pages, agreed. But the question is about functions AND mailing list

Re: [R] Rgui maintains open file handles after Sweave error

2012-04-05 Thread Yihui Xie
Well, I do not think it is a good practice (in terms of reproducible research) to keep on running Sweave in the same R session, because your previous run and your current workspace could pollute your next run. To make sure a document compiles on its own, it is better always to start a new clean R

Re: [R] Rgui maintains open file handles after Sweave error

2012-04-05 Thread Alexander Shenkin
Reproducibility is important, and as I mentioned in a previous email, there are probably ways I could avoid running the entire script over and over again with each sweave compilation. Still, relying on saved workspaces, temporary files or caches still has some of the issues that working in the

[R] too large for hashing

2012-04-05 Thread Adam D. I. Kramer
Hello, I'm doing some analysis on a rather large data set. In this case, some simple commands are failing. For example, this one: x$eventtype - factor(x$eventtype) Error in unique.default(x) : length 1093574297 is too large for hashing ...I think this is a bug, because hashing should

Re: [R] Rgui maintains open file handles after Sweave error

2012-04-05 Thread Yihui Xie
Things are not that gory with knitr. You only need to use the option cache=TRUE and it will take care of most of the things you mentioned. For example, objects in a chunk are automatically saved and lazy loaded; when code is modified, old cache will be automatically removed and new cache will be

Re: [R] too large for hashing

2012-04-05 Thread Duncan Murdoch
On 05/04/2012 2:03 PM, Adam D. I. Kramer wrote: Hello, I'm doing some analysis on a rather large data set. In this case, some simple commands are failing. For example, this one: x$eventtype- factor(x$eventtype) Error in unique.default(x) : length 1093574297 is too large for hashing

Re: [R] API Baddperiods in RBloomberg

2012-04-05 Thread John Laing
The binaries for RBloomberg are hosted on findata.org. The package is only useful in combination with a Bloomberg terminal, but users who have access to one should not be deterred by its absence from CRAN. John On Thu, Apr 5, 2012 at 12:18 PM, Prof Brian Ripley rip...@stats.ox.ac.uk wrote: On

Re: [R] Problem with NA data when computing standard error

2012-04-05 Thread apcoble
I found a rather easy solution that circumvents this problem by: 1) creating your own length function using na.omit function 2) calculating variance using tapply 3) calculating length using new length function 4) calculating square root of variance by length *Code from LeCzar:*

[R] Normalizing linear regression slope to intercept

2012-04-05 Thread Adam Harding
I am wondering if it possible to normalize the slope of a linear regression to its intercept to allow for valid between-group comparisons. Here is the scenario: I need to compare the slopes of biomass increase among NAFO divisions of Northwest Atlantic cod. However, the initial division

Re: [R] too large for hashing

2012-04-05 Thread Adam D. I. Kramer
Thanks for your response, Duncan. x$eventtype is a character vector (because the same hashing error occurred when I tried to read.table() in the first place specifying colClasses = c(..., factor, ...). x really is that long: dim(x) [1] 1093574297 12 ...the x$eventtype field has

[R] A kind of set operation in R

2012-04-05 Thread Julio Sergio
I have an ordered set of numbers, represented by a vector, say X - c(10:13, 17,18) X [1] 10 11 12 13 17 18 then I have a sub-set of X, say Y - c(11,12,17,18) Is there a simple way in R to have a logical vector (parallel to X) indicating what elements of X are in Y, i.e.,

Re: [R] A kind of set operation in R

2012-04-05 Thread Richard M. Heiberger
At least two ways (!is.na(match(X, Y))) [1] FALSE TRUE TRUE FALSE TRUE TRUE X %in% Y [1] FALSE TRUE TRUE FALSE TRUE TRUE On Thu, Apr 5, 2012 at 3:32 PM, Julio Sergio julioser...@gmail.com wrote: I have an ordered set of numbers, represented by a vector, say X - c(10:13, 17,18)

[R] indexing data.frame columns

2012-04-05 Thread Peter Meilstrup
Consider the data.frame: df - data.frame(A = c(1,4,2,6,7,3,6), B= c(3,7,2,7,3,5,4), C = c(2,7,5,2,7,4,5), index = c(A,B,A,C,B,B,C)) I want to select the column specified in 'index' for every row of 'df', to get goal - c(1, 7, 2, 2, 3, 5, 5) This sounds a lot like the indexing-by-a-matrix you

Re: [R] Difference in Kaplan-Meier estimates plus CI

2012-04-05 Thread array chip
Hi, I have the same question as Jason on how to estimate the standard error and construct CI around S_1(t) - S_2(t). From summary.survfit(obj), how can I combine the 2 survival estimates and the associated standard errors, to get an estimate of standard error for the difference / then calculate

Re: [R] A kind of set operation in R

2012-04-05 Thread Julio Sergio
Richard M. Heiberger rmh at temple.edu writes: At least two ways (!is.na(match(X, Y))) [1] FALSE TRUE TRUE FALSE TRUE TRUE X %in% Y [1] FALSE TRUE TRUE FALSE TRUE TRUE Thanks Richard! --Sergio. __ R-help@r-project.org mailing list

Re: [R] A kind of set operation in R

2012-04-05 Thread Berend Hasselman
On 05-04-2012, at 21:32, Julio Sergio wrote: I have an ordered set of numbers, represented by a vector, say X - c(10:13, 17,18) X [1] 10 11 12 13 17 18 then I have a sub-set of X, say Y - c(11,12,17,18) Is there a simple way in R to have a logical vector (parallel to X)

Re: [R] Histogram classwise

2012-04-05 Thread Greg Snow
You might want to look at the lattice or ggplot2 packages, both of which can create a graph for each of the classes. On Tue, Apr 3, 2012 at 6:20 AM, arunkumar akpbond...@gmail.com wrote: Hi I have a data class wise. I want to create a histogram class wise without using for loop as it takes

[R] Appropriate method for sharing data across functions

2012-04-05 Thread John C Nash
In trying to streamline various optimization functions, I would like to have a scratch pad of working data that is shared across a number of functions. These can be called from different levels within some wrapper functions for maximum likelihood and other such computations. I'm sure there are

Re: [R] Appropriate method for sharing data across functions

2012-04-05 Thread Hadley Wickham
Why not pass around a reference class? Hadley On Thu, Apr 5, 2012 at 3:20 PM, John C Nash nas...@uottawa.ca wrote: In trying to streamline various optimization functions, I would like to have a scratch pad of working data that is shared across a number of functions. These can be called from

[R] producing vignettes

2012-04-05 Thread Erin Hodgess
Hi R People: What is the best way to learn how to produce vignettes, please? Any help much appreciated. Thanks, Erin -- Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: erinm.hodg...@gmail.com

Re: [R] identify with mfcol=c(1,2)

2012-04-05 Thread Greg Snow
I tried your code, first I removed the reference to the global variable data$Line, then it works if I finish identifying by either right clicking (I am in windows) and choosing stop, or using the stop menu. It does as you say if I press escape or use the stop sign button (both stop the whole

Re: [R] indexing data.frame columns

2012-04-05 Thread ilai
On Thu, Apr 5, 2012 at 1:40 PM, Peter Meilstrup peter.meilst...@gmail.com wrote: Consider the data.frame: df - data.frame(A = c(1,4,2,6,7,3,6), B= c(3,7,2,7,3,5,4), C = c(2,7,5,2,7,4,5), index = c(A,B,A,C,B,B,C)) I want to select the column specified in 'index' for every row of 'df', to get

Re: [R] indexing data.frame columns

2012-04-05 Thread Milan Bouchet-Valat
Le jeudi 05 avril 2012 à 12:40 -0700, Peter Meilstrup a écrit : Consider the data.frame: df - data.frame(A = c(1,4,2,6,7,3,6), B= c(3,7,2,7,3,5,4), C = c(2,7,5,2,7,4,5), index = c(A,B,A,C,B,B,C)) I want to select the column specified in 'index' for every row of 'df', to get goal - c(1,

Re: [R] meaning of sigma from LM, is it the same as RMSE

2012-04-05 Thread Greg Snow
If you look at the code for summary.lm the line for the value of sigma is: ans$sigma - sqrt(resvar) and above that we can see that resvar is defined as: resvar - rss/rdf If that is not sufficient you can find how rss and rdf are computed in the code as well. On Tue, Apr 3, 2012 at 8:56 AM,

Re: [R] producing vignettes

2012-04-05 Thread R. Michael Weylandt
Probably to pull down the source of one and study it directly: if you already know LaTeX and R, Sweave isn't much more to master: zoo does vignettes nicely, but any package with vignettes should be pretty good. Michael On Thu, Apr 5, 2012 at 4:33 PM, Erin Hodgess erinm.hodg...@gmail.com wrote:

Re: [R] How does predict.loess work?

2012-04-05 Thread Greg Snow
Run the examples for the loess.demo function in the TeachingDemos package to get a better understanding of what goes into the loess predictions. On Tue, Apr 3, 2012 at 2:12 PM, Recher She rrrecher@gmail.com wrote: Dear R community, I am trying to understand how the predict function,

  1   2   >