Ulrike Grömping wrote:
> 
> 
> However, given the documentation that partial matching is not used on 
> the left-hand side, I would have expected even more that the assignment
> 
> sw$Fert[1] <- 10
> 
> works differently, because I am using it on the left-hand side. 
> Probably, extraction ([1]) is done first here, so that the right-hand 
> side won. At least, this is very confusing.
> 
> 

I totally agree! I think that 
sw <- data.frame(Fertility=1:5)
sw$Fert[1] <- 10

should work either like

sw$Fert2[1] <- 10

i.e. create new column, containing just 10.
or like

sw$Fertility[1] <- 10

i.e. replace the 1st item in sw$Fertility by 10.

-- 
View this message in context: 
http://r.789695.n4.nabble.com/Assignment-of-individual-values-to-data-frame-columns-intentional-or-unintentional-behavior-tp2315105p2315641.html
Sent from the R devel mailing list archive at Nabble.com.

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to