Re: [R] Unable to take correct Web-snapshot

2018-06-01 Thread Ista Zahn
The documentation is at https://developers.coinbase.com/api/v2. You
can make GET requests in R using the httr packge.

--Ista

On Fri, Jun 1, 2018 at 11:12 AM, Christofer Bogaso
 wrote:
> Thanks for that information.
>
> However how can I use R to directly get data from that API?
>
> On Fri, Jun 1, 2018 at 8:36 PM Martin Møller Skarbiniks Pedersen <
> traxpla...@gmail.com> wrote:
>
>> On 1 June 2018 at 15:08, Christofer Bogaso 
>> wrote:
>> > Hi again,
>> >
>> > I use the *webshot* package to take snapshot from Webpage. However, when
>> I
>> > try to take snapshot from* https://www.coinbase.com/
>> > *, this fails to take the full snapshot of
>> that
>> > page.
>>
>> Yes, that is a general problem with many webshot programs and libraries.
>>
>> The coinbase page ( and many others ) uses a lot of javascript to generate
>> their
>> pages and the webshot programs must understand javascript in all
>> details which is hard.
>>
>> If you are looking for the coinbase prices you can use their api to
>> get json instead:
>>
>> https://api.coinbase.com/v2/prices/spot?currency=USD
>>
>> Regards
>> Martin
>>
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Cannot Load A Package

2018-06-01 Thread Duncan Murdoch

On 01/06/2018 5:24 PM, Shivi Bhatia wrote:

Hi All,

I am trying to download semnet package but getting the error:
package not available for R version 3.4.4.


As far as I can see, there is no semnet package on CRAN, and never has 
been (or if there was, it was there by mistake).


Packages whose names start with "sem" are:

sem Structural Equation Models
semantic.dashboard  Dashboard with Semantic UI Support for 'shiny'
Semblance   Pair-Wise Semblance Using a Rank-Based Kernel
semdiag Structural equation modeling diagnostics
semds   Structural Equation Multidimensional Scaling
semGOF  Goodness-of-fit indexes for structural equation models
semiArtificial  Generator of Semi-Artificial Data
SemiCompRisks	Hierarchical Models for Parametric and Semi-Parametric 
Analyses of Semi-Competing Risks Data

SEMID   Identifiability of Linear Structural Equation Models
SemiMarkov  Multi-States Semi-Markov Models
seminr  Domain-Specific Language for Building PLS Structural Equation Models
SemiPar Semiparametic Regression
SemiParSampleSel	Semi-Parametric Sample Selection Modelling with 
Continuous or Discrete Response

SemiSupervised  Safe Semi-Supervised Learning Tools
semisupKernelPCAKernel PCA projection, and semi-supervised variant
SEMModComp  Model Comparisons for SEM
SemNetCleaner   An Automated Cleaning Tool for Semantic and Linguistic Data
semPlot Path Diagrams and Visual Analysis of Various SEM Packages' Output
semPLS  Structural Equation Modeling Using Partial Least Squares
semPowerPower Analyses for SEM
semsfa  Semiparametric Estimation of Stochastic Frontier Models
semToolsUseful Tools for Structural Equation Modeling
semtree Recursive Partitioning for Structural Equation Models
semver  'Semantic Versioning V2.0.0' Parser

Perhaps you really want one of those.

Duncan Murdoch



I tried downloading it from
install.packages('semnet',repos='http://cran.us.r-project.org')
and install.packages('semnet',repos='http://cran.revolutionanalytics.com/')
and even the https://cran.r-project.org/src/contrib/semnet.tar.gz but
doesnt seem to get success.

Please suggest some alternate.

Regards, Shivi

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Cannot Load A Package

2018-06-01 Thread Shivi Bhatia
Hi All,

I am trying to download semnet package but getting the error:
package not available for R version 3.4.4.

I tried downloading it from
install.packages('semnet',repos='http://cran.us.r-project.org')
and install.packages('semnet',repos='http://cran.revolutionanalytics.com/')
and even the https://cran.r-project.org/src/contrib/semnet.tar.gz but
doesnt seem to get success.

Please suggest some alternate.

Regards, Shivi

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] values of list of variable names

2018-06-01 Thread Greg Minshall
Christian,

does this do it?

