Dear R-friends, the dataset I am using (data.it) is organized as follows partner stp btp reg hk 0.64 1 s ger 0.27 1 d tur 0.27 1 s rom 0.24 1 s-f por 0.24 1 s spa 0.23 1 s gre 0.22 1 d-f aus 0.17 1 d uk 0.16 1 s be 0.16 1 d arg 0.15 1 s usa 0.13 1 d-f fra 0.13 1 s neth 0.05 1 s-f pol 0.05 1 d bra 0.04 1 s ko 0.006 1 s un -0.009 2 d-f svi -0.022 2 s-f cin -0.040 2 d ru -0.074 2 d-f mex -0.077 2 s ... ... ... ... and plotting it using dotplot, I specified the script as: library(lattice) attach(data.ita) dotplot(reg~stp | partner, data=data.ita, groups=btp, xlab=list("Data - it",cex=1.5),col=c("black","red"),aspect=0.3,as.table=TRUE,xlim=c(-1,1)) detach(data.ita) In the resulting plot the variable "reg" is ordered alphabetically. Instead, I would like the variable to be plotted in the following order: "s", "s-f", "d", "d-f". How can I do it? Many thanks Luca
Luca De Benedictis wrote:> the dataset I am using (data.it) is organized as follows > ... ... ... ... > and plotting it using dotplot, I specified the script as: > > library(lattice) > attach(data.ita) > dotplot(reg~stp | partner, data=data.ita, groups=btp, > xlab=list("Data - > it",cex=1.5),col=c("black","red"),aspect=0.3,as.table=TRUE,xlim=c(-1,1)) > detach(data.ita) > > In the resulting plot the variable "reg" is ordered alphabetically. > Instead, I would like the variable to be plotted in the following order: > "s", "s-f", "d", "d-f".Make that an ordered factor as follows: data.it$reg <- ordered(data.it$reg, levels=c("s", "s-f", "d", "d-f")) hope this helps, Chuck Cleland -- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 452-1424 (M, W, F) fax: (917) 438-0894
Hi, I'd like to store N vectors of different lengths, and to be able to access them with an index, and eventually free the memory for one of them without modifying the indexes to the others. In C this would be a vector of N pointers that point to memory cells independently allocated. For example int *pv[3]; pv[0] = (int *) malloc(13 * sizeof(int)); pv[1] = (int *) malloc(7 * sizeof(int)); pv[2] = (int *) malloc(110 * sizeof(int)); free(pv[1]) ... What is the best data type (or class) in R to do such a thing? Thank you! Giampiero _________________________________________________________ Giampiero Salvi, M.Sc. www.speech.kth.se/~giampi Speech, Music and Hearing Tel: +46-8-790 75 62 Royal Institute of Technology Fax: +46-8-790 78 54 Drottning Kristinasv. 31, SE-100 44, Stockholm, Sweden