Hi all,
  I am very confused with class.
  I am looking at some weather data which I want to use as explanatory
variables in an lm. R has treated these variables as factors (i.e. with
different levels), whereas I want them treated as discretely measured
continuous variables. So I need to reassign the class of these
variables, right?
Indeed, doing 
class(southwest$pressure)
(pressure being air pressure), I get 
#> factor.
  Now what class should I use to reassign them so that my model fitting
process goes as I want it to? I have obviously done something wrong. I
did 
southwest$pressure <- as(southwest$pressure,"numeric")
numeric seeming like a reasonable class to assign to this variable.
However, doing some summary stats like 
mean(southwest$pressure)
#> 341,
max(southwest$pressure)
#> 761,
which is clearly nonsense, as my maximum value is around 1040. Something
similar has happened to maxtemp (maximum temperature), which I also
reassigned from a factor to class numeric, which now apparently has a
maximum value of 147! 
  Clearly it must be the reassignment of class that has caused these
problems, as summary stats on the data before I reassigned the classes
were fine. What is wrong with the class numeric? Reading the numeric
help page didn't reveal anything to me. Can someone suggest the correct
class?
Many thanks for any help.  
Robin Williams
Met Office summer intern - Health Forecasting
[EMAIL PROTECTED] 
 

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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.

Reply via email to