À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
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
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
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,
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”)
> …
>
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]]
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
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.
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
В 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
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
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
12 matches
Mail list logo