Re: [R] Including an external set of coded

2024-02-20 Thread CALUM POLWART
What happens if you add a line to the code in lines 1-5. So line 5 is now line 6 etc? Your "procedure" needs a name So either it's a function, OR, we each procedure is a file to source? On Tue, 20 Feb 2024, 16:55 Steven Yen, wrote: > I see——still put those lines in a procedure and call the

Re: [R] Including an external set of coded

2024-02-20 Thread CALUM POLWART
Are you asking to source lines 5-10 of a file for instance? Never seen that done in R. Feels a dodgy thing to do as changing line will screw things up. On the other hand - I'd often have functions in a file called perhaps "functions.R" and source("functions.R") Then I can call an individual

Re: [R] Including an external set of coded

2024-02-20 Thread Bert Gunter
I believe you will have to expain what you want more fully, as what you requested appears to be exactly what source() does, to me anyway. Please reread its help file more carefully perhaps? -- Bert On Tue, Feb 20, 2024 at 7:36 AM Steven Yen wrote: > How can I call and include an external set

[R] Including an external set of coded

2024-02-20 Thread Steven Yen
How can I call and include an external set of R codes, not necessarily a complete procedure (which can be include with a “source” command). Example: #I like to include and run the following lines residing in a file outside the main program: mydata<-transform(mydata, a<-b+c d<-e+f } Steven