> eval(lapply(ls(pattern="pr"), function(x) eval(parse(text=x

cheers, Greg

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Time-series moving average question

2018-06-01 Thread MacQueen, Don via R-help
For your first question, you’re doing moving averages of 3 points (I assume 
that’s what order=3 does). For any given time point of your input data, that 
would be one before, one at, and one after the given time point. Do all of  
your input times have both one before and one after?

Don’t know about your same 8 point forecast values question, not without 
running it myself, but I would say that if the data really is different, yet 
the forecasts are the same, it would have to be coincidental. But a priori this 
seems unlikely, so I’d inspect your script very carefully for mistakes.

-Don

--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
Lab cell 925-724-7509



From: Bill Poling 
Date: Friday, June 1, 2018 at 10:43 AM
To: "MacQueen, Don" , array R-help 
Subject: RE: [R] Time-series moving average question

Hi Don, wow, you are so right. I picked that piece up from the bloggers 
tutorial and since I am R naive yet, I thought it was all one step

moving_average = forecast(ma(tdat[1:31], order=2), h=5)

Truly, I usually print and check at every step I can, as painful as it is 
sometimes.
Great lesson for this novice usR.

So the first and last values are NA in each case? Do you know why? Should I 
replace the NA with a value, say the average of the others?

Also, I have 5 series of data I am working with using this script and of course 
each gave me that warning, but only the one series had the same 8 Point 
Forecast values, is that coincidental you think?

Terrific of you to help, I really appreciate it.

WHP


From: MacQueen, Don [mailto:macque...@llnl.gov]
Sent: Friday, June 01, 2018 12:54 PM
To: Bill Poling ; r-help (r-help@r-project.org) 

Subject: Re: [R] Time-series moving average question

You are right that there are no NAs in the practice data. But there are NAs in 
the moving average data.

To see this, break your work into two separate steps, like this:

tnr.ma <- ma(dat3[1:28], order=3)
TNR_moving_average <- forecast(tnr.ma, h=8)

I think you will find that the warning comes from the second step.

Print tnr.ma and you will see some NAs.

-Don

--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
Lab cell 925-724-7509



From: Bill Poling mailto:bill.pol...@zelis.com>>
Date: Friday, June 1, 2018 at 8:58 AM
To: "MacQueen, Don" mailto:macque...@llnl.gov>>, array 
R-help mailto:r-help@r-project.org>>
Subject: RE: [R] Time-series moving average question

Hello Don, thank you for your response. I appreciate your help.

I am using the forecast package, originally I found it following a forecasting 
example on bloggers.com

https://www.r-bloggers.com/time-series-analysis-using-r-forecast-package/

And subsequently located the complete pdf 
https://cran.r-project.org/web/packages/forecast/forecast.pdf

Since I created this practice data using the structure() function I am unsure 
why there would be NA’s as there are none apparently in the structure?

No worries though, I am going to reach out to the package author.

Cheers.

WHP

From: MacQueen, Don [mailto:macque...@llnl.gov]
Sent: Friday, June 01, 2018 11:24 AM
To: Bill Poling mailto:bill.pol...@zelis.com>>; r-help 
(r-help@r-project.org) 
mailto:r-help@r-project.org>>
Subject: Re: [R] Time-series moving average question

My guess would be that if you inspect the output from
ma(dat3[1:28], order=3)
you will find some NAs in it. And then forecast() doesn't like NAs.

But I can't check, because I can't find the ma() and forecast() functions. I 
assume they come from some package you installed; it would be helpful to say 
which package.

-Don

--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
Lab cell 925-724-7509


__
mailto:R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



Confidentiality Notice This message is sent from Zelis. This transmission may 
contain information which is privileged and confidential and is intended for 
the personal and confidential use of the named recipient only. Such information 
may be protected by applicable State and Federal laws from this disclosure or 
unauthorized use. If the reader of this message is not the intended recipient, 
or the employee or agent responsible for delivering the message to the intended 
recipient, you are hereby notified that any disclosure, review, discussion, 
copying, or taking any action in reliance on the contents of this transmission 
is strictly prohibited. If you have received this transmission in error, please 
contact the sender immediately. Zelis, 2018.

Confidentiality 

Re: [R] rasterize SpatialPolygon object using a RasterBrick object

2018-06-01 Thread Michael Sumner
I see this problem in 2.6-7 (version on CRAN) but it's now fixed in dev on
RForge, you can try it out by installing from there, or from the Github
mirror with devtools::install_github("rforge/raster/pkg/raster").

There's an imminent release to CRAN some time soon.

Cheers, Mike.


On Sat, 2 Jun 2018 at 04:48 Dimitri Szerman  wrote:

I am trying to rasterize a SpatialPolygon object by a RasterBrick object.
The documentation of the raster::rasterize function explicitly says this is
allowed. Here's what I am doing

# load the raster package
library("raster")
# create a raster brick object using the example from the brick
function documentation
b <- brick(system.file("external/rlogo.grd", package="raster"))
b
nlayers(b)
names(b)
extract(b, 870)
# create a SpatialPolygon object using the example from the function
documentation
Sr1 = Polygon(10*cbind(c(2,4,4,1,2),10*c(2,3,5,4,2)))
Sr2 = Polygon(10*cbind(c(5,4,2,5),10*c(2,3,2,2)))
Sr3 = Polygon(10*cbind(c(4,4,5,10,4),c(5,3,2,5,5)))
Sr4 = Polygon(10*cbind(c(5,6,6,5,5),c(4,4,3,3,4)), hole = TRUE)

Srs1 = Polygons(list(Sr1), "s1")
Srs2 = Polygons(list(Sr2), "s2")
Srs3 = Polygons(list(Sr3, Sr4), "s3/4")
SpP = SpatialPolygons(list(Srs1,Srs2,Srs3), 1:3)

plot(b[[1]])
plot(SpP, add = T)
# crop
clip1 = crop(b, extent(SpP))
# rasterize returns an error, but documentation says it should return
a RasterBrick object
clip2 = rasterize(SpP, b, mask = T)
Error in v[, r] <- rrv :
number of items to replace is not a multiple of replacement length
# however, if I used only one layer, all would be fine
clip2 = rasterize(SpP, b[[1]], mask = T)

Of course, I could loop over the brick's layers, but as I understand it,
that would defeat the purpose of a brick object.

I want to use clip2 to then get the histogram of pixel values in the
layers, like this:

vals = getValues(clip2)

Can anyone tell me why I am getting this error, and how to go around it
efficiently?

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html

and provide commented, minimal, self-contained, reproducible code.
-- 
Dr. Michael Sumner
Software and Database Engineer
Australian Antarctic Division
203 Channel Highway
Kingston Tasmania 7050 Australia

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] values of list of variable names

2018-06-01 Thread jim holtman
You probably want to use 'get':

> r1 <- 5
> r2 <- 3
> r3 <- 45
> x <- ls(pattern = '^r.$')
> x
[1] "r1" "r2" "r3"
> lapply(x, get)
[[1]]
[1] 5

[[2]]
[1] 3

[[3]]
[1] 45

>


Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.

On Fri, Jun 1, 2018 at 7:25 AM, Christian  wrote:

> Hi,
>
> I have searched the documentations of eval, substitute, expression, and I
> cannot make work something like the values of a list of variable names:
>
> lis <- ls(pattern="pr") # all variables with names containing 'pr'
>
> What is the mantra giving me the _values_ of the variables whose names
> are  contained in 'lis'. eval(parse(ls(pattern="pr"))) will not do but
> returning TRUE.
>
> TIA
> C.
> --
> Christian Hoffmann
> Rigiblickstrasse 15b
> CH-8915 Hausen am Albis
> Switzerland
> Telefon +41-(0)44-7640853
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posti
> ng-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Regroup and create new dataframe

2018-06-01 Thread David L Carlson
No html!, Copy the list using Reply-All. 

The data frame group_PrivateLabel does not contain variables called 
Product_Name or Region.

David C

From: nguy2952 University of Minnesota  
Sent: Friday, June 1, 2018 2:13 PM
To: David L Carlson 
Subject: Re: [R] Regroup and create new dataframe

Hi David,
your example is perfect!
I am still learning so please stay with me.
So, I am running a regression model:
model1 = lm(MarginDollars ~ Region + Product_Name, group_PrivateLabel)
I have an error message: 
Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) : 
  contrasts can be applied only to factors with 2 or more levels

> str(group_PrivateLabel)
'data.frame':   14802 obs. of  12 variables:
 $ ACCTG_YEAR_KEY        : int  2019 2019 2019 2019 2019 2019 2019 2019 2019 
2019 ...
 $ ITEM_CATEGORY_DESCR   : Factor w/ 462 levels "ABRASIVE AND POLISHING 
MATERIAL",..: 145 145 145 145 145 145 145 145 145 145 ...
 $ ITEM_DESCR            : Factor w/ 12319 levels "@EASE X-RAY BADGE QTRLY 
SRVC",..: 8263 8263 8263 8263 8263 8263 8263 8263 8263 8264 ...
 $ PRODUCT_SUB_LINE_DESCR: Factor w/ 3 levels "Handpieces","PRIVATE LABEL",..: 
2 2 2 2 2 2 2 2 2 2 ...
 $ MAJOR_CATEGORY_DESCR  : Factor w/ 25 levels "AIR ABRASION",..: 4 4 4 4 4 4 4 
4 4 4 ...
 $ CUST_BRANCH_DESCR     : Factor w/ 60 levels "ALBUQUERQUE",..: 58 35 24 55 8 
22 22 46 46 35 ...
 $ CUST_STATE_KEY        : Factor w/ 52 levels "AK","AL","AR",..: 15 49 44 16 6 
6 28 6 6 49 ...
 $ CUST_REGION_DESCR     : Factor w/ 7 levels "MOUNTAIN WEST REGION",..: 2 2 5 
4 6 6 6 6 6 2 ...
 $ Sales                 : num  25.9 13.5 28.5 28.5 57 ...
 $ QtySold               : int  2 1 2 2 5 2 1 3 3 1 ...
 $ MFGCOST               : num  13.2 6.6 13.2 13.2 33 13.2 6.6 19.8 19.8 6.6 ...
 $ MarginDollars         : num  11.72 6.43 14.28 14.28 21.45 ...

What can I do?
Everything seems to fit perfectly to what I learned at school.
I am just working on a real-life huge data set. The regression model should 
work.

Please help.


On Fri, Jun 1, 2018 at 2:09 PM, David L Carlson  
wrote:
Responses should be copied to r-help using ReplyAll. You are still sending html 
formatted emails. If you are using Microsoft Outlook, click the Format Text tab 
and select “Aa Plain Text”. No one has asked you to reveal the data set, only 
to create one with a similar structure. Is the data I sent reasonably close? 
What should it look like after it is transformed? 

David C

From: nguy2952 University of Minnesota  
Sent: Friday, June 1, 2018 1:57 PM
To: David L Carlson 
Subject: Re: [R] Regroup and create new dataframe

Hi,
This is not an assignment for school.
This is a project at WORK. 
I am not allowed to reveal the dataset.

Thanks!

On Fri, Jun 1, 2018 at 1:55 PM, David L Carlson 
 wrote:
Your question raises several issues. First, we do not do homework here, so if 
this is an assignment, you will not get much help. Second, you need to send 
your emails as plain text, not html. Third, you need to provide a reproducible 
example and send your data using dput() so that we can follow what you have 
tried so far. For example, here's a data set that resembles what you have 
described:

set.seed(42)
Tape <- data.frame(Year=2011:2015, Product=rep(c("Target", "3M", "Avery"),
     each=5), Sales=sample(1000:2000, 15), Region=rep(c("North", "South",
     "West"), each=5), stringsAsFactors=FALSE)
dput(Tape)
structure(list(Year = c(2011L, 2012L, 2013L, 2014L, 2015L, 2011L, 
2012L, 2013L, 2014L, 2015L, 2011L, 2012L, 2013L, 2014L, 2015L
), Product = c("Target", "Target", "Target", "Target", "Target", 
"3M", "3M", "3M", "3M", "3M", "Avery", "Avery", "Avery", "Avery", 
"Avery"), Sales = c(1915L, 1937L, 1285L, 1828L, 1639L, 1517L, 
1732L, 1133L, 1652L, 1699L, 1453L, 1711L, 1924L, 1252L, 1456L
), Region = c("North", "North", "North", "North", "North", "South", 
"South", "South", "South", "South", "West", "West", "West", "West", 
"West")), .Names = c("Year", "Product", "Sales", "Region"), row.names = c(NA, 
-15L), class = "data.frame")

It is not clear what you want in your new data frame. This one has 5 years of 
data for each tape brand and you seem to want one row for each tape brand? 
Tables created in html and then sent to a plain text mailing list can be 
dramatically different from the original format. It is not clear that you 
cannot answer your questions from the data as presented here. Look at the 
results of unlist(split(Tape, Tape$Product)). You should see that this is 
nowhere near what you described.


David L Carlson
Department of Anthropology
Texas A University
College Station, TX 77843-4352

-Original Message-
From: R-help  On Behalf Of nguy2952 
University of Minnesota
Sent: Friday, June 1, 2018 10:54 AM
To: mailto:mailto:r-help@r-project.org
Subject: [R] Regroup and create new 

Re: [R] Regroup and create new dataframe

2018-06-01 Thread David L Carlson
Responses should be copied to r-help using ReplyAll. You are still sending html 
formatted emails. If you are using Microsoft Outlook, click the Format Text tab 
and select “Aa Plain Text”. No one has asked you to reveal the data set, only 
to create one with a similar structure. Is the data I sent reasonably close? 
What should it look like after it is transformed? 

David C

From: nguy2952 University of Minnesota  
Sent: Friday, June 1, 2018 1:57 PM
To: David L Carlson 
Subject: Re: [R] Regroup and create new dataframe

Hi,
This is not an assignment for school.
This is a project at WORK. 
I am not allowed to reveal the dataset.

Thanks!

On Fri, Jun 1, 2018 at 1:55 PM, David L Carlson  
wrote:
Your question raises several issues. First, we do not do homework here, so if 
this is an assignment, you will not get much help. Second, you need to send 
your emails as plain text, not html. Third, you need to provide a reproducible 
example and send your data using dput() so that we can follow what you have 
tried so far. For example, here's a data set that resembles what you have 
described:

set.seed(42)
Tape <- data.frame(Year=2011:2015, Product=rep(c("Target", "3M", "Avery"),
     each=5), Sales=sample(1000:2000, 15), Region=rep(c("North", "South",
     "West"), each=5), stringsAsFactors=FALSE)
dput(Tape)
structure(list(Year = c(2011L, 2012L, 2013L, 2014L, 2015L, 2011L, 
2012L, 2013L, 2014L, 2015L, 2011L, 2012L, 2013L, 2014L, 2015L
), Product = c("Target", "Target", "Target", "Target", "Target", 
"3M", "3M", "3M", "3M", "3M", "Avery", "Avery", "Avery", "Avery", 
"Avery"), Sales = c(1915L, 1937L, 1285L, 1828L, 1639L, 1517L, 
1732L, 1133L, 1652L, 1699L, 1453L, 1711L, 1924L, 1252L, 1456L
), Region = c("North", "North", "North", "North", "North", "South", 
"South", "South", "South", "South", "West", "West", "West", "West", 
"West")), .Names = c("Year", "Product", "Sales", "Region"), row.names = c(NA, 
-15L), class = "data.frame")

It is not clear what you want in your new data frame. This one has 5 years of 
data for each tape brand and you seem to want one row for each tape brand? 
Tables created in html and then sent to a plain text mailing list can be 
dramatically different from the original format. It is not clear that you 
cannot answer your questions from the data as presented here. Look at the 
results of unlist(split(Tape, Tape$Product)). You should see that this is 
nowhere near what you described.


David L Carlson
Department of Anthropology
Texas A University
College Station, TX 77843-4352

-Original Message-
From: R-help  On Behalf Of nguy2952 
University of Minnesota
Sent: Friday, June 1, 2018 10:54 AM
To: mailto:r-help@r-project.org
Subject: [R] Regroup and create new dataframe

Hello folks,

I have a big project to work on and the dataset is classified so I am just 
going to use my own example so everyone can understand what I am targeting.

Let's take Target as an example: We consider three brands of tape: Target 
brand, 3M and Avery. The original data frame has 4 columns: Year of Record, 
Product_Name(which contains three brands of tape), Sales, and Region. I want to 
create a new data frame that looks like this:

                      Year of Record       Sales     Region
  Target Brand
  3M
  Avery

Here is what I did.

   1.

   I split the original data frame which I called data1:

   X = split(data1, Product_name)

   2.

   Unlist X

   X1 = unlist(X)

   3.

   Create a new data frame

   new_df = as.data.frame(X1)


But, when I used the command View(new_df), I had only two columns: The left one 
is similar to TargetBrand.Sales, etc. and the right one is just "X1"

I did not achieve what I wanted.

**A potentially big question from readers:*

Why am I doing this?

*Answer:*

I want to run a multiple regression model later to see among different regions, 
what the sales look like for these three brands of tape:

*Does Mid-west buy more house brand than East Coast?*

or

*Does region really affect the sales? Are Mid-West's purchases similar to those 
of East Coast and West Coast?*

I need help. Please give me guidance.

Sincerely,
Hugh N

        [[alternative HTML version deleted]]

__
mailto:R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 
https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dhelp=DwMFaQ=ODFT-G5SujMiGrKuoJJjVg=veMGHMCNZShld-KX-bIj4jRE_tP9ojUvB_Lqp0ieSdk=LnVfoBf5smekeCFlal5rmpELFRoDrB3H3ij_lZJRy0w=nPZ3F6nROsY3KM0z7y6ixAAYLjMGVhEZyuXMi3bg0rY=
PLEASE do read the posting guide 
https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.org_posting-2Dguide.html=DwMFaQ=ODFT-G5SujMiGrKuoJJjVg=veMGHMCNZShld-KX-bIj4jRE_tP9ojUvB_Lqp0ieSdk=LnVfoBf5smekeCFlal5rmpELFRoDrB3H3ij_lZJRy0w=XNpVm_6i2GLFLk3FzpM9T15aezUet1BA0FlapuVXdmc=
and provide commented, minimal, 

Re: [R] Regroup and create new dataframe

2018-06-01 Thread Rui Barradas

Hello,

I don't understand why you are splitting data1 and then unlisting the 
result.


if you want to apply a modeling function to each of the subdf's, split 
by Product name, you can follow more or less these steps:


0. Create a dataset

set.seed(9376)    # Make the results reproducible

n <- 100
PN <- c("Target Brand", "3M", "Avery")
data1 <- data.frame(Product_name = sample(PN, n, TRUE),
    Year_of_Record = sample(2011:2018, n, TRUE),
    Sales = runif(n, 10, 1000),
    Region = sample(letters[1:5], n, TRUE)
    )

head(data1)


1. Split the dataset by product name. Thsi gives a list of subdf's.


X <- split(data1, data1$Product_name)


2. Now lappy a modeling function to each subdf.


modelFun <- function(DF){

    lm(Sales ~ Region, data = DF)

}

model_list <- lapply(X, modelFun )
model_smry <- lapply(model_list, summary)
model_smry[[1]]
#
#Call:
#  lm(formula = Sales ~ Region, data = DF)
#
#Residuals:
#  Min  1Q  Median  3Q Max
#-487.41 -196.17    1.76  195.96  498.48
#
#Coefficients:
#  Estimate Std. Error t value Pr(>|t|)
#(Intercept)  437.300    108.147   4.044 0.000355 ***
#  Regionb  437.019    167.540   2.608 0.014229 *
#  Regionc  102.989    179.341   0.574 0.570217
#Regiond  105.520    152.942   0.690 0.495721
#Regione   -5.638    138.342  -0.041 0.967773
#---
#  Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#
#Residual standard error: 286.1 on 29 degrees of freedom
#Multiple R-squared:  0.2426,    Adjusted R-squared:  0.1381
#F-statistic: 2.322 on 4 and 29 DF,  p-value: 0.08039

Hope this helps,


Rui Barradas


Às 16:54 de 01-06-2018, nguy2952 University of Minnesota escreveu:

Hello folks,

I have a big project to work on and the dataset is classified so I am just
going to use my own example so everyone can understand what I am targeting.

Let's take Target as an example: We consider three brands of tape: Target
brand, 3M and Avery. The original data frame has 4 columns: Year of Record,
Product_Name(which contains three brands of tape), Sales, and Region. I
want to create a new data frame that looks like this:

   Year of Record   Sales Region
   Target Brand
   3M
   Avery

Here is what I did.

1.

I split the original data frame which I called data1:

X = split(data1, Product_name)

2.

Unlist X

X1 = unlist(X)

3.

Create a new data frame

new_df = as.data.frame(X1)


But, when I used the command View(new_df), I had only two columns: The left
one is similar to TargetBrand.Sales, etc. and the right one is just "X1"

I did not achieve what I wanted.

**A potentially big question from readers:*

Why am I doing this?

*Answer:*

I want to run a multiple regression model later to see among different
regions, what the sales look like for these three brands of tape:

*Does Mid-west buy more house brand than East Coast?*

or

*Does region really affect the sales? Are Mid-West's purchases similar to
those of East Coast and West Coast?*

I need help. Please give me guidance.

Sincerely,
Hugh N

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Regroup and create new dataframe

2018-06-01 Thread David L Carlson
Your question raises several issues. First, we do not do homework here, so if 
this is an assignment, you will not get much help. Second, you need to send 
your emails as plain text, not html. Third, you need to provide a reproducible 
example and send your data using dput() so that we can follow what you have 
tried so far. For example, here's a data set that resembles what you have 
described:

set.seed(42)
Tape <- data.frame(Year=2011:2015, Product=rep(c("Target", "3M", "Avery"),
 each=5), Sales=sample(1000:2000, 15), Region=rep(c("North", "South",
 "West"), each=5), stringsAsFactors=FALSE)
dput(Tape)
structure(list(Year = c(2011L, 2012L, 2013L, 2014L, 2015L, 2011L, 
2012L, 2013L, 2014L, 2015L, 2011L, 2012L, 2013L, 2014L, 2015L
), Product = c("Target", "Target", "Target", "Target", "Target", 
"3M", "3M", "3M", "3M", "3M", "Avery", "Avery", "Avery", "Avery", 
"Avery"), Sales = c(1915L, 1937L, 1285L, 1828L, 1639L, 1517L, 
1732L, 1133L, 1652L, 1699L, 1453L, 1711L, 1924L, 1252L, 1456L
), Region = c("North", "North", "North", "North", "North", "South", 
"South", "South", "South", "South", "West", "West", "West", "West", 
"West")), .Names = c("Year", "Product", "Sales", "Region"), row.names = c(NA, 
-15L), class = "data.frame")

It is not clear what you want in your new data frame. This one has 5 years of 
data for each tape brand and you seem to want one row for each tape brand? 
Tables created in html and then sent to a plain text mailing list can be 
dramatically different from the original format. It is not clear that you 
cannot answer your questions from the data as presented here. Look at the 
results of unlist(split(Tape, Tape$Product)). You should see that this is 
nowhere near what you described.


David L Carlson
Department of Anthropology
Texas A University
College Station, TX 77843-4352

-Original Message-
From: R-help  On Behalf Of nguy2952 University of 
Minnesota
Sent: Friday, June 1, 2018 10:54 AM
To: r-help@r-project.org
Subject: [R] Regroup and create new dataframe

Hello folks,

I have a big project to work on and the dataset is classified so I am just 
going to use my own example so everyone can understand what I am targeting.

Let's take Target as an example: We consider three brands of tape: Target 
brand, 3M and Avery. The original data frame has 4 columns: Year of Record, 
Product_Name(which contains three brands of tape), Sales, and Region. I want to 
create a new data frame that looks like this:

  Year of Record   Sales Region
  Target Brand
  3M
  Avery

Here is what I did.

   1.

   I split the original data frame which I called data1:

   X = split(data1, Product_name)

   2.

   Unlist X

   X1 = unlist(X)

   3.

   Create a new data frame

   new_df = as.data.frame(X1)


But, when I used the command View(new_df), I had only two columns: The left one 
is similar to TargetBrand.Sales, etc. and the right one is just "X1"

I did not achieve what I wanted.

**A potentially big question from readers:*

Why am I doing this?

*Answer:*

I want to run a multiple regression model later to see among different regions, 
what the sales look like for these three brands of tape:

*Does Mid-west buy more house brand than East Coast?*

or

*Does region really affect the sales? Are Mid-West's purchases similar to those 
of East Coast and West Coast?*

I need help. Please give me guidance.

Sincerely,
Hugh N

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] rasterize SpatialPolygon object using a RasterBrick object

2018-06-01 Thread Dimitri Szerman
I am trying to rasterize a SpatialPolygon object by a RasterBrick object.
The documentation of the raster::rasterize function explicitly says this is
allowed. Here's what I am doing

# load the raster package
library("raster")
# create a raster brick object using the example from the brick
function documentation
b <- brick(system.file("external/rlogo.grd", package="raster"))
b
nlayers(b)
names(b)
extract(b, 870)
# create a SpatialPolygon object using the example from the function
documentation
Sr1 = Polygon(10*cbind(c(2,4,4,1,2),10*c(2,3,5,4,2)))
Sr2 = Polygon(10*cbind(c(5,4,2,5),10*c(2,3,2,2)))
Sr3 = Polygon(10*cbind(c(4,4,5,10,4),c(5,3,2,5,5)))
Sr4 = Polygon(10*cbind(c(5,6,6,5,5),c(4,4,3,3,4)), hole = TRUE)

Srs1 = Polygons(list(Sr1), "s1")
Srs2 = Polygons(list(Sr2), "s2")
Srs3 = Polygons(list(Sr3, Sr4), "s3/4")
SpP = SpatialPolygons(list(Srs1,Srs2,Srs3), 1:3)

plot(b[[1]])
plot(SpP, add = T)
# crop
clip1 = crop(b, extent(SpP))
# rasterize returns an error, but documentation says it should return
a RasterBrick object
clip2 = rasterize(SpP, b, mask = T)
Error in v[, r] <- rrv :
 number of items to replace is not a multiple of replacement length
# however, if I used only one layer, all would be fine
clip2 = rasterize(SpP, b[[1]], mask = T)

Of course, I could loop over the brick's layers, but as I understand it,
that would defeat the purpose of a brick object.

I want to use clip2 to then get the histogram of pixel values in the
layers, like this:

vals = getValues(clip2)

Can anyone tell me why I am getting this error, and how to go around it
efficiently?

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] values of list of variable names

