lundi 22 mai 2017

Replacing the pattern in the code and generating many variants in r

I have the following lines of code.

path="http:///**XXXX**"
a1=as.data.frame(csv[[1]][1][[1]]);a1$group="**XXXX**"

Also I have 1600 groups for example

df=c("ABC0","ABCF", .... "ZZZZ") 

(There is no pattern in the names of the groups)

I would like to generate the 1,600 sets of the codes in R using "df". For example,

path="http:///**ABC0**"
a1=as.data.frame(csv[[1]][1][[1]]);a1$group="**ABC0**"

path="http:///**ABCF**"
a1=as.data.frame(csv[[1]][1][[1]]);a1$group="**ABCF**"

path="http:///**ZZZZ**"
a1=as.data.frame(csv[[1]][1][[1]]);a1$group="**ZZZZ**"

Aucun commentaire:

Enregistrer un commentaire