Skip to content

changing the mode of a factor (PR#9675)

1 message · frederic.gosselin at cemagref.fr

#
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...