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<- structu
It is generally encouraged (by the R Core team memebers) that if you have several data sets that you want to simultaneously operate on, you should keep them all in a list. In order to achieve your goal, you can simply use mget
and ls
to retreive them from the global environment and then simply replace with first column multiplied by 2, e.g.,
lapply(mget(ls(pattern = "[a-z]")), function(x) x <- x[1] * 2)
# $a
# X1
# 1 2
# 2 4
# 3 6
# 4 8
# 5 10
#
# $b
# X1
# 1 22
# 2 24
# 3 26
# 4 28
# 5 30