Re: [R] Error Awareness

2021-12-23 Thread Avi Gross via R-help
Stephen, It is becoming a pattern here. You have been told R allows ways to check for errors as the code is interpreted and this DOES NOT distinguish between development aspects and in the field. It does not matter if a problem is external like a required file not being in place or having a new n

Re: [R] .Rdata not loading

2021-12-23 Thread Bill Dunlap
And a fourth thing to do: * dput(tail(n=20, readBin(".RData", what=raw(), n=file.size(".RData" This can show if the file got truncated. -Bill On Thu, Dec 23, 2021 at 5:25 PM Bill Dunlap wrote: > Three things you might try using R (and show the results in this email > thread): > > * load(v

Re: [R] .Rdata not loading

2021-12-23 Thread Bill Dunlap
Three things you might try using R (and show the results in this email thread): * load(verbose=TRUE, ".RData") # see how far it gets before stopping * file.info(normalizePath(".RData")) # is this the file you think it is? * dput(readBin(".RData", what=raw(), n=100)) The last will print some hex n

Re: [R] .Rdata not loading

2021-12-23 Thread Rich Shepard
On Thu, 23 Dec 2021, Jeff Newmiller wrote: This practice (saving and resuming from Rdata files) often ends badly this way. Objects that are "shared" in memory get saved as separate data and may not "fit" when re-loaded. This is why re-running from scratch should always be part of your workflow.

Re: [R] .Rdata not loading

2021-12-23 Thread Jeff Newmiller
This practice (saving and resuming from Rdata files) often ends badly this way. Objects that are "shared" in memory get saved as separate data and may not "fit" when re-loaded. This is why re-running from scratch should always be part of your workflow. There are caching approaches that track ind

Re: [R] Request for help in solving an optimization problem

2021-12-23 Thread Bert Gunter
1. This ia a plain text list. No html. 2. Looks like homework. We don't do homework here. 3. Please read the posting guide. This is R-Help, not "R we do your work for you." We expect posters to show us their efforts to solve their problems. (In R, not Excel of course). 4. See here for R optimiza

[R] .Rdata not loading

2021-12-23 Thread Rich Shepard
Each time I finish with a session I save the image. Today the saved image did not load and manually running 'load('.RData') fails: load('.RData') Error in load(".RData") : ReadItem: unknown type 0, perhaps written by later version of R This has not happened before. Installed is R-4.1.2-x8

[R] Request for help in solving an optimization problem

2021-12-23 Thread Amarjeet Kumar
Dear All. Warm greetings to you. I need help in solving an optimization formulation in R software. I tried to solve it in excel solver but it was going up to local minimum using GRG nonlinear solving method. I thought R can help in solving this problem so I am explaining the problem in few sentenc

Re: [R] Error Awareness

2021-12-23 Thread Jeff Newmiller
You still are not exhibiting signs of understanding Bert's response, and your question is vague, particularly to the extent that it could be pertinent to the R language (and therefore to the topic of this list). R itself just raises an error condition that custom tryCatch or default handling wil

Re: [R] Script Run Output Capturing

2021-12-23 Thread Stephen H. Dawson, DSL via R-help
Thank you, Rasmus. I appreciate the reply. *Stephen Dawson, DSL* /Executive Strategy Consultant/ Business & Technology +1 (865) 804-3454 http://www.shdawson.com On 12/23/21 10:00 AM, Rasmus Liland wrote: sink and capture.output seem useful, but I have not used them.

Re: [R] Adding SORT to UNIQUE

2021-12-23 Thread Stephen H. Dawson, DSL via R-help
Hi Duncan, Thanks for the reply. You bring much insight to the equation of the R journey. I look forward to dialoging with you. *Stephen Dawson, DSL* /Executive Strategy Consultant/ Business & Technology +1 (865) 804-3454 http://www.shdawson.com On 12/22/21 12:12

Re: [R] Adding SORT to UNIQUE

2021-12-23 Thread Stephen H. Dawson, DSL via R-help
Hi Avi, Thanks for the reply. You bring much insight to the equation of the R journey. I look forward to dialoging with you. Kindest Regards, *Stephen Dawson, DSL* /Executive Strategy Consultant/ Business & Technology +1 (865) 804-3454 http://www.shdawson.com On 1

Re: [R] Script Run Output Capturing

2021-12-23 Thread Stephen H. Dawson, DSL via R-help
I have not tired sink yet. I was asking for best processes by soliciting input from others who have succeeded in this effort before. My question is more conceptual in nature, a research point, to learn more about the strengths and weaknesses of options. *Stephen Dawson, DSL* /Executive Strate

Re: [R] Error Awareness

2021-12-23 Thread Stephen H. Dawson, DSL via R-help
Hi Bert, Thanks for the reply. The use case I presented involves working code, not diagnosing a script in development. The concern is running a script where something changes outside of the script, as I stated. An example of a change is a data source changing perhaps the columns in the dat

Re: [R] Script Run Output Capturing

2021-12-23 Thread Bert Gunter
?sink explicitly says: "sink diverts R output to a connection (and stops such diversions)" Is this not exactly what you requested? If not, why not? Have you tried it to see? Bert Gunter On Thu, Dec 23, 2021 at 5:28 AM Stephen H. Dawson, DSL via R-help wrote: > > Nice! Thanks for the reply. > >

Re: [R] Error Awareness

2021-12-23 Thread Bert Gunter
?tryCatch This list is not meant for tutorials. A web search on "find errors in R code" brought up what appeared to be many resources to address your question. Please make use of such resources before posting here. Also, please read and follow the posting gui)de linked below to find out what sort

Re: [R] Script Run Output Capturing

2021-12-23 Thread Rasmus Liland
sink and capture.output seem useful, but I have not used them. I looked into pipe() a long time ago ... __ 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

Re: [R] able to estimate in the excel but not in R, any suggestion?

2021-12-23 Thread jim holtman
Glad to help! Happy Holidays Thanks 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 Wed, Dec 22, 2021 at 11:12 PM Marna Wagley wrote: > > Dear Jim, > Thank you very much for the help. The code seems to b

Re: [R] Script Run Output Capturing

2021-12-23 Thread Stephen H. Dawson, DSL via R-help
Nice! Thanks for the reply. I will research over the next few days. https://www.ssc.wisc.edu/~hemken/Rworkshops/interface/savingoutput.html How about the sink() and capture.output() functions? Have you ever used them? *Stephen Dawson, DSL* /Executive Strategy Consultant/ Business & Technolo

Re: [R] Speed up studentized confidence intervals ?

2021-12-23 Thread Rui Barradas
Hello, The code is running very slowly because you are recreating the function in the replicate() loop and because you are creating a data.frame also in the loop. And because in the bootstrap statistic function med() you are computing the variance of yet another loop. This is probably statis

Re: [R] Script Run Output Capturing

2021-12-23 Thread Rasmus Liland
Dear Stephen, Maybe running R in batch mode is what you're after? E.g. running R CMD BATCH ./process/script-name.r creates ./process/script-name.Rout (or ./process/script-name.rout ?) with output of R commands and inline output, I think stderr (maybe others? Not only stdout like

[R] Error Awareness

2021-12-23 Thread Stephen H. Dawson, DSL via R-help
Hi, I am thinking about awareness of errors when an R script runs. My concern is I have an error-free script. I run it for months on end without problems. Then, something changes somewhere causing an error. My wonderment is how R will tell me I had an error in the script, but the rest of the

[R] Script Run Output Capturing

2021-12-23 Thread Stephen H. Dawson, DSL via R-help
Hi, I need to capture the output in a physical file when I run an R script. I would like to capture the output as a TXT file. I am thinking something along the line of the tee command is what I am after, but I am not certain what I am after here. https://en.wikipedia.org/wiki/Tee_(command)

Re: [R] Adding SORT to UNIQUE

2021-12-23 Thread Stephen H. Dawson, DSL via R-help
Yes, I saw the period character is where the problem occurred. However, I decided to loop back with the poster to close the discussion loop. *Stephen Dawson, DSL* /Executive Strategy Consultant/ Business & Technology +1 (865) 804-3454 http://www.shdawson.com On 12/22