mercredi 24 mai 2017

Inserting the value in data frame into the codes in R

I have the names of the 1000 people in "name" data frame

df=c("John","Smith", .... "Machine") 

I have the 1000 data frames for each person. (e.g., a1~a1000) And, I have the following codes.

a1$name="XXXX"
a2$name="XXXX" ...
a1000$name="XXXX"

I would like to replace "XXXX" in the above codes with the values in name data frame. Output codes would look like this.

a1$name="John"
a2$name="Smith" ...
a1000$name="Machine"

Aucun commentaire:

Enregistrer un commentaire