Displaying 1 result from an estimated 1 matches for "mywithin".
Did you mean:
mswithin
2009 Sep 02
4
within: order of newly added variables
Dear R community,
I am using function 'within' in R.2.9.1 to add variables to an existing data.frame. This works wonderful, except for one minor point: The new variables are added to the data in reverse order.
For example:
x <- data.frame(a = 1:3, b = 4:6)
y <- within(x, {
c = a^2
d = b^2
e = c+d
}
)
gives
a b e d c
1 1 4 17 16 1
2 2 5 29 25 4
3 3 6 45 36 9