[R] question regarding is.factor()

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Aug 13 13:21:31 CEST 2007


typeof() for 'types'.

However, "factor" is not a type but a class, so class() is probably what 
you want.

On Mon, 13 Aug 2007, Jabez Wilson wrote:

> Dear all, please help with what must be a straightforward question which 
> I can't answer.

But 'An Introduction to R' could.

>  I add a column of my dataframe as factor of an existing column e.g.
>
>  df[,5] <- factor(df[,2])
>
>  and can test that it is by is.factor()
>
>  but if I did not know in advance what "types" the columns were, is 
> there a function to tell me what they are.
>
>  i.e. instead of is.factor(), is.matrix(), is.list(), a function more 
> like what.is()
>
>
> ---------------------------------
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list