2018-06-01 Thread William Dunlap via R-help
One way is
   values <- lapply(lis, get)
You can do
   names(values) <- lis
to attach the object names to the values in the list returned by lapply.


Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Fri, Jun 1, 2018 at 7:25 AM, Christian  wrote:

> Hi,
>
> I have searched the documentations of eval, substitute, expression, and I
> cannot make work something like the values of a list of variable names:
>
> lis <- ls(pattern="pr") # all variables with names containing 'pr'
>
> What is the mantra giving me the _values_ of the variables whose names
> are  contained in 'lis'. eval(parse(ls(pattern="pr"))) will not do but
> returning TRUE.
>
> TIA
> C.
> --
> Christian Hoffmann
> Rigiblickstrasse 15b
> CH-8915 Hausen am Albis
> Switzerland
> Telefon +41-(0)44-7640853
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posti
> ng-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Time-series moving average question

2018-06-01 Thread Bill Poling
Hi Don, wow, you are so right. I picked that piece up from the bloggers 
tutorial and since I am R naive yet, I thought it was all one step

moving_average = forecast(ma(tdat[1:31], order=2), h=5)

Truly, I usually print and check at every step I can, as painful as it is 
sometimes.
Great lesson for this novice usR.

So the first and last values are NA in each case? Do you know why? Should I 
replace the NA with a value, say the average of the others?

