Re: [R] Regression with factor having1 level

2016-03-10 Thread David Winsemius
> On Mar 10, 2016, at 5:45 PM, Nordlund, Dan (DSHS/RDA) > wrote: > >> -Original Message- >> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of David >> Winsemius >> Sent: Thursday, March 10, 2016 4:39 PM >> To: Robert McGehee >> Cc: r-help@r-project.org >> Subject: Re: [R]

Re: [R] Regression with factor having1 level

2016-03-10 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of David > Winsemius > Sent: Thursday, March 10, 2016 4:39 PM > To: Robert McGehee > Cc: r-help@r-project.org > Subject: Re: [R] Regression with factor having1 level > > > > On Mar 10, 2016, at 2:00 PM, Ro

Re: [R] Regression with factor having1 level

2016-03-10 Thread Robert McGehee
Here's an example for clarity: > 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) Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) : contrasts can be applied only to factors with 2 or more le

Re: [R] Regression with factor having1 level

2016-03-10 Thread David Winsemius
> On Mar 10, 2016, at 2:00 PM, Robert McGehee wrote: > > Hello R-helpers, > I'd like a function that given an arbitrary formula and a data frame > returns the residual of the dependent variable,and maintains all NA values. What does "maintains all NA values" actually mean? > > Here's an exampl

Re: [R] Error in make.names(col.names, unique = TRUE) : invalid multibyte string at '14 <4a>ULY 2012'

2016-03-10 Thread Dalthorp, Daniel
Hi Ken, Without seeing your .csv file or how you are trying to read it, it's tough to diagnose the trouble. I inserted commas between the columns in your data snippet, pasted into Excel, saved as .csv file called "datesfile.csv" in the R working directory. Then, the following worked fine for me: j

Re: [R] Regression with factor having1 level

2016-03-10 Thread Ben Bolker
Robert McGehee gmail.com> writes: > > Hello R-helpers, > I'd like a function that given an arbitrary formula and a data frame > returns the residual of the dependent variable, and maintains all > NA values. > > Here's an example that will give me what I want if my formula is y~x1+x2+x3 > and m

Re: [R] Prediction from a rank deficient fit may be misleading

2016-03-10 Thread David Winsemius
> On Mar 10, 2016, at 2:21 PM, Michael Artz wrote: > > Here is the results of the logistic regression model. Is it because of the > NA values? It's unclear. The InternetServiceNo (an other "No")-values could well be the cause. Many times questionnaires get encoded in a manner that causes comp

Re: [R] Prediction from a rank deficient fit may be misleading

