converting data.frame into a numeric ( integer) form

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

converting data.frame into a numeric ( integer) form

Haillie
Hi Everyone,

I am relatively new to R and would appreciate your help on this problem that I encontered this morning.
When running an ordinal IRT model using Ratings package on R, I keep getting this error message.

ord.out<-ordrating(UNORD, burnin = 1000, mcmc = 40,000, thin = 400, tune = 1, verbose = 1000, seed = NA)

Error in as.vector(as.integer(Y)) :
  (list) object cannot be coerced to type 'integer'

UNORD is my data.frame and it is in the form of delimited CSV file without either row or column name.
According to the help page on Ordinal ratings, Y should be "a Matrix of data to be analyzed. Entries must be integers from 1; : : : ;C or NA where C is the number of ordinal categories. Items are on the rows and subjects are on the columns." I am confused because my data.frame only contains numerica values of 1,2,3, and NA. I checked and my NAs were all numeric.

Any help or advice you could provide on this issue would be greatly appreciated. Thank you very much.
I would like to thank all the R experts navigating this forum in advance.

Sincerely,
Haillie
Reply | Threaded
Open this post in threaded view
|

Re: converting data.frame into a numeric ( integer) form

Uwe Ligges-3


On 17.04.2011 19:29, Haillie wrote:

> Hi Everyone,
>
> I am relatively new to R and would appreciate your help on this problem that
> I encontered this morning.
> When running an ordinal IRT model using Ratings package on R, I keep getting
> this error message.
>
> ord.out<-ordrating(UNORD, burnin = 1000, mcmc = 40,000, thin = 400, tune =
> 1, verbose = 1000, seed = NA)
>
> Error in as.vector(as.integer(Y)) :
>    (list) object cannot be coerced to type 'integer'
>
> UNORD is my data.frame

... but ?ordrating tells you it must be a matrix rather than a data.frame.

Uwe Ligges


> and it is in the form of delimited CSV file without
> either row or column name.
> According to the help page on Ordinal ratings, Y should be "a Matrix of data
> to be analyzed. Entries must be integers from 1; : : : ;C or NA where C is
> the number of ordinal categories. Items are on the rows and subjects are on
> the columns." I am confused because my data.frame only contains numerica
> values of 1,2,3, and NA. I checked and my NAs were all numeric.
>
> Any help or advice you could provide on this issue would be greatly
> appreciated. Thank you very much.
> I would like to thank all the R experts navigating this forum in advance.
>
> Sincerely,
> Haillie
>
> --
> View this message in context: http://r.789695.n4.nabble.com/converting-data-frame-into-a-numeric-integer-form-tp3455811p3455811.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.