Also, I have 5 series of data I am working with using this script and of course 
each gave me that warning, but only the one series had the same 8 Point 
Forecast values, is that coincidental you think?

Terrific of you to help, I really appreciate it.

WHP


From: MacQueen, Don [mailto:macque...@llnl.gov]
Sent: Friday, June 01, 2018 12:54 PM
To: Bill Poling ; r-help (r-help@r-project.org) 

Subject: Re: [R] Time-series moving average question

You are right that there are no NAs in the practice data. But there are NAs in 
the moving average data.

To see this, break your work into two separate steps, like this:

tnr.ma <- ma(dat3[1:28], order=3)
TNR_moving_average <- forecast(tnr.ma, h=8)

I think you will find that the warning comes from the second step.

Print tnr.ma and you will see some NAs.

-Don

--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
Lab cell 925-724-7509



From: Bill Poling mailto:bill.pol...@zelis.com>>
Date: Friday, June 1, 2018 at 8:58 AM
To: "MacQueen, Don" mailto:macque...@llnl.gov>>, array 
R-help mailto:r-help@r-project.org>>
Subject: RE: [R] Time-series moving average question

Hello Don, thank you for your response. I appreciate your help.

I am using the forecast package, originally I found it following a forecasting 
example on bloggers.com

https://www.r-bloggers.com/time-series-analysis-using-r-forecast-package/

