I am on Mac OS 10.10 with R 3.1.1
Suppose I have the following data frames a
and b
with the same attributes:
a<- structure(list(X1 = 1:5, X2 = 6:10), .Names = c("X1", "X2"), row.names = c(NA,
-5L), class = "data.frame")
b<- structure(list(X1 = 11:15, X2 = 16:20), .Names = c("X1", "X2"
), row.names = c(NA, -5L), class = "data.frame")
and suppose I need to do some cleaning/apply some functions (like dropping column and multiply the first column by 2) on both a
and b
at the same time such that the original data frames reflect the changes with the following desired output:
> a
X1
1 2
2 4
3 6
4 8
5 10
> b
X1
1 22
2 24
3 26
4 28
5 30
I have just learnt the for loops and *apply functions but get confused when applying them on the data frames I have (which are not a
and b
but much bigger).