[Rd] changing the mode of a factor (PR#9675)

frederic.gosselin at cemagref.fr frederic.gosselin at cemagref.fr
Fri May 11 12:23:46 CEST 2007


Full_Name: Frédéric Gosselin
Version: 2.5 vs 2.4 and 2.2.1
OS: windows XP
Submission from: (NULL) (195.221.118.52)


#############
L3 <- LETTERS[1:3]
 (d <- data.frame(cbind(x=1, y=1:10), fac=as.factor(sample(L3, 10,
repl=TRUE))))
mode(d[,3])<-"numeric"
###############

when trying to change the mode of a column in a data.frame that is a factor to
numeric(cf. preceding code), the following error occurs (in French) in R 2.5:

Erreur dans `storage.mode<-`(`*tmp*`, value = "double") : 
        le mode de stockage d'un objet "factor" ne peut être modifié

The same thing works fine in R2.4 and 2.2.1. 

It does not seem to correspond to new things announced in the NEWS file for the
2.5 version...



More information about the R-devel mailing list