And subsequently located the complete pdf 
https://cran.r-project.org/web/packages/forecast/forecast.pdf

Since I created this practice data using the structure() function I am unsure 
why there would be NA’s as there are none apparently in the structure?

No worries though, I am going to reach out to the package author.

Cheers.

WHP

From: MacQueen, Don [mailto:macque...@llnl.gov]
Sent: Friday, June 01, 2018 11:24 AM
To: Bill Poling mailto:bill.pol...@zelis.com>>; r-help 
(r-help@r-project.org) 
mailto:r-help@r-project.org>>
Subject: Re: [R] Time-series moving average question

My guess would be that if you inspect the output from
ma(dat3[1:28], order=3)
you will find some NAs in it. And then forecast() doesn't like NAs.

But I can't check, because I can't find the ma() and forecast() functions. I 
assume they come from some package you installed; it would be helpful to say 
which package.

-Don

--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
Lab cell 925-724-7509


__
mailto:R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



Confidentiality Notice This message is sent from Zelis. This transmission may 
contain information which is privileged and confidential and is intended for 
the personal and confidential use of the named recipient only. Such information 
may be protected by applicable State and Federal laws from this disclosure or 
unauthorized use. If the reader of this message is not the intended recipient, 
or the employee or agent responsible for delivering the message to the intended 
recipient, you are hereby notified that any disclosure, review, discussion, 
copying, or taking any action in reliance on the contents of this transmission 
is strictly prohibited. If you have received this transmission in error, please 
contact the sender immediately. Zelis, 2018.

Confidentiality Notice This message is sent from Zelis. This transmission may 
contain information which is privileged and confidential and is intended for 
the personal and confidential use of the named recipient only. Such information 
may be protected by applicable State and Federal laws from this disclosure or 
unauthorized use. If the reader of this message is not the intended recipient, 
or the employee or agent responsible for delivering the message to the intended 
recipient, you are hereby notified that any disclosure, review, discussion, 
copying, or taking any action in reliance on the contents of this transmission 
is strictly prohibited. If you 

[R] Regroup and create new dataframe

2018-06-01 Thread nguy2952 University of Minnesota
Hello folks,

I have a big project to work on and the dataset is classified so I am just
going to use my own example so everyone can understand what I am targeting.

Let's take Target as an example: We consider three brands of tape: Target
brand, 3M and Avery. The original data frame has 4 columns: Year of Record,
Product_Name(which contains three brands of tape), Sales, and Region. I
want to create a new data frame that looks like this:

  Year of Record   Sales Region
  Target Brand
  3M
  Avery

Here is what I did.

   1.

   I split the original data frame which I called data1:

   X = split(data1, Product_name)

   2.

   Unlist X

   X1 = unlist(X)

   3.

   Create a new data frame

   new_df = as.data.frame(X1)


But, when I used the command View(new_df), I had only two columns: The left
one is similar to TargetBrand.Sales, etc. and the right one is just "X1"

I did not achieve what I wanted.

**A potentially big question from readers:*

Why am I doing this?

*Answer:*

I want to run a multiple regression model later to see among different
regions, what the sales look like for these three brands of tape:

*Does Mid-west buy more house brand than East Coast?*

or

*Does region really affect the sales? Are Mid-West's purchases similar to
those of East Coast and West Coast?*

I need help. Please give me guidance.

Sincerely,
Hugh N

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] values of list of variable names

2018-06-01 Thread Christian

Hi,

I have searched the documentations of eval, substitute, expression, and 
I cannot make work something like the values of a list of variable names:


lis <- ls(pattern="pr") # all variables with names containing 'pr'

What is the mantra giving me the _values_ of the variables whose names 
are  contained in 'lis'. eval(parse(ls(pattern="pr"))) will not do but 
returning TRUE.


TIA
C.
--
Christian Hoffmann
Rigiblickstrasse 15b
CH-8915 Hausen am Albis
Switzerland
Telefon +41-(0)44-7640853

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Time-series moving average question

2018-06-01 Thread MacQueen, Don via R-help
You are right that there are no NAs in the practice data. But there are NAs in 
the moving average data.

To see this, break your work into two separate steps, like this:

  tnr.ma <- ma(dat3[1:28], order=3)
  TNR_moving_average <- forecast(tnr.ma, h=8)

I think you will find that the warning comes from the second step.

Print tnr.ma and you will see some NAs.

-Don

--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
Lab cell 925-724-7509
 


From: Bill Poling 
Date: Friday, June 1, 2018 at 8:58 AM
To: "MacQueen, Don" , array R-help 
Subject: RE: [R] Time-series moving average question

Hello Don, thank you for your response. I appreciate your help. 
 
I am using the forecast package, originally I found it following a forecasting 
example on bloggers.com 
 
https://www.r-bloggers.com/time-series-analysis-using-r-forecast-package/
 
And subsequently located the complete pdf 
https://cran.r-project.org/web/packages/forecast/forecast.pdf
 
Since I created this practice data using the structure() function I am unsure 
why there would be NA’s as there are none apparently in the structure?
 
No worries though, I am going to reach out to the package author.
 
Cheers. 
 
WHP
 
From: MacQueen, Don [mailto:macque...@llnl.gov] 
Sent: Friday, June 01, 2018 11:24 AM
To: Bill Poling ; r-help (r-help@r-project.org) 

Subject: Re: [R] Time-series moving average question
 
My guess would be that if you inspect the output from
ma(dat3[1:28], order=3)
you will find some NAs in it. And then forecast() doesn't like NAs.

But I can't check, because I can't find the ma() and forecast() functions. I 
assume they come from some package you installed; it would be helpful to say 
which package.

-Don

--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
Lab cell 925-724-7509


__
mailto:R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



Confidentiality Notice This message is sent from Zelis. This transmission may 
contain information which is privileged and confidential and is intended for 
the personal and confidential use of the named recipient only. Such information 
may be protected by applicable State and Federal laws from this disclosure or 
unauthorized use. If the reader of this message is not the intended recipient, 
or the employee or agent responsible for delivering the message to the intended 
recipient, you are hereby notified that any disclosure, review, discussion, 
copying, or taking any action in reliance on the contents of this transmission 
is strictly prohibited. If you have received this transmission in error, please 
contact the sender immediately. Zelis, 2018. 

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R-es] X Jornadas de R en Murcia. Ponente François Husson

2018-06-01 Thread Antonio Maurandi López
Erreros y erreras!

