Re: [R] Assistance with httr package with R version 3.3.0

2016-05-09 Thread Jim Lemon
Hi Luca, The function readHTMLtable is in the XML package, not httr. Perhaps that is the problem as I don't see a dependency in httr for XML (although xml2 is suggested). Jim On Tue, May 10, 2016 at 2:58 PM, Luca Meyer wrote: > Hello, > > I am trying to run a code I have been using for a few ye

[R] Assistance with httr package with R version 3.3.0

2016-05-09 Thread Luca Meyer
Hello, I am trying to run a code I have been using for a few years now after downloading the new R version 3.3.0 and I get the following error: > rm(list=ls()) > library(httr) > > #carico i dati da Google spreadsheets > url <- " https://docs.google.com/spreadsheets/d/102-jJ7x1YfIe4Kkvb9olQ4chQ_TS

Re: [R] Problem while predicting in regression trees

2016-05-09 Thread Max Kuhn
I've brought this up numerous times... you shouldn't use `predict.rpart` (or whatever modeling function) from the `finalModel` object. That object has no idea what was done to the data prior to its invocation. The issue here is that `train(formula)` converts the factors to dummy variables. `rpart`

[R] ggplot scale_colour_distiller legend to display all values?

2016-05-09 Thread Mike Smith
Is there a way to get ggplot scale_colour_distiller to display all values in the legend? Currently using this code. thanks! mike library(ggplot2) #Input data: insert the filename for raw data data <- read.csv("http://www.lecturematerials.co.uk/data/learning_bands.csv",header=T) ggplot(data,

Re: [R] Problem while predicting in regression trees

2016-05-09 Thread Muhammad Bilal
Hi Bill, Many thanks for highlighting the issue. It worked as I predicted using the tr_m. I'm extremely grateful for the insight. Thanks for all who gave me prior guidance as well. -- Muhammad Bilal Research Fellow and Doctoral Researcher, Bristol Enterprise, Research, and Innovation Centre

Re: [R] Problem while predicting in regression trees

2016-05-09 Thread William Dunlap via R-help
Why are you predicting from tr_m$finalModel instead of from tr_m? Bill Dunlap TIBCO Software wdunlap tibco.com On Mon, May 9, 2016 at 11:46 AM, Muhammad Bilal < muhammad2.bi...@live.uwe.ac.uk> wrote: > Please find the sample dataset attached along with R code pasted below to > reproduce the issu

Re: [R] Problem while predicting in regression trees

2016-05-09 Thread Muhammad Bilal
The dataset could also be downloaded from the following link: https://www.dropbox.com/s/kkiwm32jxfk7jac/pfi_data.csv?dl=0 [https://cf.dropboxstatic.com/static/images/icons128/page_white_excel.png] pfi_data.csv

Re: [R] Problem while predicting in regression trees

2016-05-09 Thread Muhammad Bilal
Please find the sample dataset attached along with R code pasted below to reproduce the issue. #Loading the data frame pfi <- read.csv("pfi_data.csv") #Splitting the data into training and test sets split <- sample.split(pfi, SplitRatio = 0.7) trainPFI <- subset(pfi, split == TRUE) testPFI <-

Re: [R] Clean method to convert date and time between time zones keeping it in POSIXct format

2016-05-09 Thread MacQueen, Don
I think setting the attribute is the best way to "convert", and the following will hopefully explain why. (And I would tend to agree with William Dunlap that a function to set the attribute might help userRs.) R always stores POSIXct objects internally in seconds since an origin in UTC. I would

[R] Revolutions blog: April 2016 roundup

2016-05-09 Thread David Smith
Since 2008, Microsoft (formerly Revolution Analytics) staff and guests have written about R every weekday at the Revolutions blog: http://blog.revolutionanalytics.com and every month I post a summary of articles from the previous month of particular interest to readers of r-help. And in case you

Re: [R] Problem while predicting in regression trees

2016-05-09 Thread Max Kuhn
It is extremely difficult to tell what the issue might be without a reproducible example. The only thing that I can suggest is to use the non-formula interface to `train` so that you can avoid creating dummy variables. On Mon, May 9, 2016 at 11:23 AM, Muhammad Bilal < muhammad2.bi...@live.uwe.ac.

Re: [R] Problem while predicting in regression trees

2016-05-09 Thread Muhammad Bilal
Hi Bert, Thanks for the response. I checked the datasets, however, the Hospitals level appears in both of them. See the output below: > sqldf("SELECT sector, count(*) FROM trainPFI GROUP BY sector") sector count(*) 1 Defense9 2Hospitals 101 3 H

Re: [R] Clean method to convert date and time between time zones keeping it in POSIXct format

2016-05-09 Thread William Dunlap via R-help
I think as.POSIXct will just pass through a POSIXct object without any changes. E.g., > dput(as.POSIXct( structure( list(quote(foo)), class=c("POSIXct","POSIXt" structure(list(foo), class = c("POSIXct", "POSIXt")) If as.POSIXct( POSIXctObject, tz="ZONE") changed the time zone then a fair

Re: [R] Clean method to convert date and time between time zones keeping it in POSIXct format

2016-05-09 Thread Gabor Grothendieck
This involves mucking with the internals as well but it is short: structure(T1, tzone = "UTC") On Mon, May 9, 2016 at 9:24 AM, Arnaud Mosnier wrote: > Dear UseRs, > > I know two ways to convert dates and time from on time zone to another but > I am pretty sure that there is a better (cleaner)

Re: [R] Clean method to convert date and time between time zones keeping it in POSIXct format

2016-05-09 Thread Ivan Calandra
I don't have an answer, but actually, I would have expected as.POSIXct(T1, tz="UTC") to work... Looks like as.POSIXct cannot convert from class "POSIXct" Ivan -- Ivan Calandra, PhD Scientific Mediator University of Reims Champagne-Ardenne GEGENAA - EA 3795 CREA - 2 esplanade Roland Garros 51100

[R] Clean method to convert date and time between time zones keeping it in POSIXct format

2016-05-09 Thread Arnaud Mosnier
Dear UseRs, I know two ways to convert dates and time from on time zone to another but I am pretty sure that there is a better (cleaner) way to do that. Here are the methods I know: ## The longest way ... T1 <- as.POSIXct("2016-05-09 10:00:00", format="%Y-%m-%d %H:%M:%S", tz="America/New_York

Re: [R] with vs. attach

2016-05-09 Thread Hadley Wickham
On Mon, May 9, 2016 at 7:12 AM, peter dalgaard wrote: > > On 09 May 2016, at 02:46 , Bert Gunter wrote: > >> ... To be clear, Hadley or anyone else should also feel free to set me >> straight, preferably publicly, but privately if you prefer. > > Not really to "set anyone straight", but there are

Re: [R] with vs. attach

2016-05-09 Thread Hadley Wickham
On Sun, May 8, 2016 at 7:28 PM, Bert Gunter wrote: > Jeff: > > That's easy to do already with substitute(), since you can pass around > an unevaluated expression (a parse tree) however you like. As I read > it, (admittedly quickly) what it's main feature is that it allows you > more control over t

Re: [R] with vs. attach

2016-05-09 Thread peter dalgaard
On 09 May 2016, at 02:46 , Bert Gunter wrote: > ... To be clear, Hadley or anyone else should also feel free to set me > straight, preferably publicly, but privately if you prefer. Not really to "set anyone straight", but there are some subtleties with mode call objects versus expression objec