[R] using for loop with data frames.

John Kane jrkr|de@u @end|ng |rom y@hoo@c@
Thu May 10 17:17:51 CEST 2018


 
Why not just use an rbind() and create one data.frame?
    On Thursday, May 10, 2018, 10:34:19 a.m. EDT, Marcelo Mariano Silva <marcelomarianosilva using gmail.com> wrote:  
 
 Hi,

Is it possible use a loop to process many data frames in the same way?

For example, if I have three data frames, all with same variables


df_bs_id1 <- read.csv("test1.csv",header =TRUE)
df_bs_id2 <- read.csv("test2.csv",header =TRUE)
df_bs_id3 <- read.csv("test3.csv",header =TRUE)


How could I would implement a code loop that , for instance, would select
two coluns of interest in a fashion of the code below ?


# selecting only 2 columns of interest

for (1, 1:3) {
df_selected [i] <- df_bs_id[i]  [ , c("column1", "column2")]  }


Tks

MMS

    [[alternative HTML version deleted]]

______________________________________________
R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
  
	[[alternative HTML version deleted]]




More information about the R-help mailing list