Re: [R] Subsets of a function

2014-05-20 Thread ONKELINX, Thierry
Another option is the plyr package. library(plyr) result <- dlply(size, ~ Year +Season, function(.sub){ with(.sub, smooth.spline(Size, Prop, spar = 0.25)) } ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteits

Re: [R] Second axis on bottom of graph

2014-05-20 Thread Hurr
How can I: 1) make ticks shorter or longer 2) make ticks cross the axis line 3) make ticks project toward the plot 4) make grid lines 5) make perpendicular labels be close to the axis near ticks projecting away from the plot -- View this message in context: http://r.789695.n4.nabbl

[R] Documenting docType data

2014-05-20 Thread Witold E Wolski
Hi, I am Trying to document data using roxygen2 by following the stackoverflow question: http://stackoverflow.com/questions/9561684/documenting-dataset-with-roxygen2 And although my data resigin in mypackage/data has extension .rda and .csv I am getting the same error as in the stackoverlfow is

[R] Variance of predictions from lme4 models at existing levels?

2014-05-20 Thread Julien Riou
Dear contributors, I know that this has been widely discussed, but even after having read many discussions on this matter, I'm still not sure if I'm understanding properly. So I have a dataset of studies reporting prevalence in several settings, here is an exemple: data<-data.frame(id_study=c("U

[R] \ escape sequence and windows path

2014-05-20 Thread Knut Krueger
Is there any function to change the windows path to linux path? especially I would like to have the possibility to use f.e path="C:\foo1\foo2\" I can import those paths with path = readline() but not directly in a script Regards Knut __ R-help@r-pro

Re: [R] How to include static PDFs vignettes in an R package

2014-05-20 Thread Duncan Murdoch
On 20/05/2014, 2:51 AM, Luca Scrucca wrote: Hi all, prior to R version 3.0 I used to include a static PDF file as package vignette following the instructions in http://www.icesi.edu.co/CRAN/web/packages/R.rsp/vignettes/NonSweaveVignettes.pdf (I know this is a little bit old), except that the

Re: [R] Spatial Quantile Regression: Extracting residuals

2014-05-20 Thread Roger Bivand
Marie-Line GLAESENER uni.lu> writes: > > Dear R users, > > Could anyone tell me if there is a way to obtain the residuals from a model fitted by > > qregspiv(y ~ x,wmat=wmat,inst=NULL,tau=.5,rhomat = seq(-1,1,.01),printsariv=T,silent=F, nboot=300,data=) > > in McSpatial, using the Chernozh

Re: [R] \ escape sequence and windows path

2014-05-20 Thread peter dalgaard
On 20 May 2014, at 12:37 , Knut Krueger wrote: > > Is there any function to change the windows path to linux path? > > especially I would like to have the possibility to use > f.e > path="C:\foo1\foo2\" > I can import those paths with > path = readline() but not directly in a script > In R

Re: [R] Documenting docType data

2014-05-20 Thread Hadley Wickham
Don't export the dataset? (as mentioned in the answer to that question). If that doesn't help, please supply a minimal reproducible example. Hadley On Tue, May 20, 2014 at 3:35 AM, Witold E Wolski wrote: > Hi, > > I am Trying to document data using roxygen2 by following the > stackoverflow quest

Re: [R] Boxplots

2014-05-20 Thread Shane Carey
Thanks On Tue, May 20, 2014 at 2:21 AM, William Dunlap wrote: > Another method uses the core boxplot() function but replaces the usual > call to split() with a variant that puts all the data at the end of > the list of splits: > > > splitPlusAll <- function(x, ...) c(split(x, ...), list(All=x))

Re: [R] \ escape sequence and windows path

2014-05-20 Thread Jeff Newmiller
Most importantly, "\\" is a string literal containing ONE backslash character. Yes you can create strings in R source code that represent Windows-style paths, but they must APPEAR different in that context. You may find it helpful to know that the print function can output escaped strings suitab

[R] cumulative frequency distribution combined with histogram in one plot at two different scales

2014-05-20 Thread Shane Carey
Hi, I amtrying to plot a cfd with a histogram on one plot. The problem is the scale (y-axis) of the plots are hugely different and as a result the histogram plot is hard to read. Are there any examples of plots like this done in R: http://ej.iop.org/images/0952-4746/32/3/325/Full/jrp428239f9_onli

[R] logLik in betareg()

2014-05-20 Thread ChrisR
Hi everyone, I have estimated different models with the betareg() command from the package 'betareg' (3.0-4). When I started to compare them using likelihood ratio tests, it occured to me that the logLik() of the models increased with increasing number of parameters. I confirmed this observations

Re: [R] Second axis on bottom of graph

2014-05-20 Thread Hurr
I had asked How can I: 1) make ticks shorter or longer 2) make ticks cross the axis line 3) make ticks project toward the plot 4) make grid lines 5) make perpendicular labels be close to the axis near ticks projecting away from the plot I figured out that par(tck=..) solves three of the que

