Re: [R] Regression with factor having1 level

2016-03-11 Thread peter dalgaard
> On 11 Mar 2016, at 23:48 , David Winsemius wrote: > >> >> On Mar 11, 2016, at 2:07 PM, peter dalgaard wrote: >> >> >>> On 11 Mar 2016, at 17:56 , David Winsemius wrote: >>> On Mar 11, 2016, at 12:48 AM, peter dalgaard wrote: > On 11 Mar 2016, at 08:25 , David

Re: [R] Regression with factor having1 level

2016-03-11 Thread David Winsemius
> On Mar 11, 2016, at 2:07 PM, peter dalgaard wrote: > > >> On 11 Mar 2016, at 17:56 , David Winsemius wrote: >> >>> >>> On Mar 11, 2016, at 12:48 AM, peter dalgaard wrote: >>> >>> On 11 Mar 2016, at 08:25 , David Winsemius wrote: > >>> ... >> dfrm <- data.frame(y=rnorm(10)

Re: [R] Regression with factor having1 level

2016-03-11 Thread peter dalgaard
> On 11 Mar 2016, at 17:56 , David Winsemius wrote: > >> >> On Mar 11, 2016, at 12:48 AM, peter dalgaard wrote: >> >> >>> On 11 Mar 2016, at 08:25 , David Winsemius wrote: >> ... > dfrm <- data.frame(y=rnorm(10), x1=rnorm(10) ,x2=as.factor(TRUE), > x3=rnorm(10)) > lm(y~x1

Re: [R] treating integer(0) and NULL in conditions and loops

2016-03-11 Thread William Dunlap via R-help
I would suggesting using "" instead of NULL for rz, throughout this code. (I would also suggest making sure the code can be copied into R without causing a syntax error before posting the request for help.) Bill Dunlap TIBCO Software wdunlap tibco.com On Fri, Mar 11, 2016 at 9:10 AM, Adams, Jean

Re: [R] treating integer(0) and NULL in conditions and loops

2016-03-11 Thread Adams, Jean
To reframe the problem ... the issue is not with the function nchar() (or whatever), it's with the input value rz being null. I suggest you build into the loop whatever actions/outputs you want when rz is NULL. for (i in 1:10){ if (is.null(rz)) { # do something here } else { if (nchar

Re: [R] Regression with factor having1 level

2016-03-11 Thread David Winsemius
> On Mar 11, 2016, at 12:48 AM, peter dalgaard wrote: > > >> On 11 Mar 2016, at 08:25 , David Winsemius wrote: >>> > ... dfrm <- data.frame(y=rnorm(10), x1=rnorm(10) ,x2=as.factor(TRUE), x3=rnorm(10)) lm(y~x1+x2+x3, dfrm, na.action=na.exclude) >>> Error in `contrasts<-`(`*tmp*

Re: [R] Regression with factor having1 level

2016-03-11 Thread Robert McGehee
Hi, In case this is helpful for anyone, I think I've coded a satisfactory function answering my problem (of handling formulas containing 1-level factors) by hacking liberally at the model.matrix code to remove any model terms for which the contrast fails. As it's a problem I've come across a lot (s

Re: [R] Regression with factor having1 level

2016-03-11 Thread peter dalgaard
The one you cite must have been due to fat-fingering (send instead of delete), but there was a later followup to David, w/copy to r-help. -pd On 11 Mar 2016, at 16:03 , Robert McGehee wrote: > > PS, Peter, wasn't sure if you also meant to add comments, but they > didn't come through. > > -

Re: [R] Information to R-Project

2016-03-11 Thread Jeff Newmiller
Q4 is highly dependent on the types of problems that are to be addressed by the user. Large problems may need more RAM, disk space, or separate database facilities to support the problem at hand, but there is nothing about R itself that requires these optional support resources. OP should be wa

Re: [R] specify size of box around legend

2016-03-11 Thread Duncan Murdoch
On 11/03/2016 9:50 AM, Rainer M Krug wrote: Duncan Murdoch writes: > On 11/03/2016 9:01 AM, Rainer M Krug wrote: >> Hi >> >> assume the following code: >> >> --8<---cut here---start->8--- >> plot(1,1) >> legend(x="topleft", legend = LETTERS[1:10], title = "L

[R] treating integer(0) and NULL in conditions and loops

2016-03-11 Thread Jan Kacaba
Hello, I have following problem in loops. It occurred to me multiple times bellow is an example. Inside if() I have sometimes function f(x) which may return integer(0). If I test f(x)>1 and f(x)=integer(0) I get error. Maybe it can be solved more eloquently without loop or swithces. I don't know.

Re: [R] specify size of box around legend

2016-03-11 Thread Rainer M Krug
Duncan Murdoch writes: > On 11/03/2016 9:01 AM, Rainer M Krug wrote: >> Hi >> >> assume the following code: >> >> --8<---cut here---start->8--- >> plot(1,1) >> legend(x="topleft", legend = LETTERS[1:10], title = "L 1") >> legend(x="bottomleft", legend = paste(L

Re: [R] Information to R-Project

2016-03-11 Thread Boris Steipe
Inline On Mar 11, 2016, at 7:34 AM, Pees, Roman wrote: > Dear Support Team, > > Our company needs a new software for scientific statistics. > We have looked at your software " R Project” > > I would ask you to provide information on the following criteria: > > 1) Is the R-Procejt software term

[R] Information to R-Project

2016-03-11 Thread Pees, Roman
Dear Support Team, Our company needs a new software for scientific statistics. We have looked at your software " R Project” I would ask you to provide information on the following criteria: 1) Is the R-Procejt software terminal compatible? We have deployed Citrix. Are there any Server modules

Re: [R] specify size of box around legend

2016-03-11 Thread Duncan Murdoch
On 11/03/2016 9:01 AM, Rainer M Krug wrote: Hi assume the following code: --8<---cut here---start->8--- plot(1,1) legend(x="topleft", legend = LETTERS[1:10], title = "L 1") legend(x="bottomleft", legend = paste(LETTERS[1:10], letters[1:12],LETTERS[1:10]), tit

[R] specify size of box around legend

2016-03-11 Thread Rainer M Krug
Hi assume the following code: --8<---cut here---start->8--- plot(1,1) legend(x="topleft", legend = LETTERS[1:10], title = "L 1") legend(x="bottomleft", legend = paste(LETTERS[1:10], letters[1:12],LETTERS[1:10]), title = "L 2") legend(x="topright", legend = LET

Re: [R] package Formula????

2016-03-11 Thread Achim Zeileis
On Fri, 11 Mar 2016, CHIRIBOGA Xavier wrote: Dear all, again me I have already updated my version of R. But still appears this message: plot(ctree(Surv(hours,state)~soil+volatile, data=data)) Error in loadNamespace(name) : there is no package called 'Formula' I cannot find a package "Formu

[R] package Formula????

2016-03-11 Thread CHIRIBOGA Xavier
Dear all, again me I have already updated my version of R. But still appears this message: plot(ctree(Surv(hours,state)~soil+volatile, data=data)) Error in loadNamespace(name) : there is no package called 'Formula' I cannot find a package "Formula" in my list of packages. What to do in that

[R] Ipred Bagging Question

2016-03-11 Thread Majid Javanmard
Hello everyone here is the code that implements bagging using ipred package : library(ipred) library(mlbench) data("BostonHousing") # Test set error (nbagg=25, trees pruned): 3.41 (Breiman, 1996a, Table 8) mod <- bagging(medv ~ ., data=BostonHousing, coob=TRUE) print(mod) it`s output is just RMS

Re: [R] How to install package effects

2016-03-11 Thread Rainer M Krug
PIKAL Petr writes: > Hi > > Hm. Strange that you did not use any non-base package yet. True Small typo: > > install.pakages("effects") install.packages("effects") ^ > library(effects) > > shall do the trick. > > And if you are in installing, you could renew your R version which

Re: [R] Map of Europe at NUTS 2 Level

2016-03-11 Thread Roger Bivand
Miluji Sb gmail.com> writes: > > Dear all. > > I would like to draw a map of France, Italy, Spain, and Portugal at NUTS 2 > level. I used the following code: > ... > # Subset NUTS 2 level data > map_nuts2 <- subset(EU_NUTS, STAT_LEVL_ == 2) > > # Draw basic plot > plot(map_nuts2) country <-

Re: [R] How to install package effects

2016-03-11 Thread PIKAL Petr
Hi Hm. Strange that you did not use any non-base package yet. install.pakages("effects") library(effects) shall do the trick. And if you are in installing, you could renew your R version which is rather old. Cheers Petr > -Original Message- > From: R-help [mailto:r-help-boun...@r-pr

[R] How to install package effects

2016-03-11 Thread CHIRIBOGA Xavier
Dear all, How to install function effects in R 3.1.2.? I got this: plot(effect("soil:volatile", model1)) Error in plot(effect("soil:volatile", model1)) : could not find function "effect" Error in find.package(if (is.null(package)) loadedNamespaces() else package, : t

Re: [R] Regression with factor having1 level

2016-03-11 Thread peter dalgaard
> On 11 Mar 2016, at 02:03 , Robert McGehee wrote: > >> df <- data.frame(y=c(0,2,4,6,8), x1=c(1,1,2,2,NA), > x2=factor(c("A","A","A","A","B"))) >> resid(lm(y~x1+x2, data=df, na.action=na.exclude) -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3,

Re: [R] Regression with factor having1 level

2016-03-11 Thread peter dalgaard
> On 11 Mar 2016, at 08:25 , David Winsemius wrote: >> ... >>> dfrm <- data.frame(y=rnorm(10), x1=rnorm(10) ,x2=as.factor(TRUE), >>> x3=rnorm(10)) >>> lm(y~x1+x2+x3, dfrm, na.action=na.exclude) >> Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) : >> contrasts can be applied >