modono@utvinternet.com
2006-Jan-17 11:45 UTC
[R] Perl array conversion in R to compare plots.
Hello all, I am using RSPerl package to display plots in R . I want to be able to compare some data in boxplot and in histogram and in probplot ( from e1071 package) - ( cumulative probability plot - normal) I have a nested arrray of data ... from perl like the following data[0][0] = (1,2,3,.....) data[0][1] = ( 2,1,2,2,2,2,2) - could be different lengths... etc ( could be more two sets to compare...) These get passed to the R engine as follows x <- list(list(1,2,3,4),list(2,1,2,2,2,2,2)) I am trying to write a function that will perform boxplot on all this data but I am not sure how to extract data properly and display so far my function looks like compareplot <- function(x,xlab=par("xlab")) { new.plot() for ( i in 1:length(x)) { # I think I have to do some assign and paste here"??? xlist[i] <- unlist(x[[i]]) args <- paste(args,xlist[i]) } so I want my args to look something like xlist1,xlist2,.... boxplot(args) hist(args) ... probplot(args) or should I do some data.frame conversion on all of the lists... and how would I go about doing a comparison of data on probplot ( cumulative probability plot ) or histogram compare? Thanks for any help, Mary