Re: [R] ordinal variables

From: Iasonas Lamprianou <>
Date: Thu, 03 Jun 2010 06:51:42 -0700 (PDT)

Thank you Joris,
I'll have a look into the commands you sent me. They look convincing. I hope my students will also see them in a positive way (although I can force them to pretend that they have a positive attitude)!

Dr. Iasonas Lamprianou

Assistant Professor (Educational Research and Evaluation)

Department of Education Sciences

European University-Cyprus

P.O. Box 22006

1516 Nicosia


Tel.: +357-22-713178

Fax: +357-22-590539

Honorary Research Fellow

Department of Education

The University of Manchester

Oxford Road, Manchester M13 9PL, UK

Tel. 0044 161 275 3485

From: Joris Meys <>
Subject: Re: [R] ordinal variables
To: "Iasonas Lamprianou" <> Cc:
Date: Thursday, 3 June, 2010, 14:35

see ?factor and ?as.factor. On ordered factors you can technically do a spearman without problem, apart from the fact that a spearman test by definition cannot give exact p-values with ties present.

x <- sample(c("a","b","c","d","e"),100,replace=T)

y <- sample(c("a","b","c","d","e"),100,replace=T)

x.ordered <- factor(x,levels=c("e","b","a","d","c"),ordered=T)

y.ordered <- factor(y,levels=c("e","b","a","d","c"),ordered=T)




R commander has some menu options to deal with factors. R commander also provides a scripting window. Please do your students a favor, and show them how to use those commands.


On Thu, Jun 3, 2010 at 2:25 PM, Iasonas Lamprianou <> wrote:

Dear colleagues,

I teach statistics using SPSS. I want to use R instead. I hit on one problem and I need some quick advice. When I want to work with ordinal variables, in SPSS I can compute the median or create a barchart or compute a spearman correlation with no problems. In R, if I "read" the ordinal variable as numeric, then I cannot do a barplot because I miss the category names. If I read the variables as characters, then I cannot run a spearman. How can I read a variable as numeric, still have the chance to assign value labels, and be able to get table of frequencies etc? I want to be able to do all these things in R commander. My students will probable be scared away if I try anything else other than R commander (just writing commands will not make them happy).

I hope I am not asking for too much. Hopefully there is a way mailing list

PLEASE do read the posting guide

and provide commented, minimal, self-contained, reproducible code.

Joris Meys
Statistical Consultant

Ghent University
Faculty of Bioscience Engineering 
Department of Applied mathematics, biometrics and process control

Coupure Links 653
B-9000 Gent

tel : +32 9 264 59 87 
Disclaimer :

	[[alternative HTML version deleted]]

______________________________________________ mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code.
Received on Thu 03 Jun 2010 - 13:54:28 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 03 Jun 2010 - 14:30:26 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive