Re: [R] Overlaying two graphs using ggplot2 in R

2014-01-28 Thread ONKELINX, Thierry
Dear Kristi, You could do something like this. ggplot(dat1, aes(x = factor(site), y = Present)) + geom_boxplot(aes(colour = layer)) + geom_line(data = dat2, aes(group = 1, y = present)) + geom_point(data = dat2, aes(y = present)) Note that - ggplot provides no second axis - the boxplots

Re: [R] Arguments in functions when packaging

2014-01-28 Thread Duncan Murdoch
On 14-01-28 2:48 AM, Eva Prieto Castro wrote: Hi everybody, I have a doubt in relation with arguments in functions when packaging: Does it make sense the fact of having dots as an argument when it is the only argument?. I mean you have a package and a function that will be used directly by

Re: [R] How do you install cran mac binaries

2014-01-28 Thread ce
But in crran page it says mac binaries ? if I do install.library, it compiles the package. My old mac can't compile some packages. that's why I need to install binaries directly if possible. -Original Message- From: Henrik Bengtsson [h...@biostat.ucsf.edu] Date: 01/28/2014 12:30 AM To:

[R] augPred subsets

2014-01-28 Thread Vasco Cadavez
Hello, I'm using the nlme package to run non-linear mixed models! I would like to subset the plots obtained with the code: plot(augPred(Nlme0)) Any help is wellcome! Cheers, Vasco -- Vasco A. P. Cadavez, PhD Departamento de Ciência Animal Centro de Investigação de Montanha (CIMO) Escola

Re: [R] augPred subsets

2014-01-28 Thread PIKAL Petr
Hi can you be more specific? Your code gives an error without Nlme0 data. library(nlme) plot(augPred(Nlme0)) Error in augPred(Nlme0) : object 'Nlme0' not found If you want to use only some selection of panels in your plot, you probably need to dig into aug.Pred code and change it or make the

Re: [R] Predictor Importance in Random Forests and bootstrap

2014-01-28 Thread Dimitri Liakhovitski
Thank you, Bert. I'll definitely ask there. In the meantime I just wanted to ensure that my R code (my function for bootstrap and the bootstrap run) is correct and my abnormal bootstrap results are not a function of my erroneous code. Thank you! On Mon, Jan 27, 2014 at 7:09 PM, Bert Gunter

Re: [R] Markov chain simulation

2014-01-28 Thread Kehl Dániel
Hi, see inline Feladó: r-help-boun...@r-project.org [r-help-boun...@r-project.org] ; meghatalmaz#243;: Armel KAPTUE [armel.kap...@sdstate.edu] Küldve: 2014. január 28. 8:16 To: R-help@r-project.org Tárgy: [R] Markov chain simulation Hi there, I'm wonder

[R] ggplot different shapes and legend in one plot

2014-01-28 Thread PIKAL Petr
Dear all I have such data temp - structure(list(x = c(1.22640164371796, 2.06054252402081, 0.648406692116093, 0.502688462027622, 1.20971015442933, -1.33912870469085, 1.04053747125611, 1.08845105918041, 1.6409121019292, 0.596150765260052, 1.78013122654094, 0.4709422376346), y =

Re: [R] augPred subsets

2014-01-28 Thread Vasco Cadavez
Hello Pikal, I have 39 conditions (graphs) and I want to plot the 39 graphs individually! How can I do this? Cheers, Vasco On 28/01/14 13:47, PIKAL Petr wrote: Hi can you be more specific? Your code gives an error without Nlme0 data. library(nlme) plot(augPred(Nlme0)) Error in

[R] Publication-ready figures in R?

2014-01-28 Thread Bebber, Dan
I would like to make a plea for publication-ready figures from R. The default figures produced by R (both traditional and lattice graphics) need to be amended (by users) in many respects to be acceptable by publishers. I imagine that most R users are producing figures for publication, and it

[R] The R Series from Chapman Hall/CRC

2014-01-28 Thread Calver, Rob
Chapman Hall/CRC: The R Series The R Series from Chapman Hall/CRC has now been up and running for almost three years and is growing from strength to strength. We now have eight books published in the series, and more than twenty in development. This year looks set to be a big year for the

[R] John M. Chambers Statistical Software Award 2014

2014-01-28 Thread Munjal, Aarti
The Statistical Computing Section of the American Statistical Association announces the competition for the John M. Chambers Statistical Software Award. In 1998 the Association for Computing Machinery presented its Software System Award to John Chambers for the design and development of S. Dr.

Re: [R] Publication-ready figures in R?

2014-01-28 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 01/28/14, 12:12 , Bebber, Dan wrote: I would like to make a plea for publication-ready figures from R. The default figures produced by R (both traditional and lattice graphics) need to be amended (by users) in many respects to be

[R] Survival analysis

2014-01-28 Thread Endy BlackEndy
Dear R users, how I can implement Breslow and Tarone-Ware tests for survival analysis? Also, is there any way I can estimate and plot the hazard function,along the lines of the survival function in Survival Package? (The package muhaz seems that does not do what it promises, except if I could not

[R] Exporting aggregate summary

2014-01-28 Thread Laura Thomas
Hi All, I am trying to manipulate my data in R. I have used the following code [aggregate(latency~participant+condition+state, data=data, FUN=mean)] which produces a summary of the variable I am interested in. However, I need to export the crated variable into excel. Can anyone help with this

Re: [R] Publication-ready figures in R?

2014-01-28 Thread ONKELINX, Thierry
Dear Dan, Have a look at ggplot2. It allows to define themes. I've create two theme for our institution: one according our internal styling guide, one according to the styling guide for Elsevier journal. Applying the Elsevier theme to all plots in a script requires just adding

[R] Handling large SAS file in R

2014-01-28 Thread Dennis Fisher
Colleagues Frank Harrell wrote that “you need to purchase Stat/Transfer, which I did many years ago and continue to use. But I don’t understand why the sas7bdat package (or something equivalent) cannot reverse engineer the SAS procedures so that R users can read sas7bdat files as well as

Re: [R] Publication-ready figures in R?

2014-01-28 Thread S Ellison
labelling of figure parts with a, b, c etc. in the top left corner that should be easy to achieve in R. It is; use par(usr) to get the corners and text() to place labels inside the plot region, as in text(par(usr)[1], par(usr)[4], a), cex=1.5, adj=c(-0.2,1.2)) or something like mtext(a),

Re: [R] Handling large SAS file in R

2014-01-28 Thread Marc Schwartz
Dennis, The key difference is that with R, you are, as always, dependent upon volunteers providing software at no charge to you, most of whom have full time (and then some) jobs. Those jobs (and in many cases, family) will be their priority, as I am sure is the case with Matt. Unless they

Re: [R] Exporting aggregate summary

2014-01-28 Thread John Kane
Personally I just create a csv file using write.csv() and then read the text file into the spreadsheet if needed. To be fancier have a look at the xlsx package. BTW there is no 'state' variable in your data.frame. John Kane Kingston ON Canada -Original Message- From:

Re: [R] Three values that add to the same number by 0.01 steps

2014-01-28 Thread arun
Hi, May be this helps:  set.seed(85)  mat1 - matrix(sample(seq(0,1,by=0.01),36,replace=TRUE),ncol=3) mat2 - mat1[sprintf(%.2f,rowSums(mat1))==1.00,]  any(!rowSums(mat2)) #[1] FALSE A.K. Hi, I'd like to create a matrix with three columns so that each element is between 0 and 1 and each row

Re: [R] Three values that add to the same number by 0.01 steps

2014-01-28 Thread S Ellison
I'd like to create a matrix with three columns so that each element is between 0 and 1 and each row always adds to 1. So, if in the same row the You could start with expand.grid m - expand.grid(x1=0:100, x2=0:100) #Avoids comparing floats m - m[rowSums(m)=100,]#Throw away

Re: [R] How do you install cran mac binaries

2014-01-28 Thread Henrik Bengtsson
Whether a package is install from source or from an available binary is controlled by argument 'type', cf. ?install.packages. I believed that, just as on Windows, the default on OSX was to install from binaries, but I might be wrong, or you have changed the settings of the below option. So,

Re: [R] Markov chain simulation

2014-01-28 Thread Kaptue Tchuente, Armel
Hi Kehl, Thank you for your reply. Indeed, there are many ways to simulate a markov chain sequence. For instance, if I assume that n=20, rnd_occ1-c(0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1) and rnd_occ2-c(0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0) are two

[R] anova.coxph with subsets of data

2014-01-28 Thread Oscar Rueda
Dear list, I'm using the rms package to fit some Cox models. I run anova() on them to obtain sequential p-values, but I'm getting strange results when I run it on a subset of the data. Following the example on the help page of anova.coxph: library(rms) data(ovarian) fit -

Re: [R] Exporting aggregate summary

2014-01-28 Thread Rui Barradas
Hello, Your data.frame doesn't have a 'state' column: aggregate(latency~participant+condition+state, data=data, FUN=mean) Error in eval(expr, envir, enclos) : object 'state' not found Anyway, you can use ?write.csv to write the result to a csv file, and open it in excel, or use one of the R

Re: [R] Markov chain simulation

2014-01-28 Thread Berend Hasselman
On 28-01-2014, at 19:23, Kaptue Tchuente, Armel armel.kap...@sdstate.edu wrote: Hi Kehl, Thank you for your reply. Indeed, there are many ways to simulate a markov chain sequence. For instance, if I assume that n=20, rnd_occ1-c(0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1,

Re: [R] How do you install cran mac binaries

2014-01-28 Thread Marcus Nunes
ce, Did you try to use the menu Packages Data Package Installer, select CRAN (binaries) from the top left option in the open menu, search for the forecast package and then install it with the dependencies? I did this here and it worked for me. If it doesn't work, please run sessionInfo()

Re: [R] Publication-ready figures in R?

2014-01-28 Thread arun
Hi, May be this helps you in getting started: library(lattice) library(grid) xy -xyplot(decrease ~ treatment, OrchardSprays,     main= Some plot,     groups = rowpos, type = a,     scales=list(x=list(at=seq(1,8,1),labels=c('A','','C','','E','','G',''))),         page =

Re: [R] Three values that add to the same number by 0.01 steps

2014-01-28 Thread Richard Kwock
An alternative using runif. x - round(runif(1, 0, 1), 2) y - round(runif(1, 0, 1-x), 2) z - round(1-x-y, 2) sum1 - cbind(x, y, z) any(!(sum1[,1] + sum1[,2] + sum1[,3])) Richard On Tue, Jan 28, 2014 at 9:36 AM, S Ellison s.elli...@lgcgroup.com wrote: I'd like to create a matrix

[R] Help for how to use snowfall package

2014-01-28 Thread WANG, YINDING
Hi there, I have some question about how to use this package: My code structure is as follows: rm(list=ls()) set.seed(2014) library(snowfall) # #part 1: generate the initial value for simulation #part 2: some functions will be used in the simulation #simulation part, start from

[R] median survival

2014-01-28 Thread array chip
Hi, if 50% survival probability horizontal line in a Kaplan-Meier survival curve overlap one of the step line between 2 time points t1 and t2, the survfit() from survival package estimates median survival as t2 (the longest time point). But I saw some articles (page 23:

Re: [R] Handling large SAS file in R

2014-01-28 Thread Fisher Dennis
Marc I understand that R is staffed entirely by volunteers and I appreciate the massive efforts that have created this awesome software. My suggestion was aiming to encourage the Core team that one weakness of the present structure is less-than-optimal interchangeability with SAS. If this

Re: [R] passing variable names to dplyr - SOLVED

2014-01-28 Thread Bos, Roger
All, I asked over at the manipulatr group and Hadley showed me how to do it. In case anyone is interested I will post the solution here: target - hp call - substitute(mutate(mtcars, scale(target)), list(target = as.name(target))) eval(call) Thanks, Roger -Original Message- From:

Re: [R] Three values that add to the same number by 0.01 steps

2014-01-28 Thread arun
Also, library(gtools)  x - rdirichlet(1000, c(1,1,1) ) any(!rowSums(x)) #[1] FALSE A.K. On Tuesday, January 28, 2014 2:20 PM, Richard Kwock richardkw...@gmail.com wrote: An alternative using runif. x - round(runif(1, 0, 1), 2) y - round(runif(1, 0, 1-x), 2) z - round(1-x-y, 2) sum1

[R] Problem while plotting some plots

2014-01-28 Thread Baro
Hi experts I want to plot some plots with r in plot pane. At least two plots to six or more. I have this code to do this job, but in some positions the main plot gets lost: plot(datalistB, type=l) while(1+window+n = length(data[,1])) { datalistB-datalist[n:(n+window-1)]

[R] unique rows

2014-01-28 Thread array chip
Hi, I wanted to remove redundant rows (with same entry in columns) in a data frame. For example, with this data frame: dat-cbind(x=c('a','a','b','b','c','c'),y=c('x','x','d','s','g','g')) dat x   y  [1,] a x [2,] a x [3,] b d [4,] b s [5,] c g [6,] c g after removing the redundancy, the

Re: [R] unique rows

2014-01-28 Thread Bert Gunter
Inline. -- Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 Data is not information. Information is not knowledge. And knowledge is certainly not wisdom. H. Gilbert Welch On Tue, Jan 28, 2014 at 2:06 PM, array chip arrayprof...@yahoo.com wrote: Hi, I wanted to remove

Re: [R] unique rows

2014-01-28 Thread arun
Hi, use ?unique  unique(dat) A.K. Hi, I wanted to remove redundant rows (with same entry in columns) in a data frame. For example, with this data frame: dat-cbind(x=c('a','a','b','b','c','c'),y=c('x','x','d','s','g','g')) dat x   y  [1,] a x [2,] a x [3,] b d [4,] b s [5,] c g

Re: [R] Predictor Importance in Random Forests and bootstrap

2014-01-28 Thread Dimitri Liakhovitski
Here is a great response I got from SO: There is an important difference between the two importance measures: MeanDecreaseAccuracy is calculated using out of bag (OOB) data, MeanDecreaseGini is not. For each tree MeanDecreaseAccuracy is calculated on observations not used to form that particular

Re: [R] Predictor Importance in Random Forests and bootstrap

2014-01-28 Thread Max Kuhn
I think that the fundamental problem is that you are using the default value of ntree (500). You should always use at least 1500 and more if n or p are large. Also, this link will give you more up-to-date information on that package and feature selection:

Re: [R] passing variable names to dplyr

2014-01-28 Thread David Winsemius
On Jan 27, 2014, at 7:45 AM, Bos, Roger wrote: All, I would like to figure out how to pass variable names to the dplyr function mutate. For example, this works because hp is one of the variable names on mtcars: mutate(mtcars, scale(hp)) Let's says I want to pass in the target

Re: [R] passing variable names to dplyr

2014-01-28 Thread Dennis Murphy
David: I privately suggested he post to manipulatr because Hadley is more likely to see his question there first than in R-help. He originally posted here, noted the cross-posting and referral at manipulatr and responded back to this list when he got a successful reply from Hadley. I don't see

Re: [R] Numeric Column Labels in Excel Function

2014-01-28 Thread David Winsemius
On Jan 27, 2014, at 1:30 PM, Dustin Fife wrote: Hi all, I frequently get requests to do data analysis where the person references an excel column. e.g., I want to analyze [insert complex variable name], located at column AAQ in Excel. I've been doing is gsub and inserting a part of the

Re: [R] memory use of copies

2014-01-28 Thread Ross Boylan
Thank you for a very thorough analysis. It seems whether or not an operation makes a full copy really depends on the specific operation, and that it is not safe to assume that because I know something is unchanged there will be no copy. For example, in your last case only one element of a list

Re: [R] unique rows

2014-01-28 Thread array chip
sorry.. don't know unique().. such a great function From: Bert Gunter gunter.ber...@gene.com Cc: r-help@r-project.org r-help@r-project.org Sent: Tuesday, January 28, 2014 2:21 PM Subject: Re: [R] unique rows Inline. -- Bert Bert Gunter Genentech

Re: [R] Survival analysis

2014-01-28 Thread David Winsemius
On Jan 28, 2014, at 7:58 AM, Endy BlackEndy wrote: Dear R users, how I can implement Breslow and Tarone-Ware tests for survival analysis? Tests ... of what? Perhaps you should learn to search: install.packages('sos') library(sos) findFn(Tarone-Ware) The 'comp' function in {survMisc}

Re: [R] anova.coxph with subsets of data

2014-01-28 Thread David Winsemius
On Jan 28, 2014, at 10:32 AM, Oscar Rueda wrote: Dear list, I'm using the rms package to fit some Cox models. I run anova() on them to obtain sequential p-values, but I'm getting strange results when I run it on a subset of the data. Following the example on the help page of

Re: [R] passing variable names to dplyr

2014-01-28 Thread David Winsemius
On Jan 28, 2014, at 3:43 PM, Dennis Murphy wrote: David: I privately suggested he post to manipulatr because Hadley is more likely to see his question there first than in R-help. He originally posted here, noted the cross-posting and referral at manipulatr and responded back to this list

Re: [R] Survival analysis

2014-01-28 Thread David Winsemius
On Jan 28, 2014, at 4:19 PM, Dennis Murphy wrote: Hi David: Do you meant [sic] the (cumulative) hazard function that is 1 minus the survival function? Um, 1 - S(t) = F(t), the cumulative *distribution function* of the random variable T. The cumulative hazard function is -ln S(t) and

Re: [R] Numeric Column Labels in Excel Function

2014-01-28 Thread Gabor Grothendieck
On Tue, Jan 28, 2014 at 6:46 PM, David Winsemius dwinsem...@comcast.netwrote: On Jan 27, 2014, at 1:30 PM, Dustin Fife wrote: Hi all, I frequently get requests to do data analysis where the person references an excel column. e.g., I want to analyze [insert complex variable name],

Re: [R] Simplifying matrix computation

2014-01-28 Thread David Winsemius
On Jan 27, 2014, at 8:04 AM, Carlo Giovanni Camarda wrote: Dear R-users, I would like to know whether you know some trick for skipping some of the steps in the example below (especially the last step in a way that would make easier to be written succinctly in a text). I could try to

Re: [R] median survival

2014-01-28 Thread array chip
please ignore. actually the median survival from survfit() is the mean of the 2 time points. To: R help r-help@r-project.org Sent: Tuesday, January 28, 2014 11:27 AM Subject: [R] median survival Hi, if 50% survival probability horizontal line in a

[R] Diagnostic and helper functions for defective hard-to-import files

2014-01-28 Thread andrewH
Hi Folks! I have been writing a small set of utilities for dealing with files that are hard to open correctly for one reason or another, especially because they are too big for memory, non-rectangular, or contain odd characters or unexpected codings, or all of these things together. Today it

Re: [R] Diagnostic and helper functions for defective hard-to-import files

2014-01-28 Thread David Winsemius
On Jan 28, 2014, at 8:43 PM, andrewH wrote: Hi Folks! I have been writing a small set of utilities for dealing with files that are hard to open correctly for one reason or another, especially because they are too big for memory, non-rectangular, or contain odd characters or unexpected

[R] Difference between two datetimes

2014-01-28 Thread David Fox
I have a data frame with variable datetime which is of class POSIXct. Consecutive observations are separated by 30 minutes. However, some of the differences reported by R give unexpected results. For example consider the following two consecutive entries: par.dat$datetime[5944] [1] 2010-04-04

Re: [R] How do you install cran mac binaries

2014-01-28 Thread ce
Sorry how do access this menu? R-studio? I open an xterm and type R to start R. sessionInfo() R version 3.0.2 (2013-09-25) Platform: i386-apple-darwin9.8.0 (32-bit) locale: [1] C attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a

Re: [R] How do you install cran mac binaries

2014-01-28 Thread ce
Thank you for advise. I am using mac osx 10.5. 8. I am still having problems with install : install.packages(forecast,type=mac.binary.leopard) Warning: unable to access index for repository http://lib.stat.cmu.edu/R/CRAN/bin/macosx/leopard/contrib/3.0 package 'forecast' is available as a

Re: [R] Difference between two datetimes

2014-01-28 Thread Daniel Nordlund
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of David Fox Sent: Tuesday, January 28, 2014 5:15 PM To: r-help@r-project.org Subject: [R] Difference between two datetimes I have a data frame with variable datetime which is of

Re: [R] Diagnostic and helper functions for defective hard-to-import files

2014-01-28 Thread andrewH
On Jan 28, 2014 at 8:56pm, David Winsemius wrote: On Jan 28, 2014, at 8:43 PM, andrewH wrote: Hi Folks! I have been writing a small set of utilities for dealing with files that are hard to open correctly for one reason or another, especially because they are too big for memory,

[R] Convert txt file to time series and conduct trend and wavelet analyses

2014-01-28 Thread johnhammondplease
http://r.789695.n4.nabble.com/file/n4684362/Screen_Shot_2014-01-28_at_9.23.57_PM.png I have many .txt files all with the same format, one column for date (/mm/dd), another column for discharge (numerical values from 0.00 to 500.00), and two coulmns that I do not need. I am working in R. I