Re: [R] \ escape sequence and windows path

2014-05-20 Thread Knut Krueger
Am 20.05.2014 15:22, schrieb Jeff Newmiller: Most importantly, "\\" is a string literal containing ONE backslash character. Yes you can create strings in R source code that represent Windows-style paths, but they must APPEAR different in that context. You may find it helpful to know that the pr

Re: [R] \ escape sequence and windows path

2014-05-20 Thread David L Carlson
Annoying but easy. Would this work for you? y <- gsub("", "/", readline()) C:\foo1\foo2\ > y [1] "C:/foo1/foo2/" - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: r-help-boun..

Re: [R] \ escape sequence and windows path

2014-05-20 Thread Bert Gunter
On Tue, May 20, 2014 at 7:54 AM, Knut Krueger wrote: > Am 20.05.2014 15:22, schrieb Jeff Newmiller: >> >> Most importantly, "\\" is a string literal containing ONE backslash >> character. Yes you can create strings in R source code that represent >> Windows-style paths, but they must APPEAR differ

[R] Variation Inflation factor for GLS

2014-05-20 Thread Laura Riggi
Dear all, I am running a gls and I would like to check the vif of my model. It seems that the vif function in the car package and the vif.mer function available online do not work for gls. Would you know of a method to measure variance inflation factors for GLS? Thank you Laura [[alte

Re: [R] Using centers of hierarchical clustering for k-means

2014-05-20 Thread marioger
Thank you very much for your help. everything works great -- View this message in context: http://r.789695.n4.nabble.com/Using-centers-of-hierarchical-clustering-for-k-means-tp4690704p4690870.html Sent from the R help mailing list archive at Nabble.com.

[R] Fitting multiple nonlinear regression lines with nlrob()

2014-05-20 Thread jlabo...@huskers.unl.edu
Greetings R community, I would like to regress a nonlinear trend onto several subsets of data (representing different treatments) within a dataset. In my case, I would like to fit a nonlinear trend to several different "Tillage" treatments. model.global = nlrob(FinalBiomass ~ Wm[Tillage]*(1

[R] NppToR / RMySQL / loadNamespace() Error

2014-05-20 Thread Peter Meissner
Dear Listeners, I finally managed to install RMySQL on my Win7(64Bit) machine with R.3.1.0. Now, as long as I start R manually and load the package everything is working just fine: the package loads and I can connect to a database and query it. But, when NppToR does start the R session for me s

[R] Large matrices and pairs/ggpairs

2014-05-20 Thread Tim Richter-Heitmann
Hi there, i recently started to learn R to deal with a huge data matrix to deal with with ecological data (about 40 observations in 360 samples, divided in 7 groups of similar samples). I want to do a simple pairs or ggpairs: pairs(mydata, pch=20, col=brewer.pal(7, "Dark2")[unclass(all$group)]

Re: [R] Rprintf not updating

2014-05-20 Thread blosloos
Hi Could not make this example work, maybe because its missing *rPercentComplete pointing at percentComplete. The above mentioned link has been moved? to: https://gist.github.com/KRD1/2503984 however, this worked for me: *R side:* /pBar <- txtProgressBar( min = 0, max = 100, style = 3) blub<-.C

Re: [R] Second axis on bottom of graph

2014-05-20 Thread peter dalgaard
On 20 May 2014, at 16:34 , Hurr wrote: > I had asked How can I: > 1) make ticks shorter or longer > 2) make ticks cross the axis line > 3) make ticks project toward the plot > 4) make grid lines > 5) make perpendicular labels be > close to the axis near ticks > projecting away from the plot

Re: [R] Documenting docType data

2014-05-20 Thread Witold E Wolski
Thanks a lot. I still had an @export. On 20 May 2014 14:34, Hadley Wickham wrote: > Don't export the dataset? (as mentioned in the answer to that > question). If that doesn't help, please supply a minimal reproducible > example. > > Hadley > > On Tue, May 20, 2014 at 3:35 AM, Witold E Wolski wro

Re: [R] \ escape sequence and windows path

2014-05-20 Thread Knut Krueger
Am 20.05.2014 17:32, schrieb Bert Gunter: paste("a","b",sep="\\") ## "\\" is the escaped single backslash [1] "a\\b" cat(paste("a","b",sep="\\")) a\b Does this help clarify? Or have i misunderstood you? @David and @Bert unfortunately yes. My question is more a system level question as abo

Re: [R] Variation Inflation factor for GLS

