4
I have the following files in my working directory:
Dados_1.fst
Dados_2.fst
Dados_3.fst
Dados_4.fst
...
Dados_10.fst
The Dados_x.fst file (where x goes from 1 to 10) has the columns CODIGO, INSCRIPTION, RESPOSTAS_A, RESPOSTAS_B
Hence create the following data frames:
df.1 <- select(filter(read.fst("Dados_1.fst"), CODIGO ==
10102),INSCRICAO,RESPOSTAS_A,RESPOSTAS_B)
df.2 <- select(filter(read.fst("Dados_2.fst"), CODIGO ==
10102),INSCRICAO,RESPOSTAS_A,RESPOSTAS_B)
df.3 <- select(filter(read.fst("Dados_3.fst"), CODIGO ==
10102),INSCRICAO,RESPOSTAS_A,RESPOSTAS_B)
...
df.10 <- select(filter(read.fst("Dados_10.fst"), CODIGO ==
10102),INSCRICAO,RESPOSTAS_A,RESPOSTAS_B)
I would like to loop in such a way that I don’t need to write the above code 10 times.
I tried to follow the way down, but to no avail
for (i in 1:10)
{
paste("df",i, sep =".") <- select(filter(read.fst(paste(paste("Dados",i,sep="_"),"fst",sep =".")),
CODIGO == 10102),INSCRICAO,RESPOSTAS_A,RESPOSTAS_B)
}
Up until+
It worked well! Thank you ;)
– Reynaldo Jr.