2016-03-10 Thread Michael Artz
Here is the results of the logistic regression model. Is it because of the NA values? Call: glm(formula = TARGET_A ~ Contract + Dependents + DeviceProtection + gender + InternetService + MonthlyCharges + MultipleLines + OnlineBackup + OnlineSecurity + PaperlessBilling + Partner + Paym

Re: [R] extracting months from a data

2016-03-10 Thread KMNanus
Thanks for this. I wasn’t familiar with paste0, so I’ll call that and see if it works. Ken kmna...@gmail.com 914-450-0816 (tel) 347-730-4813 (fax) > On Mar 9, 2016, at 7:15 PM, Dalthorp, Daniel wrote: > > Or: > > x <- c( "3-Oct", "10-Nov" ) > format(as.Date(paste0(x,rep("-1970",length(x))

[R] Regression with factor having1 level

2016-03-10 Thread Robert McGehee
Hello R-helpers, I'd like a function that given an arbitrary formula and a data frame returns the residual of the dependent variable, and maintains all NA values. Here's an example that will give me what I want if my formula is y~x1+x2+x3 and my data frame is df: resid(lm(y~x1+x2+x3, data=df, na.

Re: [R] Conversion problem with write.csv and as.character()

2016-03-10 Thread Peter Neumaier
All fixed and solved in R-SIG-Finance. Thanks, Peter On Thu, Mar 10, 2016 at 3:25 PM, Sarah Goslee wrote: > Hi Peter, > > We really need a reproducible example to solve this kind of question. > Please use dput(head(yourdata)) to provide a sample of data (or make > up fake data that shows the sa

Re: [R] R related issue

2016-03-10 Thread Nordlund, Dan (DSHS/RDA)
You haven't provided sufficient information for people to help you. Please read the posting guide linked to at the bottom of this email. We need a reproducible example. You say you tried to discretize but it didn't work. What did you try (actual code please), and what error messages did you

[R] Error in make.names(col.names, unique = TRUE) : invalid multibyte string at '14 <4a>ULY 2012'

2016-03-10 Thread KMNanus
I’m trying to read in the data below from an Excel file (as a .csv file) in order to create an age (in years.%years) but am getting the error message in the subject line. I’ve tried saving the dates as dates in Excel and tried saving the dates as text, both give me the same error message. Can

Re: [R] Prediction from a rank deficient fit may be misleading

2016-03-10 Thread David Winsemius
> On Mar 10, 2016, at 8:08 AM, Michael Artz wrote: > > HI all, > I have the following error - >> resultVector <- predict(logitregressmodel, dataset1, type='response') > Warning message: > In predict.lm(object, newdata, se.fit, scale = 1, type = ifelse(type == : > prediction from a rank-deficie

Re: [R] Conversion problem with write.csv and as.character()

2016-03-10 Thread Jim Lemon
Hi Peter, Have you tried: a_fetchdata<-format(a_fetchdata,"%Y-%m-%d %H:%M:%S") before writing the data? Jim On Thu, Mar 10, 2016 at 10:14 PM, Peter Neumaier wrote: > Hi all, sorry for double/cross posting, I have sent an initial, similar > question > accidentally to r-sig-finance. > > I am wri

Re: [R] truncpareto() - doesn't like my data and odd error message

2016-03-10 Thread peter dalgaard
Actually, the issue is that the left hand side of the model formula should be the name of the variable under consideration. If you write y ~ 1 there had better be a "y", but without the renaming you could also have used H_to_fit.Height ~ 1. -pd > On 10 Mar 2016, at 19:03 , John Hillier wrote

Re: [R] How to avoid endless loop in shiny

2016-03-10 Thread Michael Peng
Hi Greg, Isolate may not solve the problem. For the following code. It runs only 1-2 times and stopped without isolate. If we update the slider with same value, it will not send a new message. library("shiny") ui <- fluidPage( titlePanel("Slider Test"), sidebarLayout( sidebarPanel(

Re: [R] CANNOT RUN ctree

2016-03-10 Thread Sarah Goslee
In general, you should probably update your R installation. In specific, you should install the missing package Formula, as the error message is telling you. On Thu, Mar 10, 2016 at 2:51 PM, CHIRIBOGA Xavier wrote: > Dear all, > Sorry for question again, but I am desesperating.. > I installed al

[R] CANNOT RUN ctree

2016-03-10 Thread CHIRIBOGA Xavier
Dear all, Sorry for question again, but I am desesperating.. I installed already "partykit" But there is stille a message (see below): the package "partykit" has been compiled with the version R3.1.3. What should I do now? I run my function and appears this: Error in loadNamespace(name) : there i

[R] R related issue

2016-03-10 Thread Santanu Mukherjee
Hi, I have R and MySQL at the backend. I have used dbGetQuery to get the rows I want and put it in a data.frame rs2. Now I want to use that data.frame to do market basket using apriori it is giving me errors Error in asMethod(object) : column(s) 1, 2 not logical or a factor. Discretize the columns

[R] Prediction from a rank deficient fit may be misleading

2016-03-10 Thread Michael Artz
HI all, I have the following error - > resultVector <- predict(logitregressmodel, dataset1, type='response') Warning message: In predict.lm(object, newdata, se.fit, scale = 1, type = ifelse(type == : prediction from a rank-deficient fit may be misleading I have seen on internet that there ma

Re: [R] truncpareto() - doesn't like my data and odd error message

2016-03-10 Thread John Hillier
Dear Peter, Thank you. Apolgies for not looking closer. It is the end of a long day. Fixed now, and I have learnt more about correctly interpreting R's manual pages. For the record Summary: If input to truncpareto() is not explicitly called 'y' it can produce error messages about the va

Re: [R] truncpareto() - doesn't like my data and odd error message

2016-03-10 Thread peter dalgaard
Look closer -pd > On 10 Mar 2016, at 18:41 , John Hillier wrote: > > Thank you Peter, > > Yes, it seems to do the same even if I simultaneously make that change. > Output below. > >> pdataH <- data.frame(y = H_to_fit$Height) >> summary(pdataH) > y > Min. :2000 > 1st Qu

Re: [R] truncpareto() - doesn't like my data and odd error message

2016-03-10 Thread John Hillier
Thank you Peter, Yes, it seems to do the same even if I simultaneously make that change. Output below. > pdataH <- data.frame(y = H_to_fit$Height) > summary(pdataH) y Min. :2000 1st Qu.:2281 Median :2666 Mean :2825 3rd Qu.:3212 Max. :4794 > fit3 <- vglm(y ~

Re: [R] FUNCTION ctree

2016-03-10 Thread Achim Zeileis
Thanks to Erich and Sarah for the clarifications. For those wondering whether ctree() from "party" or from "partykit" should be used: the latter is the newer and improved implementation. On Thu, 10 Mar 2016, Erich Neuwirth wrote: If you do ??ctree and the package partykit is installed, you wi

Re: [R] Navigation keys not working

2016-03-10 Thread Loris Bennett
Hi, Fazulur Rehaman writes: > Dear Sir/Madam, > > Navigation keys not working in R installed on linux (Linux version > 3.10.0-327.10.1.el7.x86_64). I am using R version 3.0.1. When I press > up arrow its giving "^[[A". Could you please suggest me how to > overcome this problem. > > Here is my R

Re: [R] Conversion problem with write.csv and as.character()

2016-03-10 Thread Joshua Ulrich
I already answered all your questions on R-SIG-Finance. On Thu, Mar 10, 2016 at 5:14 AM, Peter Neumaier wrote: > Hi all, sorry for double/cross posting, I have sent an initial, similar > question > accidentally to r-sig-finance. > > I am writing a matrix (typeof = double) into a CSV file with wri

Re: [R] Conversion problem with write.csv and as.character()

2016-03-10 Thread Sarah Goslee
Hi Peter, We really need a reproducible example to solve this kind of question. Please use dput(head(yourdata)) to provide a sample of data (or make up fake data that shows the same problems), and provide the code you're using. Sarah On Thu, Mar 10, 2016 at 6:14 AM, Peter Neumaier wrote: > Hi a

[R] Conversion problem with write.csv and as.character()

2016-03-10 Thread Peter Neumaier
Hi all, sorry for double/cross posting, I have sent an initial, similar question accidentally to r-sig-finance. I am writing a matrix (typeof = double) into a CSV file with write.csv. My first column of the matrix is a date in the form -mm-dd hh:mm:ss: > a_fetchdata[1,0] 2016-02-09 07:30:00

[R] Navigation keys not working

2016-03-10 Thread Fazulur Rehaman
Dear Sir/Madam, Navigation keys not working in R installed on linux (Linux version 3.10.0-327.10.1.el7.x86_64). I am using R version 3.0.1. When I press up arrow its giving "^[[A". Could you please suggest me how to overcome this problem. Here is my R session Info > sessionInfo() R version 3.

[R] [R-pkgs] rZeppelin: An R notebook that makes Spark easy to use

2016-03-10 Thread Amos B. Elberg
rZeppelin is an R interpreter for Apache (incubating) Zeppelin. Zeppelin is a notebook, sort of like iPython, built on top of Apache Spark. rZeppelin makes it possible, for the first time, to create a single data/ML pipeline that mixes R, scala, and Python code, seamlessly, from a single interfac

Re: [R] FUNCTION ctree

2016-03-10 Thread Erich Neuwirth
If you do ??ctree and the package partykit is installed, you will see that this function is defined in this package. So, you should run library(partykit) before running your function call If partykit is not installed, you need to install it. > On Mar 10, 2016, at 15:58, CHIRIBOGA Xavier wro

Re: [R] FUNCTION ctree

2016-03-10 Thread Sarah Goslee
Probably load the package that ctree() comes from, possibly party. library(party) The code you're looking at should tell you. On Thu, Mar 10, 2016 at 9:58 AM, CHIRIBOGA Xavier wrote: > Dear all, > > > I am using Rstudio. What to do when you get this message? > > Error in plot(ctree(Surv(hours,

[R] FUNCTION ctree

2016-03-10 Thread CHIRIBOGA Xavier
Dear all, I am using Rstudio. What to do when you get this message? Error in plot(ctree(Surv(hours, state) ~ soil + volatile, data = data)) : could not find function "ctree" Thank you, Xavier __ R-help@r-project.org mailing list -- To UNSUBSCRIBE

[R] Map of Europe at NUTS 2 Level

2016-03-10 Thread Miluji Sb
Dear all. I would like to draw a map of France, Italy, Spain, and Portugal at NUTS 2 level. I used the following code: library(“rgdal”) library(“RColorBrewer”) library(“classInt”) #library(“SmarterPoland”) library(fields) # Download Administrative Level data from EuroStat temp <- tempfile(fileex

[R] R 3.2.4 is released

2016-03-10 Thread Peter Dalgaard
The build system rolled up R-3.2.4.tar.gz (codename "Very Secure Dishes") this morning. The list below details the changes in this release. You can get the source code from http://cran.r-project.org/src/base/R-3/R-3.2.4.tar.gz or wait for it to be mirrored at a CRAN site nearer to you. Binar

Re: [R] truncpareto() - doesn't like my data and odd error message

2016-03-10 Thread peter dalgaard
Also if you simultaneously change the 2000 to say 1999? -p On 10 Mar 2016, at 09:22 , John Hillier wrote: > Thank you Peter, > > I believe this might be the way the error message is hard coded (i.e. it's > always y to describe the input). Anyway, I changed the first line to >> pdataH <- dat

Re: [R] .Call works in R 2 not in R 3

2016-03-10 Thread Sebastien Moretti
Hi Using cutree(tree$merge, k) fixed the problem. In fact had to use cutree(tree["merge"], k) Will compare results in R 2 and R 3 now. Thanks for your help. Sébastien cutree is a function available in stats. So it might be worth a try to just replace .Call("R_cutree", tree$merge, k, PACKA

Re: [R] Help -- feed data frames, returned from function into list --

2016-03-10 Thread Berend Hasselman
> On 10 Mar 2016, at 08:56, Sunny Singha > wrote: > > Hi, > I got a problem. Using loop, I'm trying to feed data frames, returned from > the function, into the list but not all data frames are getting captured. > > I have vector with some string values which I want to pass to the function. >

Re: [R] truncpareto() - doesn't like my data and odd error message

2016-03-10 Thread John Hillier
Thank you Peter, I believe this might be the way the error message is hard coded (i.e. it's always y to describe the input). Anyway, I changed the first line to > pdataH <- data.frame(y = H_to_fit$Height) This makes the input 'y' instead of 'H_to_fit.Height', but makes no difference to the out

[R] Survival analysis with interval censored data

2016-03-10 Thread Audrey Bologna
Hi! Does anyone know about survival analysis using interval censored data and the intcox package? I fed different ant colonies with different food (called treatment) and I measured every 2 days the death of ants. I would like to see if the treatment can explain a different death of individuals. S