Re: [R] Looping

2024-02-18 Thread Rui Barradas
Às 03:27 de 19/02/2024, Steven Yen escreveu: I need to read csv files repeatedly, named data1.csv, data2.csv,… data24.csv, 24 altogether. That is, data<-read.csv(“data1.csv”) … data<-read.csv(“data24.csv”) … Is there a way to do this in a loop? Thank you. Steven from iPhone

Re: [R] Looping

2024-02-18 Thread Richard O'Keefe
f <- function (filename) { data<- read.csv(filename) .. } for (filename in paste0("data", 1:24, ".csv")) f(filename) Depending on what exactly you have in your file system, for (filename in system("ls data*.csv", TRUE)) f(filename) might work. On Mon, 19 Feb 2024 at 16:33, Steven Yen

Re: [R] Looping

2024-02-18 Thread avi.e.gross
Steven, It depends what you want to do. What you are showing seems to replace the values stored in "data" each time. Many kinds of loops will do that, with one simple way being to store all the filenames in a list and loop on the contents of the list as arguments to read.csv. Since you show

Re: [ESS] FW: [GNU ELPA] ESS version 24.1.1

2024-02-18 Thread Dirk Eddelbuettel via ESS-help
On 18 February 2024 at 20:54, Brett Presnell via ESS-help wrote: | | Forgot to mention that you may need to uninstall and reinstall the ess | package after putting the :pin in place, but I'm not sure about that. | Restarting emacs is maybe needed too, but not sure about that either. The pin,

Re: [R] Looping

2024-02-18 Thread Peter Langfelder
Try for (ind in 1:24) { data = read.csv(paste0("data", ind, ".csv")) ... } Peter On Mon, Feb 19, 2024 at 11:33 AM Steven Yen wrote: > > I need to read csv files repeatedly, named data1.csv, data2.csv,… data24.csv, > 24 altogether. That is, > > data<-read.csv(“data1.csv”) > … >

[R] Looping

2024-02-18 Thread Steven Yen
I need to read csv files repeatedly, named data1.csv, data2.csv,… data24.csv, 24 altogether. That is, data<-read.csv(“data1.csv”) … data<-read.csv(“data24.csv”) … Is there a way to do this in a loop? Thank you. Steven from iPhone [[alternative HTML version deleted]]

Re: [ESS] FW: [GNU ELPA] ESS version 24.1.1

2024-02-18 Thread Brett Presnell via ESS-help
Forgot to mention that you may need to uninstall and reinstall the ess package after putting the :pin in place, but I'm not sure about that. Restarting emacs is maybe needed too, but not sure about that either. __ ESS-help@r-project.org mailing list

Re: [ESS] FW: [GNU ELPA] ESS version 24.1.1

2024-02-18 Thread Brett Presnell via ESS-help
Hi Dirk. If you use use-package, you can pin the package source for ess to gnu-elpa like this: (use-package ess :ensure t :pin gnu) Documentation for use-package can be found here: https://www.gnu.org/software/emacs/manual/html_node/use-package/index.html Section 5.2 discusses :pin.

Re: [ESS] FW: [GNU ELPA] ESS version 24.1.1

2024-02-18 Thread Dirk Eddelbuettel via ESS-help
Rodney et al, Thanks for the update(s)! Alas, I also seem to see ess20240131.1041 installed Emacs Speaks Statistics which seems to win over ess24.1.1 obsolete Emacs Speaks Statistics What is the

Re: [R] Capturing Function Arguments

2024-02-18 Thread Ivan Krylov via R-help
В Sat, 17 Feb 2024 11:15:43 -0700 "Reed A. Cartwright" пишет: > I'm wrapping a function in R and I want to record all the arguments > passed to it, including default values and missing values. This is hard if not impossible to implement for the general case because the default arguments are

Re: [R] Capturing Function Arguments

2024-02-18 Thread Iris Simmons
Hi Reed, I need to stress before giving my answer that no solution can handle everything. These scenarios will always lead to problems: * if any of the formal arguments rely on the current state of the call stack * if any of the formal arguments rely on a variable that is only defined later in

[R] Capturing Function Arguments

2024-02-18 Thread Reed A. Cartwright
I'm wrapping a function in R and I want to record all the arguments passed to it, including default values and missing values. I want to be able to snoop on function calls in sourced scripts as part of a unit testing framework. I can capture the values fine, but I'm having trouble evaluating them