Reading this excellent post i came across within and transform.
Reading both help files i unfortunatly did not fully understand what the differnence is...
I tried something like:
df <- data.frame(A = runif(5), B = rnorm(5))
A=1:5
within(df, C<-A+B)
transform(df,C=A+B)
Both times the Output was:
          A          B         C
1 0.2326266  1.3237210 1.5563476
2 0.4581693 -0.2605674 0.1976018
3 0.6431078  0.5920021 1.2351099
4 0.9682578  1.1964012 2.1646590
5 0.9889942  0.5468008 1.5357950
So both seem to create a new enwironment as they are ignoring A=1:5 within the evaluation.
Thanks in advance!
 
     
    