En las*X Joranadas de R en Murcia* (22-23/nov/18, R-hispano), contaremos 
con la presencia del *Dr. François Husson* 
(http://math.agrocampus-ouest.fr/infoglueDeliverLive/membres/Francois.Husson) 
.

Su ponencia será el jueves 22 y el titulo: /“From the package FactoMineR 
to a project on exploratory multivariate analysis or how to improve the 
visibility of its package”/.

También podéis participar con comunicaciones, talleres o posters: <- 
http://r-es.org/XjuR/

Síguenos en twitter:: #XJRes

Salu2+

​

-- 
Antonio Maurandi López

Departamento Didáctica de las Ciencias Matemáticas y Sociales
Área de Didáctica de la Matemática
Planta 3ª, pasillo 3º. Despacho 3.22
Facultad de Educación
Universidad de Murcia
30110 Campus de Espinardo
Murcia

@.amaura...@um.es
T. 868 88 4594
http://gauss.inf.um.es/
http://gauss.inf.um.es/umur/
Blog:www.sae.saiblogs.inf.um.es
---
Audentes fortuna iuva


[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R] Time-series moving average question

2018-06-01 Thread Bill Poling
Hello Don, thank you for your response. I appreciate your help.

I am using the forecast package, originally I found it following a forecasting 
example on bloggers.com

https://www.r-bloggers.com/time-series-analysis-using-r-forecast-package/

And subsequently located the complete pdf 
https://cran.r-project.org/web/packages/forecast/forecast.pdf

Since I created this practice data using the structure() function I am unsure 
why there would be NA’s as there are none apparently in the structure?

No worries though, I am going to reach out to the package author.

Cheers.

WHP

From: MacQueen, Don [mailto:macque...@llnl.gov]
Sent: Friday, June 01, 2018 11:24 AM
To: Bill Poling ; r-help (r-help@r-project.org) 

Subject: Re: [R] Time-series moving average question

My guess would be that if you inspect the output from
ma(dat3[1:28], order=3)
you will find some NAs in it. And then forecast() doesn't like NAs.

But I can't check, because I can't find the ma() and forecast() functions. I 
assume they come from some package you installed; it would be helpful to say 
which package.

-Don

--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
Lab cell 925-724-7509


__
R-help@r-project.org mailing list -- To 
UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Confidentiality Notice This message is sent from Zelis. This transmission may 
contain information which is privileged and confidential and is intended for 
the personal and confidential use of the named recipient only. Such information 
may be protected by applicable State and Federal laws from this disclosure or 
unauthorized use. If the reader of this message is not the intended recipient, 
or the employee or agent responsible for delivering the message to the intended 
recipient, you are hereby notified that any disclosure, review, discussion, 
copying, or taking any action in reliance on the contents of this transmission 
is strictly prohibited. If you have received this transmission in error, please 
contact the sender immediately. Zelis, 2018.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Time-series moving average question

2018-06-01 Thread MacQueen, Don via R-help
My guess would be that if you inspect the output from
ma(dat3[1:28], order=3)
you will find some NAs in it. And then forecast() doesn't like NAs.

But I can't check, because I can't find the ma() and forecast() functions. I 
assume they come from some package you installed; it would be helpful to say 
which package.

-Don

--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
Lab cell 925-724-7509
 
 

On 6/1/18, 4:20 AM, "R-help on behalf of Bill Poling" 
 wrote:

Good morning, I hope someone can help with these questions, or perhaps 
suggest one of the other R-lists?

I have two questions:


  1.  Why am I getting this warning?
  2.  Why is the second example "Point Forecast" the same value, I do not 
see that in previous attempts with similar but different data sets as in 
example 1?

Example1:
dat3 <- structure(c(3539122.86, 3081383.87, 4158672.31, 4137518.78, 
4123682.08, 4819375.2, 4342687.77, 5028674.58, 4472145.07, 4967277.73, 
4516240.31, 4876194.63, 4816446.59,
4887399.37, 5478504.85, 4871385.27, 5487543.68, 
5464193.69, 5252591.03, 7071416.89, 5524350.89, 6107166.69, 6530003.55, 
6445929.08, 7356743.81, 6750025.03,
6934714.08, 6656194.35

,-13913, -29385.31, -39633.37, -23487.13, -18202.86, 
-57335.49, -26061.45, -60880.07, -17589.45, -35970.08, -89133.94,
-84694.58, -31724.89, -29847.95, -65421.74, -34334.22, 
-48511.98, -30298.97, -38729.46, -29292.89, -46098.4, -65909.49,
-85879.23, -71845.28, -69017.07, -93161.03, -70847.29, 
-85106.04

,-357694.19, -444792.75, -361349.57, -386717.55, 
-547422.05, -518259.22, -417613.76, -578631.46, -804516.81, -572875.52, 
-510487.53,
-666294.87, -673233.37, -556564.45, -963346.75, 
-639288.2, -910104.23, -773428.8, -1008078.84, -546685.3, -729932.94, 
-987098.23,
-964001.63, -986995.93, -680066.58, -728854.58, 
-730766.92, -753861.59)
,.Dim = c(28L, 3L)
,.Dimnames = list(NULL, c("OONNetRev","OONAdjusted" 
,"OONCancelled"))
,.Tsp = c(2016, 2018.25, 12), class = c("mts", "ts", 
"matrix"))
head(dat3); nrow(dat3)

TNR_moving_average <- forecast(ma(dat3[1:28], order=3), h=8)
TNR_moving_average

# Warning message:
#   In ets(object, lambda = lambda, biasadj = biasadj, 
allow.multiplicative.trend = allow.multiplicative.trend,  :
#Missing values encountered. Using longest contiguous portion 
of time series
#  > Point Forecast Lo 80 Hi 80 Lo 95   
  Hi 95
# 28  7007065.99688 6675015.72012 7339116.27365 6499238.92148 
7514893.07229
# 29  7135745.42473 6721543.41996 7549947.42950 6502278.12345 
7769212.72601
# 30  7264424.85258 6779532.18065 7749317.52450 6522845.50541 
8006004.19974
# 31  7393104.28042 6844496.10189 7941712.45896 6554080.47486 
8232128.08599
# 32  7521783.70827 6914203.11991 8129364.29663 6592569.38486 
8450998.03168
# 33  7650463.13612 6987355.72657 8313570.54567 6636327.86794 
8664598.40429
# 34  7779142.56396 7063123.29787 8495161.83005 6684085.59434 
8874199.53358
# 35  7907821.99181 7140937.69145 8674706.29217 6734973.66528 
9080670.31834




Example2:
dat3 <- structure(c(994320.58, 811664.54, 1045259.43, 951659.48, 669458.94, 
986741.09, 1023344.82, 938971.65, 897670.06, 1040074.6, 1090310.01,
1289821.17, 1187806.23, 971485.76, 1161147.42, 
870585.04, 1021301.52, 1215798.03, 1015004.43, 1365863.09, 995769.41,
1331725.36, 1271032.91, 1092103.82, 1297131.4, 
1129195.28, 1372594.58, 1553717.57,

-39811.51, -47356.74, -49046.86, -41311.13, -79063.98, 
-43916.59, -16746.33, -38347.9, -84797.44, -38961.44,
-72036.83, -62854.78, -35259.84, -44198.39, -34262.65, 
-49245.82, -34977.28, -36797.35, -47534.43, -33515.13,
-25764.41, -29130.53, -57693.63, -51026.83, -49624.49, 
-36508.13, -32667.21, -37900.5,

-247443.87, -372942.34, -344080.78, -355586.21, 
-458998.84, -378086.44, -333994.18, -567024.45, -521499.8, -428915.13,
-512034.28, -440865.42, -347494.22, -422436.19, 
-444588.65, -462891.57, -518395.47, -373818.5, -398899.53, -381573.69,
-531449.2, -476238.48, -434296.86, -655679.94, 
-528999.52, -423725.95, -556977.31, -518633.95)
  ,.Dim = c(28L, 3L)
  ,.Dimnames = list(NULL, c("EditNetRev","EditNetAdjusted" 
,"EditNetCancelled"))
  ,.Tsp = c(2016, 2018.25, 12), class = c("mts", "ts", 
"matrix"))
head(dat3); nrow(dat3)
   

Re: [R] Unable to take correct Web-snapshot

2018-06-01 Thread Christofer Bogaso
Thanks for that information.

However how can I use R to directly get data from that API?

On Fri, Jun 1, 2018 at 8:36 PM Martin Møller Skarbiniks Pedersen <
traxpla...@gmail.com> wrote:

> On 1 June 2018 at 15:08, Christofer Bogaso 
> wrote:
> > Hi again,
> >
> > I use the *webshot* package to take snapshot from Webpage. However, when
> I
> > try to take snapshot from* https://www.coinbase.com/
> > *, this fails to take the full snapshot of
> that
> > page.
>
> Yes, that is a general problem with many webshot programs and libraries.
>
> The coinbase page ( and many others ) uses a lot of javascript to generate
> their
> pages and the webshot programs must understand javascript in all
> details which is hard.
>
> If you are looking for the coinbase prices you can use their api to
> get json instead:
>
> https://api.coinbase.com/v2/prices/spot?currency=USD
>
> Regards
> Martin
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Unable to take correct Web-snapshot

2018-06-01 Thread Martin Møller Skarbiniks Pedersen
On 1 June 2018 at 15:08, Christofer Bogaso  wrote:
> Hi again,
>
> I use the *webshot* package to take snapshot from Webpage. However, when I
> try to take snapshot from* https://www.coinbase.com/
> *, this fails to take the full snapshot of that
> page.

Yes, that is a general problem with many webshot programs and libraries.

The coinbase page ( and many others ) uses a lot of javascript to generate their
pages and the webshot programs must understand javascript in all
details which is hard.

If you are looking for the coinbase prices you can use their api to
get json instead:

https://api.coinbase.com/v2/prices/spot?currency=USD

Regards
Martin

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Unable to take correct Web-snapshot

2018-06-01 Thread Christofer Bogaso
Hi again,

I use the *webshot* package to take snapshot from Webpage. However, when I
try to take snapshot from* https://www.coinbase.com/
*, this fails to take the full snapshot of that
page.

I tried following :

> library(webshot)
> webshot("https://www.coinbase.com/;, 'aa.pdf')

However in the pdf page, I done see the quotes which are available on the
main page in the 4 boxes.

Any help how to resolve this would be highly appreciated.

Thanks,

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Problem with adding a raster and a brick

2018-06-01 Thread Michael Sumner
This is now fixed in development on RForge, you can try it out by
installing from there, or from the Github mirror with
devtools::install_github("rforge/raster/pkg/raster").

(To get fixes into raster email the maintainer directly - you might not get
a response but it'll be addressed).

Cheers, Mike.


On Thu, 24 May 2018 at 20:08 Michael Sumner  wrote:

>
>
>
> On Thu, 24 May 2018 at 18:41 Mark R Payne 
> wrote:
>
> Hi,
>
> I seem to be having a problem adding the following two raster objects
> together - one is a rasterLayer, the other is a rasterBrick. The extent,
> resolution, and origin are the same, so according to my understand it
> should work. The objects look like so:
>
> > obs.clim
> class : RasterLayer
> dimensions : 60, 200, 12000 (nrow, ncol, ncell)
> resolution : 0.5, 0.5 (x, y)
> extent : -70, 30, 50, 80 (xmin, xmax, ymin, ymax)
> coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0
> data source :
> /home/mpayne/Documents/Predictability_engine/scratch/Bluefin/HadISST/
> obs_climatology.nc
> names : sst
> z-value : 1988-02-15
> zvar : sst
>
> > mdl.anom
> class : RasterBrick
> dimensions : 60, 200, 12000, 1 (nrow, ncol, ncell, nlayers)
> resolution : 0.5, 0.5 (x, y)
> extent : -70, 30, 50, 80 (xmin, xmax, ymin, ymax)
> coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0
> data source :
>
> /home/mpayne/Documents/Predictability_engine/scratch/Bluefin/DCPP-hindcasts/IPSL-CM5A-LR/B.realmean/IPSL-CM5A-LR_S19610101_L00_realmean_
> anom.nc
>
> names : X1961.08.16
> Date : 1961-08-16
> varname : tos
>
> When I try to add them together, I get the follow error:
>
> > mdl.val <- obs.clim + mdl.anom
> Error in .readRowsNetCDF(x = x, row = row, nrows = nrows, col = col, ncols
> = ncols) :
> no slot of name "band" for this object of class ".MultipleRasterData"
> >
>
> I can reproduce, with netcf-file-backed bricks. I would try
>
> obs.clim[[1]] + mdl.anom[[1]]
>
> or
>
> readAll(obs.clim) + readAll(mdl.anom)
>
> those differ mainly in what will happen to multi-layer versions of the
> files, the first will give just the first layer. The key is breaking the
> file-read-delay, both objects have no data in memory but the add operation
> invalidates and causes read to occur - but with a bug - (I will check in
> dev raster and report if necessary).
>
> FYI, R-Sig-Geo is generally a better forum for spatial stuff:
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
> Cheers, Mike.
>
>
> I get the same error if I treat mdl.anom as a raster, or if they are both
> bricks. Any suggestions what could be going wrong? Installation details
> below
>
> Best wishes,
>
> Mark
>
> > R.version
> _
> platform x86_64-pc-linux-gnu
> arch x86_64
> os linux-gnu
> system x86_64, linux-gnu
> status
> major 3
> minor 4.2
> year 2017
> month 09
> day 28
> svn rev 73368
> language R
> version.string R version 3.4.2 (2017-09-28)
> nickname Short Summer
> >
> > packageDescription("raster")
> Package: raster
> Type: Package
> Title: Geographic Data Analysis and Modeling
> Version: 2.6-7
> Date: 2017-11-12
>
> > packageDescription("ncdf4")
> Package: ncdf4
> Version: 1.16
> Date: 2017-04-01
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> 
> and provide commented, minimal, self-contained, reproducible code.
> --
> Dr. Michael Sumner
> Software and Database Engineer
> Australian Antarctic Division
> 203 Channel Highway
> Kingston Tasmania 7050 Australia
>
> --
Dr. Michael Sumner
Software and Database Engineer
Australian Antarctic Division
203 Channel Highway
Kingston Tasmania 7050 Australia

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Last page on a multi page, faceted graph created using ggforce, loses its layout under a certain condition

2018-06-01 Thread Ashim Kapoor
Dear All,

I posted this query on stack overflow but I received no replies so I am
posting it here so that someone here can take a look at this.

My query is that suppose the variable I am faceting by has 40 categories
and I want 3 categories per page( 1 row x 3 columns),then the last category
fills the entire second page. I want the last category to fill only the
left - most position in the grid and the remaining 2 places to be empty on
the last page.

Here is the link to the stackoverflow query which has a reprex in it as
well:

https://stackoverflow.com/questions/50604211/facetting-a-graph-across-multiple-pages-and-keeping-the-same-layout-on-all-pag

Many thanks and Best Regards,
Ashim

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Time-series moving average question

2018-06-01 Thread Bill Poling
Good morning, I hope someone can help with these questions, or perhaps suggest 
one of the other R-lists?

I have two questions:


  1.  Why am I getting this warning?
  2.  Why is the second example "Point Forecast" the same value, I do not see 
that in previous attempts with similar but different data sets as in example 1?

Example1:
dat3 <- structure(c(3539122.86, 3081383.87, 4158672.31, 4137518.78, 4123682.08, 
4819375.2, 4342687.77, 5028674.58, 4472145.07, 4967277.73, 4516240.31, 
4876194.63, 4816446.59,
4887399.37, 5478504.85, 4871385.27, 5487543.68, 5464193.69, 
5252591.03, 7071416.89, 5524350.89, 6107166.69, 6530003.55, 6445929.08, 
7356743.81, 6750025.03,
6934714.08, 6656194.35

,-13913, -29385.31, -39633.37, -23487.13, -18202.86, 
-57335.49, -26061.45, -60880.07, -17589.45, -35970.08, -89133.94,
-84694.58, -31724.89, -29847.95, -65421.74, -34334.22, 
-48511.98, -30298.97, -38729.46, -29292.89, -46098.4, -65909.49,
-85879.23, -71845.28, -69017.07, -93161.03, -70847.29, 
-85106.04

,-357694.19, -444792.75, -361349.57, -386717.55, 
-547422.05, -518259.22, -417613.76, -578631.46, -804516.81, -572875.52, 
-510487.53,
-666294.87, -673233.37, -556564.45, -963346.75, -639288.2, 
-910104.23, -773428.8, -1008078.84, -546685.3, -729932.94, -987098.23,
-964001.63, -986995.93, -680066.58, -728854.58, -730766.92, 
-753861.59)
,.Dim = c(28L, 3L)
,.Dimnames = list(NULL, c("OONNetRev","OONAdjusted" 
,"OONCancelled"))
,.Tsp = c(2016, 2018.25, 12), class = c("mts", "ts", 
"matrix"))
head(dat3); nrow(dat3)

TNR_moving_average <- forecast(ma(dat3[1:28], order=3), h=8)
TNR_moving_average

# Warning message:
#   In ets(object, lambda = lambda, biasadj = biasadj, 
allow.multiplicative.trend = allow.multiplicative.trend,  :
#Missing values encountered. Using longest contiguous portion of 
time series
#  > Point Forecast Lo 80 Hi 80 Lo 95 
Hi 95
# 28  7007065.99688 6675015.72012 7339116.27365 6499238.92148 
7514893.07229
# 29  7135745.42473 6721543.41996 7549947.42950 6502278.12345 
7769212.72601
# 30  7264424.85258 6779532.18065 7749317.52450 6522845.50541 
8006004.19974
# 31  7393104.28042 6844496.10189 7941712.45896 6554080.47486 
8232128.08599
# 32  7521783.70827 6914203.11991 8129364.29663 6592569.38486 
8450998.03168
# 33  7650463.13612 6987355.72657 8313570.54567 6636327.86794 
8664598.40429
# 34  7779142.56396 7063123.29787 8495161.83005 6684085.59434 
8874199.53358
# 35  7907821.99181 7140937.69145 8674706.29217 6734973.66528 
9080670.31834




Example2:
dat3 <- structure(c(994320.58, 811664.54, 1045259.43, 951659.48, 669458.94, 
986741.09, 1023344.82, 938971.65, 897670.06, 1040074.6, 1090310.01,
1289821.17, 1187806.23, 971485.76, 1161147.42, 870585.04, 
1021301.52, 1215798.03, 1015004.43, 1365863.09, 995769.41,
1331725.36, 1271032.91, 1092103.82, 1297131.4, 1129195.28, 
1372594.58, 1553717.57,

-39811.51, -47356.74, -49046.86, -41311.13, -79063.98, 
-43916.59, -16746.33, -38347.9, -84797.44, -38961.44,
-72036.83, -62854.78, -35259.84, -44198.39, -34262.65, 
-49245.82, -34977.28, -36797.35, -47534.43, -33515.13,
-25764.41, -29130.53, -57693.63, -51026.83, -49624.49, 
-36508.13, -32667.21, -37900.5,

-247443.87, -372942.34, -344080.78, -355586.21, -458998.84, 
-378086.44, -333994.18, -567024.45, -521499.8, -428915.13,
-512034.28, -440865.42, -347494.22, -422436.19, -444588.65, 
-462891.57, -518395.47, -373818.5, -398899.53, -381573.69,
-531449.2, -476238.48, -434296.86, -655679.94, -528999.52, 
-423725.95, -556977.31, -518633.95)
  ,.Dim = c(28L, 3L)
  ,.Dimnames = list(NULL, c("EditNetRev","EditNetAdjusted" 
,"EditNetCancelled"))
  ,.Tsp = c(2016, 2018.25, 12), class = c("mts", "ts", 
"matrix"))
head(dat3); nrow(dat3)



TNR_moving_average <- forecast(ma(dat3[1:28], order=3), h=8)
TNR_moving_average

# Warning message:
# In ets(object, lambda = lambda, biasadj = biasadj, allow.multiplicative.trend 
= allow.multiplicative.trend,  :
#  Missing values encountered. Using longest contiguous portion of time 
series
#> TNR_moving_average
#Point Forecast Lo 80 Hi 80  Lo 95 Hi 95
#28  1351827.24389 1246570.02118 1457084.46661 1190850.213255 
1512804.27453
#29  1351827.24389 1202841.21791 1500813.26987 1123972.779844 
1579681.70794
#30  1351827.24389 1169192.03201 1534462.45578 1072510.790913 
1631143.69687
#31  1351827.24389 1140745.29674 1562909.19105 1029005.263624 
1674649.22416
#32  

Re: [R-es] predicciones sobre el OOB de randomForest

2018-06-01 Thread Manuel Mendoza



No, no, me equivoqué; para obtener las predicciones sobre el OOB es  
predict(mymodel).



No lo conozco, pero si me lo recomiendas tu, lo probaré ;-)

Por cierto, encontré la forma directa de obtener las predicciones  
sobre el OOB; tan sencillo como predict(mymodel, newdata=misdatos).



Quoting Carlos Ortega :


Y prefieres "randomForest" a "ranger"...??...


El 31 de mayo de 2018, 13:03, Manuel Mendoza 
escribió:


Gracias Carlos. No uso caret, pero lo miraré.



Quoting Carlos Ortega :

Hola,


Creo que si utilizas "caret" y en la función "trainControl()" defines
"oob"
como criterio de randomización, puedes luego recuperar del objeto del
modelo, las predicciones individuales...

Saludos,
Carlos Ortega
www.qualityexcellence.es



2018-05-31 12:56 GMT+02:00 Manuel Mendoza :



Muy buenas, ¿sabe alguien cómo obtener las predicciones sobre el out of
bag que hace randomForest?

Manuel



































.
--
Dr Manuel Mendoza
Department of Biogeography and Global Change
National Museum of Natural History (MNCN)
Spanish Scientific Council (CSIC)
C/ Serrano 115bis, 28006 MADRID
Spain

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es





--
Saludos,
Carlos Ortega
www.qualityexcellence.es




--
Dr Manuel Mendoza
Department of Biogeography and Global Change
National Museum of Natural History (MNCN)
Spanish Scientific Council (CSIC)
C/ Serrano 115bis, 28006 MADRID
Spain





--
Saludos,
Carlos Ortega
www.qualityexcellence.es



--
Dr Manuel Mendoza
Department of Biogeography and Global Change
National Museum of Natural History (MNCN)
Spanish Scientific Council (CSIC)
C/ Serrano 115bis, 28006 MADRID
Spain

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es



--
Dr Manuel Mendoza
Department of Biogeography and Global Change
National Museum of Natural History (MNCN)
Spanish Scientific Council (CSIC)
C/ Serrano 115bis, 28006 MADRID
Spain

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R-es] predicciones sobre el OOB de randomForest

2018-06-01 Thread Manuel Mendoza

No lo conozco, pero si me lo recomiendas tu, lo probaré ;-)

