Hi R-listers,
I am new to R and programming.
I have a large dataframe composed of two grouping variables (species,
population, with populations nested in species) and tens of continuously
numeric variables. For each numeric variable, I want to make a boxplot with
population as the X axis and the boxes filled according to which species it
is belonging to. But, that is a definitely tedious work. I followed the
tutorials in the ggplot2 website. But, I have not found any way to ease this
work.
I am really thirsting for an automatic approach to plot the numeric
variables one by one in a PDF file, assigning the variable name as the y
label. Can anyone share any brilliant scripts with me. I think it must be
helpful to others who have little programming experience like me.
the code I used to make boxplot on (dataframe: All, group variable: species
and popluation, and numeric variable: conlen) is as followed:
pcon<-ggplot(All, aes(population,conlen))
pcon+geom_boxplot(aes(fill=species))
Thank you in advance.
Regards
Mao J-F
a part of my dataframe: All
species population conlen tscale fscale tseen w100s
nfsee
Py YXPy01 8.6 153 69 111 1.680851064 94
Py YXPy01 8.1 173 74 139 1.848484849 133
Py YLPy01 6.5 138 58 99 1.520833333 48
Py YLPy01 5.9 153 67 118 1.355140187 107
Py KMPy01 6.1 113 48 75 1.470588235 51
Py KMPy01 5.1 129 54 100 1.176470588 68
Py KMPy01 3.9 109 37 30 1.5 22
Py KMPy01 5 128 55 71 1.46875 64
Py KMPy01 4.7 132 54 32 1.5 28
Py KMPy01 5.8 113 52 65 1.136363636 45
Py KMPy01 4.7 114 42 71 1.131147541 61
Py KMPy01 5 120 77 131 1.403361345 119
Py GSPy02 6.2 152 59 102 1.348837209 43
Py GSPy02 6.2 111 41 64 2.805555556 36
Py GSPy02 6.7 130 56 67 1.757575758 33
Py GSPy02 6.6 115 47 78 1.603174603 63
Py GSPy02 8.9 137 61 102 1.767676768 99
Py GSPy02 6.2 157 68 115 1.459016393 61
Py BCPy01 5.3 91 39 24 1.263157895 19
Py BCPy01 6.1 100 46 53 1.117647059 17
Py BCPy01 4.5 81 32 46 1.32 25
Py LJPy01 6.6 170 65 72 2.035714286 56
Py LJPy01 6.9 104 46 58 1.8 55
Py LJPy01 8.6 161 66 38 1.794117647 34
Py LJPy01 5.4 123 40 22 2.428571429 21
Py LJPy01 6.8 123 54 57 2.044444444 46
Py LJPy01 8.6 166 77 77 1.847457627 59
Py LJPy01 6 132 51 91 1.119047619 84
Py LJPy01 6.8 108 45 27 1.814814815 27
Py LJPy01 6.2 115 48 70 1.765957447 47
Py LJPy01 8 168 80 132 2.036363636 111
Pd CYPd01 6.7 138 57 23 1.555555556 9
Pd CYPd01 6.8 121 46 53 1.973684211 38
Pd CYPd01 5.9 114 52 60 1.25 12
Pd CYPd01 5.2 119 53 53 1.432432432 37
Pd CYPd01 7.6 118 46 63 2 23
Pd CYPd01 6.1 144 61 24 1.428571429 14
Pd CYPd01 5.5 130 46 62 1.32 54
Pd CYPd01 6.6 153 57 83 1.558441558 77
Pd CYPd02 5.9 111 32 51 1.3 10
Pd CYPd02 7.1 121 51 80 1.451612903 31
Pd CYPd02 7.3 150 68 127 1.681415929 113
Pd CYPd02 5.6 121 38 64 1.228571429 36
Pd CYPd02 7.2 140 62 88 1.585365854 41
Pd CYPd02 6.1 113 54 91 1.256756757 74
Pd CYPd03 4.6 109 45 57 1.09375 32
Pd CYPd03 4.9 115 44 45 1.235294118 17
Pd CYPd03 6.4 134 44 64 1.209302326 45
Pd CYPd03 4.6 96 42 41 1.15 21
Pd CYPd03 5.6 131 43 45 1.771428571 35
Pd CYPd03 6.1 124 48 59 1.578947368 38
Pd CYPd03 5.2 110 57 71 1.340425532 47
Pd CYPd03 5.5 118 57 83 1.625 48
Pd CYPd03 6.1 106 61 95 1.559322034 60
Pd CYPd03 6.2 121 64 100 1.707692308 65
Pd CYPd03 5.1 99 38 28 1.43 20
Pd CYPd03 5.1 132 45 47 1.791666667 24
Pd YLPd01 6.15 120 43 46 1.446 21
Pt BXPd01 4.6 64 18 23 2.166666667 18
Pt BXPd01 5.1 87 26 38 2.25 32
Pt BXPd01 4.8 89 27 50 2.130434783 46
Pt BXPd01 6 97 29 31 2.684210526 19
Pt BXPd01 5.2 98 32 54 2.292682927 41
Pt GYPt01 4.3 98 27 8 4 5
Pt GYPt01 4 82 27 51 2.78125 32
Pt GYPt01 5 106 35 8 4.333333333 6
Pt GYPt01 5.1 86 24 25 3.375 16
Pt GYPt01 4.6 79 25 21 2.631578947 19
Pt GYPt01 5 80 30 23 2.823529412 17
Pt NSPt01 5.3 107 27 37 2.85 33
Pt NSPt01 5.4 85 26 38 2.27 32
Pt NSPt01 5.4 102 31 50 5.32 40
Pt NSPt01 5.1 84 23 29 5.32 23
Pt NSPt01 NA NA NA NA NA NA
Pt NSPt01 4.1 57 17 24 2.7 18
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.