Skip to content
Prev 5940 / 398506 Next

subset of matrix vs data frame

Prof Brian D Ripley <ripley at stats.ox.ac.uk> writes:
Semantically it is a rather strange thing to do since elements
in different columns of a data matrix can be of different type. 
And some really weird stuff *does* happen in Splus 3.4:
Warning messages:
  replacement values not all in levels(x): NA's generated in:
i[, k, drop = T], value = .A1)
a  b  c 
 1  1  1 1 
 2  2  2 2 
 3  3  3 3 
 4  4  4 4 
 5  x NA x 
 6  6  6 6 
 7  7  7 7 
 8  8  8 8 
 9  9  9 9 
10 10 10 10
Warning messages:
1: Data length is not an even multiple of group length in:
factor(col(i)[i], levels = seq(len = ncol(i))))
2: replacement values not all in levels(x): NA's generated in:
A0, i[, k, drop = T], value = .A1)
3: replacement values not all in levels(x): NA's generated in:
A0, i[, k, drop = T], value = .A1)
a  b  c 
 1  1  1 1 
 2  2  2 2 
 3  3  3 3 
 4 NA NA 4 
 5  x NA x 
 6  6  6 6 
 7  7  7 7 
 8  8  8 8 
 9  9  9 9 
10 10 10 10