Por cierto, encontré la forma directa de obtener las predicciones  
sobre el OOB; tan sencillo como predict(mymodel, newdata=misdatos).



Quoting Carlos Ortega :


Y prefieres "randomForest" a "ranger"...??...


El 31 de mayo de 2018, 13:03, Manuel Mendoza 
escribió:


Gracias Carlos. No uso caret, pero lo miraré.



Quoting Carlos Ortega :

Hola,


Creo que si utilizas "caret" y en la función "trainControl()" defines
"oob"
como criterio de randomización, puedes luego recuperar del objeto del
modelo, las predicciones individuales...

Saludos,
Carlos Ortega
www.qualityexcellence.es



2018-05-31 12:56 GMT+02:00 Manuel Mendoza :



Muy buenas, ¿sabe alguien cómo obtener las predicciones sobre el out of
bag que hace randomForest?

Manuel



































.
--
Dr Manuel Mendoza
Department of Biogeography and Global Change
National Museum of Natural History (MNCN)
Spanish Scientific Council (CSIC)
C/ Serrano 115bis, 28006 MADRID
Spain

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es





--
Saludos,
Carlos Ortega
www.qualityexcellence.es




--
Dr Manuel Mendoza
Department of Biogeography and Global Change
National Museum of Natural History (MNCN)
Spanish Scientific Council (CSIC)
C/ Serrano 115bis, 28006 MADRID
Spain





--
Saludos,
Carlos Ortega
www.qualityexcellence.es



--
Dr Manuel Mendoza
Department of Biogeography and Global Change
National Museum of Natural History (MNCN)
Spanish Scientific Council (CSIC)
C/ Serrano 115bis, 28006 MADRID
Spain

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es