[R] subscript data.frame

Jens Oehlschlägel-Akiyoshi jens.oehlschlaegel-akiyoshi at mdfactory.de
Wed Jan 26 16:20:20 CET 2000



Hi,

is the following difference intended?

> ddd <- data.frame(a=1:3, b=1:3)

# assignment of 'X' silently ignored
> ddd[1,1] <- 'X'
> is.factor(ddd[[1]])
[1] FALSE
> ddd
  a b
1 1 1
2 2 2
3 3 3

# assignment of 'X' not ignored
> ddd[[1]][1] <- 'X'
> is.factor(ddd[[1]])
[1] TRUE
> ddd
  a b
1 X 1
2 2 2
3 3 3


Regards


--
Dr. Jens Oehlschlägel-Akiyoshi
MD FACTORY GmbH
Bayerstrasse 21

80335 München

Tel.: 089 545 28-27
Fax.: 089 545 28-10
http://www.mdfactory.de


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list