[R] using for loop with data frames.

Marcelo Mariano Silva m@rcelom@ri@no@ilv@ @ending from gm@il@com
Thu May 10 16:33:45 CEST 2018


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]]



More information about the R-help mailing list