I am trying to create some descriptive statistics and histograms out of ordered variables (range 0 to 10). I used the following commands:
class(data$var1)
describe(as.numeric(data$var1))
But R starts from 1 and counts the "refusal" values as a further numeric value.
How can I let R start from 0 and ignore the "refusal" values?
Thank you.
Edit: I was able to let R ignore "refusal" value using the following command:
is.na (data$var1[data$var1=="Refusal"]) <- TRUE
But when I search for possible solution about the 0 values I am only finding suggestion on how to ignore/remove 0 values...
Edit2: This is a sample of my data,
 [1] 5       8       8       8       Refusal 10      8       Refusal 7      
  [10] 7       8       7       8       8       8       8       8       8      
  [19] 8       0       9       Refusal 6       10      7       7       9
as you can see the range is from 0 to 10 but using the R library "psych" and the command "describe" the output range is always 1 to 11 and this invalidates the whole statistics.
> class(data$var1)
[1] "factor"
> describe(as.numeric(data$var1), na.rm=TRUE)
  vars    n mean   sd median trimmed  mad min max range  skew kurtosis   se
1    1 1115 8.38 1.94      9    8.57 1.48   1  11    10 -1.06     1.42 0.06
Sorry for the ongoing editing but I am new of stackoverflow.com
 
     
     
    
class(data$var1) describe(as.numeric(data$var1))– Crescenzo Mar 25 '15 at 10:31