[R] Performing same steps on multiple dataframes using a loop - vijay
Vijay
vijaychowdhari at gmail.com
Sat Jan 18 05:46:45 CET 2014
I have three data frames df.1, df.2 and df.3. All have the same structure I.e here is df.1
Name network speed
Atlanta_Ga. LTE. 10
Hartford_CT. HSPA. 4
Seattle_WA. LTE. 12
I want to perform a couple of steps on each data frame and store the transformed dataframes as df.1cleaned, df.2cleaned etc......
Here are the steps to perform.
1.Create a new column named state, given by the last two letters of the name field
2. Only keep rows where network is HSPA
3. Multiple the speed column by 1000
So df.1cleaned would look like
Name Network. Speed. State
Hartford_CT. HSPA. 10000. CT
Can someone help me come up with a loop or a function that loops through all dataframes and produces all three dataframes
Thanks
Vijay
Sent from my iPad
More information about the R-help
mailing list