[R] producing a QQ plot.
David Winsemius
dwinsemius at comcast.net
Sat Mar 27 15:06:41 CET 2010
On Mar 27, 2010, at 6:45 AM, Joshua Wiley wrote:
> It is a bit of a side note really, but a convenient way to provide
> data (particularly when it is complex) is via dput(). Not only is
> this easier to read in, it preserves classes and other handy info.
> For instance, once I had played around to get "Cook" and "Islands"
> into one column (since there was a space) I could use:
>
> dput(data, file="clipboard") #data is what is being written and it is
> output to the clipboard, works decently in Windows at least
>
> to get:
>
> ######################################################
> structure(list(country = structure(c(1L, 1L, 1L, 1L, 2L, 2L,
> 2L, 2L, 2L), .Label = c("Cook Islands", "French Polynesia"), class =
> "factor"),
> village = structure(c(1L, 4L, 6L, 8L, 2L, 3L, 5L, 7L, 9L), .Label
> = c("Aitutaki",
> "Fakarava", "Maatea", "Mangaia", "Mataiea", "Palmerston",
> "Raivavae", "Rarotonga", "Tikehau"), class = "factor"), group =
> structure(c(4L,
> 3L, 2L, 1L, 2L, 4L, 4L, 2L, 4L), .Label = c("A", "B", "C",
> "D"), class = "factor"), av_expen = c(5239.127472, 4587.361877,
> 7784.318736, 8793.256543, 7937.3952, 12135.84, 12718.57548,
> 8741.5104, 6295.66), P2ary_ed = c(0.666666667, 0.602150538,
> 0.166666667, 0.764285714, 0.36, 0.316455696, 0.341880342,
> 0.285714286, 0.240384615), no_fisher = c(666.9998558, 207.69228,
> 24.00000002, 223.8639163, 255.3600002, 293.7499998, 2082.386008,
> 325.0665956, 114.0832839), B_Leth = c(3.286283997, 0.330248,
> 1.384456001, 6.790178998, 7.485009002, 1.270781, 2.117207998,
> 20.121207, 5.183129001), B_Lutjan = c(1.971519001, 1.846795,
> 0.233746, 0.751358, 6.282185007, 0.526468, 0.340852, 4.458011998,
> 7.178272997), Wt_Leth = c(520.6454552, 0, 0, 51.51418019,
> 62.28921398, 1002.39553, 1830.16527, 63.49777279, 900.4192224
> ), Wt_Lutjan = c(126.2441843, 0, 57.76351477, 30.5970125,
> 60.39332797, 648.4578044, 4239.861263, 0, 935.3617853)), .Names =
> c("country",
> "village", "group", "av_expen", "P2ary_ed", "no_fisher", "B_Leth",
> "B_Lutjan", "Wt_Leth", "Wt_Lutjan"), class = "data.frame", row.names
> = c(NA,
> -9L))
> ###########################################
>
> This is easily retrievable by copying the entire block of text and
> using:
>
> dget("clipboard") # read the data into R
Just a further note that I hope in no way diminishes the value of
advice to use dput(); one could also type:
data1 <- # and then paste the copied material to the console.
It has the advantage of being general to all OS's while the device
"clipboard" is not. Had you been on a Mac, you would have needed to use:
data_object <- dget( pipe("pbpaste") )
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list