Hi:
After getting the data (thank you), I found that it seemed to have a rather odd characteristic:
str(resc)
List of 8
$ fn : Factor w/ 38 levels "N1","N2","N3",..: 1 1 1 1 1 1 1 1 1 1 ...
$ stype : Factor w/ 2 levels "N","P": 1 1 1 1 1 1 1 1 1 1 ...
$ eye : Factor w/ 2 levels "OS","OD": 1 1 1 1 1 1 1 1 1 1 ...
$ segment: num [1:4636] 1 2 3 4 5 6 7 8 9 10 ...
$ snr.30 : Factor w/ 4636 levels "0.0185913534345293",..: 4018 3199 2699 4103 2796 2603 2880 3048 3393 3138 ...
..- attr(*, "names")= chr [1:4636] "N1_N_OS_1" "N1_N_OS_2" "N1_N_OS_3" "N1_N_OS_4" ...
$ fact.30: Factor w/ 2 levels "not sign.","sign.": 2 2 1 2 1 2 1 1 2 1 ...
..- attr(*, "names")= chr [1:4636] "N1_N_OS_1" "N1_N_OS_2" "N1_N_OS_3" "N1_N_OS_4" ...
$ snr.60 : Factor w/ 4636 levels "0.005353479967123",..: 1605 592 3163 3016 533 3053 1024 2176 611 3399 ...
..- attr(*, "names")= chr [1:4636] "N1_N_OS_1" "N1_N_OS_2" "N1_N_OS_3" "N1_N_OS_4" ...
$ fact.60: Factor w/ 2 levels "not sign.","sign.": 1 1 1 1 1 1 1 1 1 1 ...
..- attr(*, "names")= chr [1:4636] "N1_N_OS_1" "N1_N_OS_2" "N1_N_OS_3" "N1_N_OS_4" ...
- attr(*, "row.names")= int [1:4636] 1 2 3 4 5 6 7 8 9 10 ...
- attr(*, "idvars")= chr [1:4] "fn" "stype" "eye" "segment"
- attr(*, "rdimnames")=List of 2 <<<<<<<<<<=======================
..$ :'data.frame': 4636 obs. of 4 variables:
.. ..$ fn : Factor w/ 38 levels "N1","N2","N3",..: 1 1 1 1 1 1 1 1 1 1 ...
.. ..$ stype : Factor w/ 2 levels "N","P": 1 1 1 1 1 1 1 1 1 1 ...
.. ..$ eye : Factor w/ 2 levels "OS","OD": 1 1 1 1 1 1 1 1 1 1 ...
.. ..$ segment: num [1:4636] 1 2 3 4 5 6 7 8 9 10 ...
..$ :'data.frame': 4 obs. of 2 variables:
.. ..$ freq : num [1:4] 30 30 60 60
.. ..$ variable: Factor w/ 2 levels "snr","fact": 1 2 1 2
Your resc object seems to have two data frames nested within the rdimnames attribute, which didn't look like a good sign to me. I'm pretty sure that's the source of your inability to get the plot. That the two variables you wanted to plot were both factors didn't help either. I decided to simplify matters by copying the first eight components to a data frame resc2 and cleaning it up a bit:
resc2 <- resc[, 1:8]
str(resc2) # before
resc2$snr.30 <- as.numeric(as.character(unname(resc2$snr.30)))
resc2$snr.60 <- as.numeric(as.character(unname(resc2$snr.60)))
resc2$fact.30 <- unname(resc2$fact.30)
resc2$fact.60 <- unname(resc2$fact.60)
str(resc2) # after
This takes the 4636 level 'factors' snr.30 and snr.60 and converts them to numeric. I also unnamed the four variables above to simplify matters. Once this was done, the plot was straightforward:
xlstr <- '30 Hz SNR'
ylstr <- '60 Hz SNR'
p <- ggplot(resc2) + theme_bw() +
geom_point(aes(x = snr.30, y = snr.60, colour=fact.30)) +
scale_x_continuous(name=xlstr) +
scale_y_continuous(name=ylstr) +
scale_colour_manual('', values=c('grey', 'black'), legend=FALSE) +
facet_grid(. ~ stype)
p
system.time(print(p))
user system elapsed
1.17 0.04 1.23
HTH,
Dennis