Re: [R] Vectorizing a for-loop for cross-validation in R

2019-01-23 Thread Aleksandre Gavashelishvili
Before posting on the r-help list I did run Rprof(). In my posting I asked for help with re-writing the specific script into sapply() or foreach()/doParallel format. Thanks anyway for your time and suggestions, Lexo On Thu, Jan 24, 2019 at 12:38 AM Eric Berger wrote: > Charles writes about

Re: [R] Unable to compute Confidence Intervals from output from MARSS package

2019-01-23 Thread Ashim Kapoor
Dear Bill, Appreciate all your effort. I hope some one here can respond to this query. Many thanks, Ashim On Thu, Jan 24, 2019 at 12:49 AM Bill Poling wrote: > > Ashim. > > I see where I was mistaken, using MARSSparamsCIs(fit) <--Somehow I got an > s in between param & Cis. > > I now get

Re: [R] Error "sufficient values in manual scale. 10 needed but only 7 provided"

2019-01-23 Thread greg holly
Hi Jeff; I figured out the problem. I do apologize to you and members in the list to bother you with this simple problem. Regards, Greg On Wed, Jan 23, 2019 at 6:46 PM Jeff Newmiller wrote: > Problem is in your data not matching your values, but you did not share > your data. Try using the

Re: [R] Error "sufficient values in manual scale. 10 needed but only 7 provided"

2019-01-23 Thread Jeff Newmiller
Problem is in your data not matching your values, but you did not share your data. Try using the unique() function to see what values you have in your data. I will say that when I want to assign discrete colors I always start by converting my character column in the data frame to a factor and

[R] Error "sufficient values in manual scale. 10 needed but only 7 provided"

