Re: [R] Error Awareness

2021-12-24 Thread Richard O'Keefe
You want to read this: http://adv-r.had.co.nz/Exceptions-Debugging.html It describes all the ways that R can report a problem and all the ways you can catch such a report while still in R. Let me heartily recommend the whole site, or better yet, the book

Re: [R] question about for loop

2021-12-24 Thread Kai Yang via R-help
Thanks Avi. This is a good idea. I'm learning how to create a function in R now and may have more questions for you. I really apricate all of your help.  Wish you have a great holiday and happy new year !Kai On Friday, December 24, 2021, 04:54:36 PM PST, Avi Gross via R-help wrote:

Re: [R] question about for loop

2021-12-24 Thread Avi Gross via R-help
Suggestion to consider another approach: Once various errors are fixed, the program being done basically sounds like you want to repeat a sequence of actions one per ROW of a data.frame. As it happens, the action to perform is based on a second data.frame given to ggplot, with parts dynamically

Re: [R] question about for loop

2021-12-24 Thread Kai Yang via R-help
Thanks Andrew. This is super helpful. --- Kai On Friday, December 24, 2021, 02:37:14 PM PST, Andrew Simmons wrote: y, c, and f only exist in the context of mac2If you want to use them, you'll have to write mac2$y, mac2$c, or mac2$f (or the [[ versions mac2[["y"]], mac2[["c"]], or

Re: [R] question about for loop

2021-12-24 Thread Andrew Simmons
y, c, and f only exist in the context of mac2 If you want to use them, you'll have to write mac2$y, mac2$c, or mac2$f (or the [[ versions mac2[["y"]], mac2[["c"]], or mac2[["f"]]) Combining that with index i would then look like mac2$y[[i]] or mac2[[i, "y"]] Also, I think you want to use

[R] question about for loop

2021-12-24 Thread Kai Yang via R-help
Hello Team, I create a csv file (mac2) to save parameter values. the file looks like: y,c,f hwy,cyl,hwy_cyl2 cty,class,cty_class2 Then I load the file into R and apply the parameters y, c, f in for loop, see my code below: library(ggplot2) library(tidyverse) library(readr) mac2 <-

Re: [R] .Rdata not loading

2021-12-24 Thread Rich Shepard
On Fri, 24 Dec 2021, Jeff Newmiller wrote: The qsave/qread functions from the qs package are functionally interchangeable with saveRDS/readRDS, but faster and create smaller files. A simple if ( file.exists( "obj1.qs" ) ) { obj1 <- qread( "onj1.qs" ) } else { obj1 <- compute_obj1()

Re: [R] .Rdata not loading

2021-12-24 Thread Rich Shepard
On Fri, 24 Dec 2021, Rui Barradas wrote: Can section Adoption of this Library of Congress link https://www.loc.gov/preservation/digital/formats/fdd/fdd000470.shtml help? I'm really not sure. Rui, After reading that interesting page I don't see how it helps me. I think that re-running all my

Re: [R] .Rdata not loading

2021-12-24 Thread Jeff Newmiller
The qsave/qread functions from the qs package are functionally interchangeable with saveRDS/readRDS, but faster and create smaller files. A simple if ( file.exists( "obj1.qs" ) ) { obj1 <- qread( "onj1.qs" ) } else { obj1 <- compute_obj1() qsave( obj1, "obj1.qs" ) } can be

Re: [R] .Rdata not loading

2021-12-24 Thread Rui Barradas
Hello, Can section Adoption of this Library of Congress link https://www.loc.gov/preservation/digital/formats/fdd/fdd000470.shtml help? I'm really not sure. Happy Holidays, Rui Barradas Às 16:31 de 24/12/21, Rich Shepard escreveu: On Fri, 24 Dec 2021, Adrian Dușa wrote: Package admisc

Re: [R] Error Awareness

2021-12-24 Thread Avi Gross via R-help
Stephen, I actually happen to like debates and abstractions especially covering multiple languages and domains but not HERE. As you note, some people created this forum for several purposes but the word HELP should provide a clue as to the main purpose. It is not meant to teach R or do

Re: [R] .Rdata not loading

2021-12-24 Thread Rich Shepard
On Fri, 24 Dec 2021, Adrian Dușa wrote: Package admisc has a function called obj.rda(), which returns the names of the objects from an .Rdata file. Not sure how it handles corrupt .Rdata files, but should generally give an idea about what's inside. Adrian, Thank you. I know what dataframes

Re: [R] .Rdata not loading

2021-12-24 Thread Adrian Dușa
On Fri, 24 Dec 2021 at 17:35, Rich Shepard wrote: > On Fri, 24 Dec 2021, Rasmus Liland wrote: > > > If you want to look at Rdata-files in a quick way in the > > terminal, use this little gem in your .zshrc.local: > > > > readrdata() { Rscript -e "options(width=$COLUMNS); load('$1'); >

Re: [R] .Rdata not loading

2021-12-24 Thread Rich Shepard
On Fri, 24 Dec 2021, Rasmus Liland wrote: If you want to look at Rdata-files in a quick way in the terminal, use this little gem in your .zshrc.local: readrdata() { Rscript -e "options(width=$COLUMNS); load('$1'); sapply(ls(), get, simplify=F)" | less } Rasmus, I use bash, not zsh. And

Re: [R] Error Awareness

2021-12-24 Thread Stephen H. Dawson, DSL via R-help
Thank you, Avi. I appreciate your reply. I agree maturing code is the best move to answer this interrogatory. I express deep thanks for contextualizing your response. I also agree with you responses are becoming a pattern here. A post of an open-ended question regarding either a conceptual or

Re: [R] .Rdata not loading

2021-12-24 Thread Rasmus Liland
Dear Rich, If you want to look at Rdata-files in a quick way in the terminal, use this little gem in your .zshrc.local: readrdata() { Rscript -e "options(width=$COLUMNS); load('$1'); sapply(ls(), get, simplify=F)" | less } Merry Christmas! Best, Rasmus

Re: [R] .Rdata not loading

2021-12-24 Thread Rich Shepard
On Thu, 23 Dec 2021, Bill Dunlap wrote: Three things you might try using R (and show the results in this email thread): Bill, * load(verbose=TRUE, ".RData") # see how far it gets before stopping load(verbose=TRUE, ".RData") Loading objects: all_turb_plot disc_all Error in load(verbose