2014-05-20 Thread John Fox
Dear Laura, There is no car::vif() method for gls objects, but the approach that car:::vif.lm() uses -- to compute VIFs (and generalized VIFs) from the correlation matrix of the coefficients -- should be applicable to models fit by gls(). I'll take a look a providing a vif.gls() method when I

[R] Subset, period of days like one after another in a group

2014-05-20 Thread Christoph Schlächter
Dear all, I have a subset of a data frame with 3 columns and a few rows. The columns are “date” [%Y %m %d], “mon” [%b] and “wea” for type of weather with “dw” dry weather “rw” rainy weather. Here it is as a list: structure(list(date = structure(c(15765, 15766, 15767, 15768,

Re: [R] Subset, period of days like one after another in a group

2014-05-20 Thread arun
Hi, #if 'dat` is the dataset May be this helps. lst1 <- setNames(split(dat, cumsum(c(TRUE,diff(dat$date)!=1))),LETTERS[1:4]) A.K. On Tuesday, May 20, 2014 12:17 PM, Christoph Schlächter wrote: Dear all, I have a subset of a data frame with 3 columns and a few rows. The columns are “date” [%

Re: [R] NppToR / RMySQL / loadNamespace() Error

2014-05-20 Thread Brian Ripley
We have no idea what NppToR Is. But as a guess you ran 64-bit R and it ran 32-bit or v.v. Why don't you ask NppToR's help service? The architecture of MySQL must match that of the R under which you installed RMySQL. > On 20 May 2014, at 15:08, Peter Meissner wrote: > > Dear Listeners, > >

Re: [R] \ escape sequence and windows path

2014-05-20 Thread David L Carlson
Now I understand. Not really a solution, but you can instruct students to use only forward slashes in their paths since R will convert to backslash on Windows systems automatically. After a couple of broken commands, they should get the hang of it. David C -Original Message- From: r-he

Re: [R] \ escape sequence and windows path

2014-05-20 Thread Duncan Murdoch
On 20/05/2014 12:04 PM, Knut Krueger wrote: Am 20.05.2014 17:32, schrieb Bert Gunter: >> paste("a","b",sep="\\") ## "\\" is the escaped single backslash > [1] "a\\b" >> cat(paste("a","b",sep="\\")) > a\b > > Does this help clarify? Or have i misunderstood you? @David and @Bert unfortunately ye

Re: [R] Subset, period of days like one after another in a group

2014-05-20 Thread arun
Hi, In your example the "wea", only showed "dw".  Suppose the data is like this: dat1 <- structure(list(date = structure(c(15765, 15766, 15767, 15768, 15769, 15770, 15771, 15772, 15773, 15780, 15781, 15782, 15788, 15789, 15790, 15791, 15792, 15795, 15796, 15797, 15798, 15799, 15800, 15801, 1

Re: [R] \ escape sequence and windows path

2014-05-20 Thread Bert Gunter
Duncan: "... If you want to solve the problem "I have a pathname in the clipboard, and want to put it in a string", it's not hard to write a function that essentially does readLines("clipboard")" Does not the Windows version R function readClipboard() do this already? -- Bert Bert Gunter G

Re: [R] dealing with missing values

2014-05-20 Thread arun
Hi, It is better to show the data using ?dput().  It is not clear whether your missing values are read as "" or NA in the dataset. Also, assuming that the function is from library(ade4) #1st case. NAs dat <-  structure(list(X = structure(c(1L, 1L, NA, NA, 2L, 2L), .Label = c("df", "rd"), class

Re: [R] \ escape sequence and windows path

2014-05-20 Thread Duncan Murdoch
On 20/05/2014 1:15 PM, Bert Gunter wrote: Duncan: "... If you want to solve the problem "I have a pathname in the clipboard, and want to put it in a string", it's not hard to write a function that essentially does readLines("clipboard")" Does not the Windows version R function readClipboard

Re: [R] Second axis on bottom of graph

2014-05-20 Thread Hurr
I was able to put tck=-0.1 into either par() or axis() and it made a tick difference I understood. As I understand it, default for mgp is c(3,1,0). When I put mgp=c(3,4,0) or mgp=c(3,7,0) into either par() or axis() I see no difference. Hurr -- View this message in context: http://r.789695.n

Re: [R] dealing with missing values

2014-05-20 Thread arun
Also, if the dataset is `dat1`  model.matrix(~X+Y,data=dat1)[,-1]   Xdf Xrd Yas Yeq 1   1   0   1   0 2   1   0   0   0 3   0   0   1   0 4   0   0   0   1 5   0   1   0   0 6   0   1   0   1 A.K. On Tuesday, May 20, 2014 1:32 PM, arun wrote: Hi, It is better to show the data using ?dput(). 

Re: [R] \ escape sequence and windows path

2014-05-20 Thread David L Carlson
That's the solution I was working on. Design the function (the foo() in your example) to read the clipboard so you do not need to paste anything. That greatly reduces how generally the function can be used since it will fail if there is not a path in the clipboard, but it solves (ameliorates?) t

Re: [R] Voronoi-Diagrams in R

2014-05-20 Thread Raphael Päbst
Thank you very much, this looks promising. I have a follow-up question however, probably due to my thickness when it comes to the underlying math. I am translating (as closely as possible) some code that has originally been written for Mathlab and uses the delaunay() function there. Now, if I und

[R] empty density plot for point pattern in spatstat

2014-05-20 Thread Christopher W Ryan
I'm running R-3.0.3 on Windows XP Professional on an institutional PC. (My freedom to update to a more recent version of R is limited, although I might be able to prevail upon the powers that be, if that would solve the problem.) I installed spatstat via install.packages() and received version 1.3

Re: [R] cumulative frequency distribution combined with histogram in one plot at two different scales

2014-05-20 Thread Adams, Jean
Shane, Do you have code to create each plot separately? If so, you can use par(new=TRUE) to overlay a second plot over the first with a different y-axis scale. See, for example, http://robjhyndman.com/hyndsight/r-graph-with-two-y-axes/ Jean On Tue, May 20, 2014 at 8:39 AM, Shane Carey wrote:

Re: [R] Voronoi-Diagrams in R

2014-05-20 Thread Boris Steipe
deldir() uses Lee and Schacter's algorithm, while the geometry package is a (partial) implementation of Barber et. al's Quickhull. Since both algorithms are correct, they should give the same results for the same data. How about you post a small input dataset and list the output that you need...

Re: [R] R save with encoding...

2014-05-20 Thread David Winsemius
On May 19, 2014, at 1:40 PM, Alexsandro Cândido de Oliveira Silva wrote: Hello everybody!! I'm trying to plot a graphic with the title: INTERVALS λ. But the special character λ can't be encoded using ISO8859-1. For future reference the reason this went unanaswered as long as it did is

Re: [R] Voronoi-Diagrams in R

2014-05-20 Thread Raphael Päbst
Thanks for the answer! I'll post a sample tomorrow, I have however found the following: triang.list() gives me the coordinates of the triangle's vertices, while delaunayn() gives me the indices of those coordinates. Thus it should be more or less simple to convert the output of deldir() into that

Re: [R] empty density plot for point pattern in spatstat

2014-05-20 Thread Adams, Jean
It works just fine for me ... using R-3.1.0 on Windows 7 and spatstat version 1.37-0. Jean On Tue, May 20, 2014 at 3:31 PM, Christopher W Ryan wrote: > I'm running R-3.0.3 on Windows XP Professional on an institutional PC. > (My freedom to update to a more recent version of R is limited, > alth

Re: [R] Second axis on bottom of graph

2014-05-20 Thread peter dalgaard
Hm? Try plot(0, mgp=c(3,2,0), las=2) On 20 May 2014, at 19:41 , Hurr wrote: > I was able to put tck=-0.1 into either par() or > axis() and it made a tick difference I understood. > As I understand it, default for mgp is c(3,1,0). > When I put mgp=c(3,4,0) or mgp=c(3,7,0) into > either par()

Re: [R] Voronoi-Diagrams in R

2014-05-20 Thread Rolf Turner
It sounds to me as though you are simply getting yourself flummoxed by the fact that the different packages produce their output in different formats. The information in the output will be the same (as Boris has indicated) --- it will just be arranged differently. Learn to interpret the ou

Re: [R] cumulative frequency distribution combined with histogram in one plot at two different scales

2014-05-20 Thread arun
Hi, May be you can try ?twoord.plot from library(plotrix) A.K. On Tuesday, May 20, 2014 9:41 AM, Shane Carey wrote: Hi, I amtrying to plot a cfd with a histogram on one plot. The problem is the scale (y-axis) of the plots are hugely different and as a result the histogram plot is hard to rea

[R] bootstrapping for maxium data

2014-05-20 Thread 张以春
Dear friends, I have a numeric vector composed of 320 numbers. Now, I want to do resample for 1 times. I want to get maxium number for every trial and get a 1 maxium numbers. I have tried to use "boot" package such as follows. results<-boot(data=nearshore1,statistic=max,R=1,st

[R] POSIXct: subtle difference in representation leads to error for "+"

2014-05-20 Thread Jens Scheidtmann
Dear all, I have had a "weird" problem in R 3.0.2: > x [1] "2006-03-14 12:48:01 CET" "2006-05-02 11:09:48 CEST" > str(x) POSIXct[1:2], format: "2006-03-14 12:48:01" "2006-05-02 11:09:48" > x + 6 Error in unclass(e1) + unclass(e2) : non-numeric argument to binary operator > as.POSIXct(x) + 6 E