2019-01-23 Thread greg holly
Hi Dear all; I am getting the "sufficient values in manual scale. 10 needed but only 7 provided." problem when running the followings. Your help is highly appreciated. Regards, Greg p2<-p1+scale_color_manual(name="Diseases", labels=c("Myocardial Infarction", "Coronary artery disease", "Stroke",

Re: [R] read_xl question

2019-01-23 Thread Ista Zahn
Something like files <- list.files(pattern="*.xls", full.names = TRUE) data <- lapply(files, read_excel, sheet="Flow Data", range=("b9:c10")) should do it. --Ista On Wed, Jan 23, 2019 at 12:42 PM Thomas Subia via R-help wrote: > > > Colleagues, > > I have a workbook which has 3 worksheets >

Re: [R] Vectorizing a for-loop for cross-validation in R

2019-01-23 Thread Eric Berger
Charles writes about saving execution time by eliminating redundancies. If you see redundancies related to calling a time-consuming function multiple times with the same arguments, a very easy way to speed up your program is to memoise the functions using the package memoise. HTH, Eric On

Re: [R] Unable to compute Confidence Intervals from output from MARSS package

2019-01-23 Thread Bill Poling
Ashim. I see where I was mistaken, using MARSSparamsCIs(fit) <--Somehow I got an s in between param & Cis. I now get new error similarly as you, my apologies. final <- MARSSparamCIs(fit) Error in dpari[time.varying] <- dparmat(MLEobj, time.varying, t = t) : replacement has length zero

Re: [R] Unable to compute Confidence Intervals from output from MARSS package

2019-01-23 Thread Bill Poling
sessionInfo() #R version 3.5.2 (2018-12-20) #Platform: x86_64-w64-mingw32/x64 (64-bit) #Running under: Windows >= 8 x64 (build 9200) Hello Ashim. I am not familiar with the MARSS pkg, however, I am always interested in following many of these R-Help questions and often run them for my own

Re: [R] Packages

2019-01-23 Thread Duncan Murdoch
On 23/01/2019 12:27 p.m., AbouEl-Makarim Aboueissa wrote: here is the messages I got when I install the "car" package: You didn't install it, you got errors during the install. I'm not sure why there was no attempt to install Rcpp (which was required by rio, see the error message). Perhaps

Re: [R] Vectorizing a for-loop for cross-validation in R

2019-01-23 Thread Berry, Charles
See inline. > On Jan 23, 2019, at 2:17 AM, Aleksandre Gavashelishvili > wrote: > > I'm trying to speed up a script that otherwise takes days to handle larger > data sets. So, is there a way to completely vectorize or paralellize the > following script: > >*# k-fold cross

Re: [R] Packages

2019-01-23 Thread Neal Fultz
I'd recommend you upgrade to R version 3.5.2, the version you have is quite out of date. On Wed, Jan 23, 2019 at 9:42 AM AbouEl-Makarim Aboueissa < abouelmakarim1...@gmail.com> wrote: > here is the messages I got when I install the "car" package: > > > install.packages("car") > Installing

[R] read_xl question

2019-01-23 Thread Thomas Subia via R-help
Colleagues,  I have a workbook which has 3 worksheets I need to extract data from two specific cells from one ofthose worksheets.   I can use read_excel to do this for one file. data<-read_excel("C:/Desktop/Excel_raw_data/0020-49785 8768.xls", sheet="Flow

Re: [R] Packages

2019-01-23 Thread AbouEl-Makarim Aboueissa
here is the messages I got when I install the "car" package: > install.packages("car") Installing package into ‘C:/Users/aaboueissa/Documents/R/win-library/3.3’ (as ‘lib’ is unspecified) also installing the dependency ‘rio’ There are binary versions available but the source versions are

Re: [R] Function in default parameter value closing over variables defined later in the enclosing function

2019-01-23 Thread Jan T Kim via R-help
Hi Duncan, On Wed, Jan 23, 2019 at 10:02:00AM -0500, Duncan Murdoch wrote: > On 23/01/2019 5:27 a.m., Jan T Kim wrote: > >Hi Ivan & All, > > > >R's scoping system basically goes to all environments along the call > >stack when trying to resolve an unbound variable, see the language > >definition

Re: [R] Packages

2019-01-23 Thread Duncan Murdoch
On 23/01/2019 12:13 p.m., AbouEl-Makarim Aboueissa wrote: Dear All: After installing the packages "car" and "alr3", I got the following error messages: library(car) Error in library(car) : there is no package called ‘car’ library(alr3) Error in library(alr3) : there is no package called

[R] Packages

2019-01-23 Thread AbouEl-Makarim Aboueissa
Dear All: After installing the packages "car" and "alr3", I got the following error messages: > library(car) Error in library(car) : there is no package called ‘car’ > library(alr3) Error in library(alr3) : there is no package called ‘alr3’ any helps would be appreciated. with many thanks

[R] Vectorizing a for-loop for cross-validation in R

2019-01-23 Thread Aleksandre Gavashelishvili
I'm trying to speed up a script that otherwise takes days to handle larger data sets. So, is there a way to completely vectorize or paralellize the following script: *# k-fold cross validation* df <- trees # a data frame 'trees' from R. df <- df[sample(nrow(df)), ] # randomly

Re: [R] calculating quintile values of numeric data?

2019-01-23 Thread David L Carlson
Also quantile() and cut(). The only tricky part is making sure the minimum and maximum values are included. > set.seed(42) > x <- rnorm(100, 25, 3) > bks <- quantile(x, prob=c(0, .2, .4, .6, .8, 1)) > y <- cut(x, breaks=bks, labels=1:5, include.lowest=TRUE) > table(y) y 1 2 3 4 5 20 20 20

Re: [R] Function in default parameter value closing over variables defined later in the enclosing function

2019-01-23 Thread Duncan Murdoch
On 23/01/2019 5:27 a.m., Jan T Kim wrote: Hi Ivan & All, R's scoping system basically goes to all environments along the call stack when trying to resolve an unbound variable, see the language definition [1], section 4.3.4, and perhaps also 2.1.5. You are misinterpreting that section. It's

Re: [R] Function in default parameter value closing over variables defined later in the enclosing function

2019-01-23 Thread Duncan Murdoch
On 23/01/2019 4:53 a.m., Ivan Krylov wrote: Hi! I needed to generalize a loss function being optimized inside another function, so I made it a function argument with a default value. It worked without problems, but later I noticed that the inner function, despite being defined in the function

Re: [R] large number of scrollable histograms....

2019-01-23 Thread Bill Poling
Hi akshay Kulkarni, I just worked through this great tutorial the other day, hope this helps! WHP https://www.r-bloggers.com/how-to-combine-multiple-ggplot-plots-to-make-publication-ready-plots/ From: R-help On Behalf Of Eric Berger Sent: Tuesday, January 22, 2019 8:59 AM To: PIKAL Petr

[ESS] Problem with R help buffers

2019-01-23 Thread Henric Winell via ESS-help
Hi, There's something strange going on with the R help buffers. I'm using the latest ess-20190122.2108 from melpa, but it's not particular to that version: I want each help buffer to appear in its own separate frame, and have '(ess-help-own-frame t) '(ess-help-reuse-window nil) in my

Re: [R] Function in default parameter value closing over variables defined later in the enclosing function

2019-01-23 Thread Jan T Kim
Hi Ivan & All, R's scoping system basically goes to all environments along the call stack when trying to resolve an unbound variable, see the language definition [1], section 4.3.4, and perhaps also 2.1.5. Generally, unbound variables should be used with care. It's a bit difficult to decide

[R] Function in default parameter value closing over variables defined later in the enclosing function

2019-01-23 Thread Ivan Krylov
Hi! I needed to generalize a loss function being optimized inside another function, so I made it a function argument with a default value. It worked without problems, but later I noticed that the inner function, despite being defined in the function arguments, somehow closes over a variable

Re: [R] large number of scrollable histograms....

2019-01-23 Thread PIKAL Petr
Hi Yes, you should get multipage pdf, each page populated by single call to plot function. However I am not sur if your proposal with function will work. I usually do simply pdf("sample.pdf", 7, 5) for (i in 1:n) { hist(L[[i]]) } dev.off() Cheers Petr From: akshay kulkarni Sent:

Re: [R] calculating quintile values of numeric data? Alexandros Kouretsis

2019-01-23 Thread Alexandros Kouretsis
cut can do the job q_prob <- seq(0, 1, 0.2) cut(x, breaks = quantile(x, probs = q_prob), include.lowest = T , labels = 1:5) [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see