Re: [R] [R-devel] Source Code for function

2019-09-06 Thread Bert Gunter
It is time to end these queries and start your homework by consulting the references you have already been given. Wickham's goes into all of this; the R Language Definition that ships with R covers all of your questions and more in detail; and numerous online references and tutorials -- A search on

Re: [R] [R-devel] Source Code for function

2019-09-06 Thread Golden, Shelby
Afternoon, Peter, Thank you for your concise but informative reply, and for a link to the source code. These complex concepts do answer my question spot on, so thank you for taking the time to put them all together and summarizing them for me. Is the standard nomenclature for arguments in funct

Re: [R] [R-devel] Source Code for function

2019-09-06 Thread peter dalgaard
Um... Let's get the concepts straight: The "function" function doesn't evaluate anything. It just takes the list of formal arguments (including default expressions), the function body, and the current evaluation environment, and stiches them together into a function object, known as a "closure"

Re: [R] [R-devel] Source Code for function

2019-09-06 Thread Golden, Shelby
Afternoon, David, Thank you for your suggestions and insight. I have previously utilized parse, but in my exploration to improve my coding technique I came across this comment in stackoverflow.com (https://stackoverflow.com/questions/1743698/evaluate-expression-given-as-a-string - comment left

Re: [R] [R-devel] Source Code for function

2019-09-06 Thread David Winsemius
On 9/6/19 1:07 PM, Golden, Shelby wrote: Thank you all for your reply. I should clarify, that I am looking to understand why the keyword function can take a logical argument (eg: x<4) and use that later inside the function's definition for logical evaluations. Consider this example, which is

Re: [R] Is this a way to perform cross validation?

2019-09-06 Thread Jeff Newmiller
Possibly. However, this is not a a question about R but about statistical theory, so is off-topic on this mailing list. Try Stack Exchange or consult a local statistician. On September 5, 2019 9:58:56 AM PDT, Paul Bernal wrote: >Dear friends, > >Hope you are all doing great. If I am not mistake

Re: [R] Help Installing Rtools

2019-09-06 Thread Doran, Harold
John Indeed, this was the issue. I needed to modify my windows path to include both Rtools and the version of R I am using. Thank you. -Original Message- From: Fox, John Sent: Friday, September 6, 2019 9:35 AM To: Doran, Harold Cc: r-help@r-project.org Subject: Re: [R] Help Installi

Re: [R] [R-devel] Source Code for function

2019-09-06 Thread Golden, Shelby
Hello Jiefei, Missed this in the subsequent emails. That is a very intriguing article, but I do not believe that it quite answers my question. Regardless, I will review it, so thank you for sending it my way! Respectfully, Shelby From: Wang Jiefei Date: Friday, September 6, 2019 at 11:10 AM

Re: [R] [R-devel] Source Code for function

2019-09-06 Thread Golden, Shelby
Thank you all for your reply. I should clarify, that I am looking to understand why the keyword function can take a logical argument (eg: x<4) and use that later inside the function's definition for logical evaluations. Consider this example, which is a simplification of getAnywhere(subset.data

Re: [R] [R-devel] Source Code for function

2019-09-06 Thread Richard M. Heiberger
You might also want to look at the codetools package, for example the showTree function " Prints a Lisp-style representation of R expression." > library(codetools) > showTree(quote(x %*% x)) (%*% x x) > showTree(quote(a+b)) (+ a b) > showTree(quote(y ~ a+b)) (~ y (+ a b)) On Fri, Sep 6, 2019 at

Re: [R] [R-devel] Source Code for function

2019-09-06 Thread Bert Gunter
The following may be of use (it gives the parse tree of the text): > z <- as.list(parse(text = "function(x)x %*% x")) > z[[1]] function(x) x %*% x > z[[c(1,1)]] `function` > z[[c(1,2)]] $x > z[[c(1,3)]] x %*% x > z[[c(1,3,1)]] `%*%` > z[[c(1,3,2)]] x > z[[c(1,3,3)]] x Bert Gunter On Fri, Sep

Re: [R] [R-devel] Source Code for function

2019-09-06 Thread Wang Jiefei
If you are looking for an R code parser, I think the `parse` and `eval` function might be a good start point. See the example below. > parse(text="function(x)message(x)") expression(function(x)message(x)) > eval(parse(text="function(x)message(x)")) function(x)message(x) Best, Jiefei On Fri, Sep

Re: [R] [R-devel] Source Code for function

2019-09-06 Thread Wang Jiefei
Hi Shelby, Not quite sure what you are trying to do. Mine might be off-topic but have you seen this document? http://adv-r.had.co.nz/Functions.html#function-components It illustrates the components of a function. Best, Jiefei On Fri, Sep 6, 2019 at 11:52 AM Golden, Shelby wrote: > Hi all, >

Re: [R] [R-devel] Source Code for function

2019-09-06 Thread Golden, Shelby
Hello Bert, Thank you for the reply and your clarifications. Yes, it might be helpful to look into R’s formal grammar to see how “function” parses input to delegate correct syntax. Is that accessible online? Thank you, Shelby From: Bert Gunter Date: Friday, September 6, 2019 at 10:44 AM To:

Re: [R] [R-devel] Source Code for function

2019-09-06 Thread Bert Gunter
1. This is a plain text list; all html is stripped. So there is no red highlighting. 2. There is no "source code" for "function" -- it is a reserved keyword. Or are you looking for R's formal grammar -- e.g. how it parses input to determine correct syntax? Bert Gunter "The trouble with having

[R] [R-devel] Source Code for function

2019-09-06 Thread Golden, Shelby
Hi all, I have been attempting to access the source code for the keyword “function” to better understand how it assigns and stores logical inputs, like in the subset() [base] function. Does anyone know how I can access the source code for this? For example, if I have norm <- function(x){

Re: [R] Help Installing Rtools

2019-09-06 Thread Fox, John
Dear Harold, Have you checked that the Rtools directory is on the Windows path? If not, you could try rerunning the Rtools installer and allow it to modify the path, or simply add the Rtools directory to the path yourself. I hope that this helps, John - John Fo

Re: [R] Help with fmodel in statisticalModeling package

2019-09-06 Thread Paul Johnston
Many thanks, as you suggest that does allow the program to run. As does (no pun intended) as.character() If anyone knows what causes this I would be still keen to know. Cheers Paul -Original Message- From: peter dalgaard [mailto:pda...@gmail.com] Sent: 06 September 2019 14:04 To: Paul Jo

Re: [R] Help with fmodel in statisticalModeling package

2019-09-06 Thread peter dalgaard
I have no clue about the internals of fmodel() (and no real intention of getting one...), but pragmatically and to avoid getting sidetracked, how about converting the bogus variable to zero-one: CPS85$bogus <- as.numeric(rnorm(nrow(CPS85)) > 0) -pd > On 6 Sep 2019, at 11:57 , Paul Johnston >

[R] Help with fmodel in statisticalModeling package

2019-09-06 Thread Paul Johnston
Hi Anyone able to help me with this. I'm doing a datacamp course and the effect of adding a "bogus variable" to a linear model. I make a model and initially fmodel works fine. When I have a second model which uses this "bogus variable" it complains about the type of this variable. The code belo

Re: [R] [FORGED] (no subject)

2019-09-06 Thread Rolf Turner
On 6/09/19 5:30 PM, pusuluri madhu wrote: Please unsubscribe me Go unsubscribe yourself! :-) See the footer at the bottom of every r-help posting: R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help HTH cheers, Rolf Turner --