[Rd] The function 'apply' (PR#2633)

louisept at pweh.com louisept at pweh.com
Thu Mar 13 23:19:40 MET 2003


Full_Name: Paul Louisell
Version: 1.6.2
OS: Windows NT
Submission from: (NULL) (192.249.47.9)


I've found a problem with either the 'apply' or 'is.factor' functions, and it
seems like it might be cause for concern. Here are the commands taken directly
from the R session:

> is.factor(test.frame[, 1])
[1] TRUE
> is.factor(test.frame[, 2])
[1] TRUE
> is.factor(test.frame[, 3])
[1] TRUE
> is.factor(test.frame[, 4])
[1] TRUE
> apply(test.frame, 2, is.factor)
   X1    X2    X3    X4 
FALSE FALSE FALSE FALSE 


All of the variables in test.frame are factors, and is.factor returns TRUE when
it's used on each factor individually. When it's used inside of apply, all of
the variables return the value FALSE. So there's something wrong in at least one
of these functions.



More information about the R-devel mailing list