Jupyter et R

Exemple ci-dessous provient de :


In [2]:
library(dplyr)


Attaching package: ‘dplyr’

The following objects are masked from ‘package:stats’:

    filter, lag

The following objects are masked from ‘package:base’:

    intersect, setdiff, setequal, union


In [3]:
iris


Out[3]:
Sepal.LengthSepal.WidthPetal.LengthPetal.WidthSpecies
15.13.51.40.2setosa
24.931.40.2setosa
34.73.21.30.2setosa
44.63.11.50.2setosa
553.61.40.2setosa
65.43.91.70.4setosa
74.63.41.40.3setosa
853.41.50.2setosa
94.42.91.40.2setosa
104.93.11.50.1setosa
115.43.71.50.2setosa
124.83.41.60.2setosa
134.831.40.1setosa
144.331.10.1setosa
155.841.20.2setosa
165.74.41.50.4setosa
175.43.91.30.4setosa
185.13.51.40.3setosa
195.73.81.70.3setosa
205.13.81.50.3setosa
215.43.41.70.2setosa
225.13.71.50.4setosa
234.63.610.2setosa
245.13.31.70.5setosa
254.83.41.90.2setosa
26531.60.2setosa
2753.41.60.4setosa
285.23.51.50.2setosa
295.23.41.40.2setosa
304.73.21.60.2setosa
314.83.11.60.2setosa
325.43.41.50.4setosa
335.24.11.50.1setosa
345.54.21.40.2setosa
354.93.11.50.2setosa
3653.21.20.2setosa
375.53.51.30.2setosa
384.93.61.40.1setosa
394.431.30.2setosa
405.13.41.50.2setosa
4153.51.30.3setosa
424.52.31.30.3setosa
434.43.21.30.2setosa
4453.51.60.6setosa
455.13.81.90.4setosa
464.831.40.3setosa
475.13.81.60.2setosa
484.63.21.40.2setosa
495.33.71.50.2setosa
5053.31.40.2setosa
5173.24.71.4versicolor
526.43.24.51.5versicolor
536.93.14.91.5versicolor
545.52.341.3versicolor
556.52.84.61.5versicolor
565.72.84.51.3versicolor
576.33.34.71.6versicolor
584.92.43.31versicolor
596.62.94.61.3versicolor
605.22.73.91.4versicolor
61523.51versicolor
625.934.21.5versicolor
6362.241versicolor
646.12.94.71.4versicolor
655.62.93.61.3versicolor
666.73.14.41.4versicolor
675.634.51.5versicolor
685.82.74.11versicolor
696.22.24.51.5versicolor
705.62.53.91.1versicolor
715.93.24.81.8versicolor
726.12.841.3versicolor
736.32.54.91.5versicolor
746.12.84.71.2versicolor
756.42.94.31.3versicolor
766.634.41.4versicolor
776.82.84.81.4versicolor
786.7351.7versicolor
7962.94.51.5versicolor
805.72.63.51versicolor
815.52.43.81.1versicolor
825.52.43.71versicolor
835.82.73.91.2versicolor
8462.75.11.6versicolor
855.434.51.5versicolor
8663.44.51.6versicolor
876.73.14.71.5versicolor
886.32.34.41.3versicolor
895.634.11.3versicolor
905.52.541.3versicolor
915.52.64.41.2versicolor
926.134.61.4versicolor
935.82.641.2versicolor
9452.33.31versicolor
955.62.74.21.3versicolor
965.734.21.2versicolor
975.72.94.21.3versicolor
986.22.94.31.3versicolor
995.12.531.1versicolor
1005.72.84.11.3versicolor
1016.33.362.5virginica
1025.82.75.11.9virginica
1037.135.92.1virginica
1046.32.95.61.8virginica
1056.535.82.2virginica
1067.636.62.1virginica
1074.92.54.51.7virginica
1087.32.96.31.8virginica
1096.72.55.81.8virginica
1107.23.66.12.5virginica
1116.53.25.12virginica
1126.42.75.31.9virginica
1136.835.52.1virginica
1145.72.552virginica
1155.82.85.12.4virginica
1166.43.25.32.3virginica
1176.535.51.8virginica
1187.73.86.72.2virginica
1197.72.66.92.3virginica
12062.251.5virginica
1216.93.25.72.3virginica
1225.62.84.92virginica
1237.72.86.72virginica
1246.32.74.91.8virginica
1256.73.35.72.1virginica
1267.23.261.8virginica
1276.22.84.81.8virginica
1286.134.91.8virginica
1296.42.85.62.1virginica
1307.235.81.6virginica
1317.42.86.11.9virginica
1327.93.86.42virginica
1336.42.85.62.2virginica
1346.32.85.11.5virginica
1356.12.65.61.4virginica
1367.736.12.3virginica
1376.33.45.62.4virginica
1386.43.15.51.8virginica
139634.81.8virginica
1406.93.15.42.1virginica
1416.73.15.62.4virginica
1426.93.15.12.3virginica
1435.82.75.11.9virginica
1446.83.25.92.3virginica
1456.73.35.72.5virginica
1466.735.22.3virginica
1476.32.551.9virginica
1486.535.22virginica
1496.23.45.42.3virginica
1505.935.11.8virginica

In [8]:
iris %>%
group_by(Species) %>%
summarise(Sepal.Width.Avg = mean(Sepal.Width)) %>%
arrange(Sepal.Width.Avg)


Out[8]:
SpeciesSepal.Width.Avg
1versicolor2.77
2virginica2.974
3setosa3.428

In [9]:
library(ggplot2)

In [10]:
ggplot(data=iris, aes(x=Sepal.Length, y=Sepal.Width, color=Species)) + geom_point(size=3)