[Rd] arima.c bug?
Hello, Reading the code I have found that in the line 653 (Pnew[i + r * j] = tmp;) of http://svn.r-project.org/R/trunk/src/library/stats/src/arima.c (latest as of now) the multiplier for j is r instead of rd (which is the dimension of the matrix). Was it intentional? That seems at least worth a comment why it is the case instead of Pnew[i + rd * j] = tmp; Thanks and Kind Regards, gabor __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] arima.c bug?
On 2014. April 30. 15:13:05, Gabor Bakos wrote: > Hello, > >Reading the code I have found that in the line 653 (Pnew[i + r * j] = > tmp;) of http://svn.r-project.org/R/trunk/src/library/stats/src/arima.c > (latest as of now) the multiplier for j is r instead of rd (which is the > dimension of the matrix). Was it intentional? That seems at least worth > a comment why it is the case instead of Pnew[i + rd * j] = tmp; > Thanks and Kind Regards, gabor Sorry, I missed the if (d == 0) condition for that block. In that case rd == d, so this do not cause bugs, just a bit confusion for a short time. :) Thanks, gabor __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] ReplayPlot, limited to single session for RecordPlot()
R had an internal Plot format which could be saved in files and then reused. Just like one can save data.frames or lists of data which I routinely do could save plot which could be used for further elaboration and analysis. Thus you could modify a plot after you saved it. Matlab has a fig format which it uses for that purpose. The current version of R version 3 allows plots only to be used within a particular session. You can save it with recorded plot but you cannot reuse the old plot. I typically do 400 or 500 plots a session including diagnostic plots for the package rugarch which I routinely saved and reused. I had to modify my code to regenerate my plots on demand. If the internal format of a plot is so unstable that replaying i.e. displaying it damages R then the format needs to be entirely fixed. This is independent of the graphical devise used to display the plot. In fact the internal structure should be graphics devise independt and display on unix or windows or whatever OS it is created on. Either the internal format which should be redesigned, or the error message needs to be taken out of the format. This internal format if done right has two uses. First it produces plot which are modifyable unlike say svg() or pdf(). Second it should save space and be suitable for eloading into R. Regenerating these from data each time is an unnecessary waste of time as far as I can tell. Its hard to see why the developers did this. ---mike -- Michael Cohen Work: 808 Commonwealth Avenue, Actuarial Sciences, Boston Mass Home: 25 Stearns Road #3 Brookline, MA Ph: 1-857-389-3432(c) 1-617-758-5509(w) 617-734-8828(h) Fax: 617-353-7755 [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] Problem with Renaming R object
Hi, I have a problem in renaming R object and saving them within a loop. For ex: for (i in 1:length(all_files)) { uncov_GR <- "variable created in loop" filename <- paste0(sample_name[[i]],"_uncov", ".Rdata")) save(uncov_GR,file=filename) } Within the above short code (out of a long program), I want to change the name of "uncov_GR" variable to the file name and save it by same file name. But I am unable to come up with any solution to do so. I tried something like the code below: for (i in 1:length(all_files)) { uncov_GR <- "variable created in loop" filename <- paste0(sample_name[[i]],"_uncov", ".Rdata")) Objectout <- paste0(sample_name[[i]],"_uncov") assign(Objectout, uncov_GR) save(Objectout,file=filename) ### problem still persists with saving } Here I am able to make a copy of uncov_GR but I am unable to save the object again with the same filename. Any suggestions in this regard would be highly appreciated. Thanks. Regards, Kamal [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] Quantile issue
This is likely yet another instance of round off error, but it caught me by surprise. tmt% R --vanilla (headers skipped, version 3.0.2 on Linux) load('qtest.rda') length(temp) [1] 3622 max(temp) >= quantile(temp, .98) 98% FALSE I can send the file to anyone who would like to understand this more deeply. The top 3% of the vector is a single repeated value. Terry Therneau __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Problem with Renaming R object
This is not really a question for r-devel, but basically you should use saveRDS/readRDS rather than save/load. Hadley On Wednesday, April 30, 2014, Kamal wrote: > Hi, > > I have a problem in renaming R object and saving them within a loop. For > ex: > > for (i in 1:length(all_files)) > { > uncov_GR <- "variable created in loop" > filename <- paste0(sample_name[[i]],"_uncov", ".Rdata")) > save(uncov_GR,file=filename) > } > > Within the above short code (out of a long program), I want to change the > name of "uncov_GR" variable to the file name and save it by same file name. > But I am unable to come up with any solution to do so. > > I tried something like the code below: > > for (i in 1:length(all_files)) > { > uncov_GR <- "variable created in loop" > filename <- paste0(sample_name[[i]],"_uncov", ".Rdata")) >Objectout <- paste0(sample_name[[i]],"_uncov") >assign(Objectout, uncov_GR) >save(Objectout,file=filename) ### problem still persists with > saving > } > > Here I am able to make a copy of uncov_GR but I am unable to save the > object again with the same filename. Any suggestions in this regard would > be highly appreciated. > > Thanks. > > Regards, > Kamal > > [[alternative HTML version deleted]] > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > -- http://had.co.nz/ [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Problem with Renaming R object
save(list = Objectout, file = filename) On Wed, Apr 30, 2014 at 12:11 PM, Kamal wrote: > Hi, > > I have a problem in renaming R object and saving them within a loop. For > ex: > > for (i in 1:length(all_files)) > { > uncov_GR <- "variable created in loop" > filename <- paste0(sample_name[[i]],"_uncov", ".Rdata")) > save(uncov_GR,file=filename) > } > > Within the above short code (out of a long program), I want to change the > name of "uncov_GR" variable to the file name and save it by same file name. > But I am unable to come up with any solution to do so. > > I tried something like the code below: > > for (i in 1:length(all_files)) > { > uncov_GR <- "variable created in loop" > filename <- paste0(sample_name[[i]],"_uncov", ".Rdata")) >Objectout <- paste0(sample_name[[i]],"_uncov") >assign(Objectout, uncov_GR) >save(Objectout,file=filename) ### problem still persists with > saving > } > > Here I am able to make a copy of uncov_GR but I am unable to save the > object again with the same filename. Any suggestions in this regard would > be highly appreciated. > > Thanks. > > Regards, > Kamal > > [[alternative HTML version deleted]] > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Problem with Renaming R object
Thanks for your help. On Wed, Apr 30, 2014 at 7:26 PM, Kasper Daniel Hansen < kasperdanielhan...@gmail.com> wrote: > save(list = Objectout, file = filename) > > > > > On Wed, Apr 30, 2014 at 12:11 PM, Kamal wrote: > >> Hi, >> >> I have a problem in renaming R object and saving them within a loop. For >> ex: >> >> for (i in 1:length(all_files)) >> { >> uncov_GR <- "variable created in loop" >> filename <- paste0(sample_name[[i]],"_uncov", ".Rdata")) >> save(uncov_GR,file=filename) >> } >> >> Within the above short code (out of a long program), I want to change the >> name of "uncov_GR" variable to the file name and save it by same file >> name. >> But I am unable to come up with any solution to do so. >> >> I tried something like the code below: >> >> for (i in 1:length(all_files)) >> { >> uncov_GR <- "variable created in loop" >> filename <- paste0(sample_name[[i]],"_uncov", ".Rdata")) >>Objectout <- paste0(sample_name[[i]],"_uncov") >>assign(Objectout, uncov_GR) >>save(Objectout,file=filename) ### problem still persists with >> saving >> } >> >> Here I am able to make a copy of uncov_GR but I am unable to save the >> object again with the same filename. Any suggestions in this regard would >> be highly appreciated. >> >> Thanks. >> >> Regards, >> Kamal >> >> [[alternative HTML version deleted]] >> >> __ >> R-devel@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-devel >> > > [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] "Name partially matched in data frame"
R 3.1.0 OS X Colleagues, I recently updated to 3.1.0 and I have encountered Warning messages: ... Name partially matched in data frame when I do something like: DATAFRAME$colname where colname is actually something longer than that (but unambiguous). I have much appreciated the partial matching capabilities because it fits with my workflow. I often receive updated data months after the initial code is written. In order to keep track of what I did in the past, I provide lengthy (unambiguous) names for columns, then abbreviate the names as I call them. This behavior has been termed “lazy” in various correspondence on this mailing list but it works for me and probably works for others. I realize that the new message is only a warning but it is a minor nuisance. Would it be possible to add an option(partialMatch=TRUE) ## default is FALSE or something similar to suppress that behavior? That should keep both camps happy. Dennis Dennis Fisher MD P < (The "P Less Than" Company) Phone: 1-866-PLessThan (1-866-753-7784) Fax: 1-866-PLessThan (1-866-753-7784) www.PLessThan.com __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] "Name partially matched in data frame"
On 30/04/2014 3:03 PM, Fisher Dennis wrote: R 3.1.0 OS X Colleagues, I recently updated to 3.1.0 and I have encountered Warning messages: ... Name partially matched in data frame when I do something like: DATAFRAME$colname where colname is actually something longer than that (but unambiguous). I have much appreciated the partial matching capabilities because it fits with my workflow. I often receive updated data months after the initial code is written. In order to keep track of what I did in the past, I provide lengthy (unambiguous) names for columns, then abbreviate the names as I call them. This behavior has been termed “lazy” in various correspondence on this mailing list but it works for me and probably works for others. I realize that the new message is only a warning but it is a minor nuisance. Would it be possible to add an option(partialMatch=TRUE) ## default is FALSE or something similar to suppress that behavior? That should keep both camps happy. I'd be much happier with a general mechanism to suppress particular warnings. Then you could choose to suppress this one. We might be able to do that with options("warning.expression"), but I don't see how... Duncan Murdohc __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] "Name partially matched in data frame"
On Wed, Apr 30, 2014 at 3:33 PM, Scott Kostyshak wrote: > Hi Dennis, > > On Wed, Apr 30, 2014 at 3:03 PM, Fisher Dennis wrote: >> R 3.1.0 >> OS X >> >> Colleagues, >> >> I recently updated to 3.1.0 and I have encountered >> Warning messages: ... Name partially matched in data frame >> when I do something like: >> DATAFRAME$colname >> where colname is actually something longer than that (but unambiguous). >> >> I have much appreciated the partial matching capabilities because it fits >> with my workflow. I often receive updated data months after the initial >> code is written. In order to keep track of what I did in the past, I >> provide lengthy (unambiguous) names for columns, then abbreviate the names >> as I call them. This behavior has been termed “lazy” in various >> correspondence on this mailing list but it works for me and probably works >> for others. > > Why not store that information elsewhere? e.g. in an attribute? > >> I realize that the new message is only a warning but it is a minor nuisance. >> Would it be possible to add an >> option(partialMatch=TRUE) ## default is FALSE >> or something similar to suppress that behavior? That should keep both camps >> happy. > > There is currently no option to control that behavior and (although I > do understand your use case) I personally hope one is not implemented. > The reason is that you might put that option in your .Rprofile and > when you share your code with me I get errors that columns aren't > found. Let me change this to "I would get warnings, which would make me worried." > You can of course redefine the `$`: > >> dataf <- data.frame(longColumn = 5) >> dataf$long > [1] 5 > Warning message: > In `$.data.frame`(dataf, long) : Name partially matched in data frame >> >> `$.data.frame` <- > + function (x, name) > + { > + a <- x[[name]] > + if (!is.null(a)) > + return(a) > + a <- x[[name, exact = FALSE]] > + return(a) > + } >> >> dataf$long > [1] 5 >> > > I hope you don't do that though. > > Another option is to use the more verbose dataf[["long", exact = FALSE]]. > > Scott > > > -- > Scott Kostyshak > Economics PhD Candidate > Princeton University Scott -- Scott Kostyshak Economics PhD Candidate Princeton University __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] "Name partially matched in data frame"
Hi Dennis, On Wed, Apr 30, 2014 at 3:03 PM, Fisher Dennis wrote: > R 3.1.0 > OS X > > Colleagues, > > I recently updated to 3.1.0 and I have encountered > Warning messages: ... Name partially matched in data frame > when I do something like: > DATAFRAME$colname > where colname is actually something longer than that (but unambiguous). > > I have much appreciated the partial matching capabilities because it fits > with my workflow. I often receive updated data months after the initial code > is written. In order to keep track of what I did in the past, I provide > lengthy (unambiguous) names for columns, then abbreviate the names as I call > them. This behavior has been termed “lazy” in various correspondence on this > mailing list but it works for me and probably works for others. Why not store that information elsewhere? e.g. in an attribute? > I realize that the new message is only a warning but it is a minor nuisance. > Would it be possible to add an > option(partialMatch=TRUE) ## default is FALSE > or something similar to suppress that behavior? That should keep both camps > happy. There is currently no option to control that behavior and (although I do understand your use case) I personally hope one is not implemented. The reason is that you might put that option in your .Rprofile and when you share your code with me I get errors that columns aren't found. You can of course redefine the `$`: > dataf <- data.frame(longColumn = 5) > dataf$long [1] 5 Warning message: In `$.data.frame`(dataf, long) : Name partially matched in data frame > > `$.data.frame` <- + function (x, name) + { + a <- x[[name]] + if (!is.null(a)) + return(a) + a <- x[[name, exact = FALSE]] + return(a) + } > > dataf$long [1] 5 > I hope you don't do that though. Another option is to use the more verbose dataf[["long", exact = FALSE]]. Scott -- Scott Kostyshak Economics PhD Candidate Princeton University __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] "Name partially matched in data frame"
>> I realize that the new message is only a warning but it is a minor >> nuisance. Would it be possible to add an >> option(partialMatch=TRUE) ## default is FALSE >> or something similar to suppress that behavior? That should keep both >> camps happy. > > > I'd be much happier with a general mechanism to suppress particular > warnings. Then you could choose to suppress this one. > > We might be able to do that with options("warning.expression"), but I don't > see how... One approach would be to take advantage of the fact that warnings conditions are S3 objects and can have a class hierarchy. Hadley -- http://had.co.nz/ __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] "Name partially matched in data frame"
Hi, Would be good to have the man page updated about this. It still says: 'x$name' is equivalent to 'x[["name", exact=FALSE]]' which doesn't seem to be completely true anymore (the former emits a warning in case of partial matching, not the latter). It looks like for a data.frame, ‘x$name’ is now equivalent to 'x[["name", exact=NA]]': > data.frame(aa=1:3)$a [1] 1 2 3 Warning message: In `$.data.frame`(data.frame(aa = 1:3), a) : Name partially matched in data frame > data.frame(aa=1:3)[["a", exact=NA]] [1] 1 2 3 Warning message: In .subset2(x, i, exact = exact) : partial match of 'a' to 'aa' except that, instead of just calling 'x[["name", exact=NA]]' internally, the former comes up with its own (and less informative) error message. Cheers, H. > sessionInfo() R version 3.1.0 (2014-04-10) Platform: x86_64-unknown-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base On 04/30/2014 12:32 PM, Duncan Murdoch wrote: On 30/04/2014 3:03 PM, Fisher Dennis wrote: R 3.1.0 OS X Colleagues, I recently updated to 3.1.0 and I have encountered Warning messages: ... Name partially matched in data frame when I do something like: DATAFRAME$colname where colname is actually something longer than that (but unambiguous). I have much appreciated the partial matching capabilities because it fits with my workflow. I often receive updated data months after the initial code is written. In order to keep track of what I did in the past, I provide lengthy (unambiguous) names for columns, then abbreviate the names as I call them. This behavior has been termed “lazy” in various correspondence on this mailing list but it works for me and probably works for others. I realize that the new message is only a warning but it is a minor nuisance. Would it be possible to add an option(partialMatch=TRUE)## default is FALSE or something similar to suppress that behavior? That should keep both camps happy. I'd be much happier with a general mechanism to suppress particular warnings. Then you could choose to suppress this one. We might be able to do that with options("warning.expression"), but I don't see how... Duncan Murdohc __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel -- Hervé Pagès Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N, M1-B514 P.O. Box 19024 Seattle, WA 98109-1024 E-mail: hpa...@fhcrc.org Phone: (206) 667-5791 Fax:(206) 667-1319 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] "Name partially matched in data frame"
Also the real agenda behind this warning is not clear. Looks like just a normal warning, providing some potentially useful/important information to the user. However, in the NEWS file, this entry is in the DEPRECATED AND DEFUNCT section: \item Partial matching when using the \code{$} operator \emph{on data frames} now throws a warning and may become defunct in the future. If partial matching is intended, replace \code{foo$bar} by \code{foo[["bar", exact = FALSE]]}. Even though it's not deprecated yet... H. On 04/30/2014 03:34 PM, Hervé Pagès wrote: Hi, Would be good to have the man page updated about this. It still says: 'x$name' is equivalent to 'x[["name", exact=FALSE]]' which doesn't seem to be completely true anymore (the former emits a warning in case of partial matching, not the latter). It looks like for a data.frame, ‘x$name’ is now equivalent to 'x[["name", exact=NA]]': > data.frame(aa=1:3)$a [1] 1 2 3 Warning message: In `$.data.frame`(data.frame(aa = 1:3), a) : Name partially matched in data frame > data.frame(aa=1:3)[["a", exact=NA]] [1] 1 2 3 Warning message: In .subset2(x, i, exact = exact) : partial match of 'a' to 'aa' except that, instead of just calling 'x[["name", exact=NA]]' internally, the former comes up with its own (and less informative) error message. Cheers, H. > sessionInfo() R version 3.1.0 (2014-04-10) Platform: x86_64-unknown-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base On 04/30/2014 12:32 PM, Duncan Murdoch wrote: On 30/04/2014 3:03 PM, Fisher Dennis wrote: R 3.1.0 OS X Colleagues, I recently updated to 3.1.0 and I have encountered Warning messages: ... Name partially matched in data frame when I do something like: DATAFRAME$colname where colname is actually something longer than that (but unambiguous). I have much appreciated the partial matching capabilities because it fits with my workflow. I often receive updated data months after the initial code is written. In order to keep track of what I did in the past, I provide lengthy (unambiguous) names for columns, then abbreviate the names as I call them. This behavior has been termed “lazy” in various correspondence on this mailing list but it works for me and probably works for others. I realize that the new message is only a warning but it is a minor nuisance. Would it be possible to add an option(partialMatch=TRUE)## default is FALSE or something similar to suppress that behavior? That should keep both camps happy. I'd be much happier with a general mechanism to suppress particular warnings. Then you could choose to suppress this one. We might be able to do that with options("warning.expression"), but I don't see how... Duncan Murdohc __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel -- Hervé Pagès Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N, M1-B514 P.O. Box 19024 Seattle, WA 98109-1024 E-mail: hpa...@fhcrc.org Phone: (206) 667-5791 Fax:(206) 667-1319 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel