In plyr: Tools for Splitting, Applying and Combining Data. Description Usage Arguments Details Value See Also Examples. View source: R/count.r. Equivalent to as.data.frame(table(x)), but does not include combinations with zero counts. Mweb 3 2 2 cheats. 2.1 Plyr setup and install. To start using plyr install and load the plyr library. All examples in this chapter will be based on the Weather dataframe below. This dataset consists of 5 columns and 364 rows; the first three columns are the date and month followed by the season that particular day is in.
Plyr Hls Example
For practical use, a thin compatibility layer seems to work reasonably well for a project that was created using
plyr
and is now transitioning towards dplyr
:![Example Example](https://nzprimarysectortrade.files.wordpress.com/2011/10/geo-pie-example.png?w=640&h=357)
Tests in the
pdlyr
package will assure that this package can be safely loaded with warn.conflicts = FALSE
. The original plyr
implementations can be accessed via shortcuts (prefix p
).A few usage examples:
mpg | cyl | disp | hp | drat | wt | qsec | vs | am | gear | carb | lphkm |
---|---|---|---|---|---|---|---|---|---|---|---|
21.0 | 6 | 160 | 110 | 3.90 | 2.620 | 16.46 | 0 | 1 | 4 | 4 | 11.20069 |
21.0 | 6 | 160 | 110 | 3.90 | 2.875 | 17.02 | 0 | 1 | 4 | 4 | 11.20069 |
22.8 | 4 | 108 | 93 | 3.85 | 2.320 | 18.61 | 1 | 1 | 4 | 1 | 10.31643 |
21.4 | 6 | 258 | 110 | 3.08 | 3.215 | 19.44 | 1 | 0 | 3 | 1 | 10.99134 |
18.7 | 8 | 360 | 175 | 3.15 | 3.440 | 17.02 | 0 | 0 | 3 | 2 | 12.57832 |
18.1 | 6 | 225 | 105 | 2.76 | 3.460 | 20.22 | 1 | 0 | 3 | 1 | 12.99528 |
mpg | cyl | disp | hp | drat | wt | qsec | vs | am | gear | carb | lphkm | |
---|---|---|---|---|---|---|---|---|---|---|---|---|
Mazda RX4 | 21.0 | 6 | 160 | 110 | 3.90 | 2.620 | 16.46 | 0 | 1 | 4 | 4 | 11.20069 |
Mazda RX4 Wag | 21.0 | 6 | 160 | 110 | 3.90 | 2.875 | 17.02 | 0 | 1 | 4 | 4 | 11.20069 |
Datsun 710 | 22.8 | 4 | 108 | 93 | 3.85 | 2.320 | 18.61 | 1 | 1 | 4 | 1 | 10.31643 |
Hornet 4 Drive | 21.4 | 6 | 258 | 110 | 3.08 | 3.215 | 19.44 | 1 | 0 | 3 | 1 | 10.99134 |
Hornet Sportabout | 18.7 | 8 | 360 | 175 | 3.15 | 3.440 | 17.02 | 0 | 0 | 3 | 2 | 12.57832 |
Valiant | 18.1 | 6 | 225 | 105 | 2.76 | 3.460 | 20.22 | 1 | 0 | 3 | 1 | 12.99528 |
cyl | mean_mpg |
---|---|
4 | 26.66364 |
6 | 19.74286 |
8 | 15.10000 |
cyl | mean_mpg |
---|---|
4 | 26.66364 |
6 | 19.74286 |
8 | 15.10000 |
![Plyr Example Plyr Example](https://i.stack.imgur.com/MWjII.png)
mpg | cyl | disp | hp | drat | wt | qsec | vs | am | gear | carb |
---|---|---|---|---|---|---|---|---|---|---|
10.4 | 8 | 460.0 | 215 | 3.00 | 5.424 | 17.82 | 0 | 0 | 3 | 4 |
14.7 | 8 | 440.0 | 230 | 3.23 | 5.345 | 17.42 | 0 | 0 | 3 | 4 |
10.4 | 8 | 472.0 | 205 | 2.93 | 5.250 | 17.98 | 0 | 0 | 3 | 4 |
16.4 | 8 | 275.8 | 180 | 3.07 | 4.070 | 17.40 | 0 | 0 | 3 | 3 |
19.2 | 8 | 400.0 | 175 | 3.08 | 3.845 | 17.05 | 0 | 0 | 3 | 2 |
13.3 | 8 | 350.0 | 245 | 3.73 | 3.840 | 15.41 | 0 | 0 | 3 | 4 |
mpg | cyl | disp | hp | drat | wt | qsec | vs | am | gear | carb |
---|---|---|---|---|---|---|---|---|---|---|
10.4 | 8 | 460.0 | 215 | 3.00 | 5.424 | 17.82 | 0 | 0 | 3 | 4 |
14.7 | 8 | 440.0 | 230 | 3.23 | 5.345 | 17.42 | 0 | 0 | 3 | 4 |
10.4 | 8 | 472.0 | 205 | 2.93 | 5.250 | 17.98 | 0 | 0 | 3 | 4 |
16.4 | 8 | 275.8 | 180 | 3.07 | 4.070 | 17.40 | 0 | 0 | 3 | 3 |
19.2 | 8 | 400.0 | 175 | 3.08 | 3.845 | 17.05 | 0 | 0 | 3 | 2 |
13.3 | 8 | 350.0 | 245 | 3.73 | 3.840 | 15.41 | 0 | 0 | 3 | 4 |
gear | freq |
---|---|
3 | 15 |
4 | 12 |
5 | 5 |
gear | freq |
---|---|
3 | 15 |
4 | 12 |
5 | 5 |
Plyr Events Example
miles_per_gallon | cyl | |
---|---|---|
Mazda RX4 | 21.0 | 6 |
Mazda RX4 Wag | 21.0 | 6 |
Datsun 710 | 22.8 | 4 |
Hornet 4 Drive | 21.4 | 6 |
Hornet Sportabout | 18.7 | 8 |
Valiant | 18.1 | 6 |
miles_per_gallon | cyl | |
---|---|---|
Mazda RX4 | 21.0 | 6 |
Mazda RX4 Wag | 21.0 | 6 |
Datsun 710 | 22.8 | 4 |
Hornet 4 Drive | 21.4 | 6 |
Hornet Sportabout | 18.7 | 8 |
Valiant | 18.1 | 6 |
Play Example For Writing
Last changed: 2015-05-27 11:36:17 UTC Swift note 2 1 1 download free.