Getwd
Getwd
(kalau missal all.y=T nya di hilangkan maka ref 3 akan kosong.. NA=not available)
> install.packages("dplyr")
WARNING: Rtools is required to build R packages but is not currently
installed. Please download and install the appropriate version of Rtools
before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/ASUS/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
also installing the dependencies ‘backports’, ‘ellipsis’, ‘digest’,
‘zeallot’, ‘utf8’, ‘vctrs’, ‘cli’, ‘crayon’, ‘fansi’, ‘pillar’, ‘purrr’,
‘assertthat’, ‘glue’, ‘magrittr’, ‘pkgconfig’, ‘R6’, ‘Rcpp’, ‘rlang’,
‘tibble’, ‘tidyselect’, ‘BH’, ‘plogr’
trying URL
'https://cran.rstudio.com/bin/windows/contrib/3.5/backports_1.1.4.zip'
Content type 'application/zip' length 66186 bytes (64 KB)
downloaded 64 KB
trying URL
'https://cran.rstudio.com/bin/windows/contrib/3.5/ellipsis_0.2.0.1.zip'
Content type 'application/zip' length 43270 bytes (42 KB)
downloaded 42 KB
trying URL
'https://cran.rstudio.com/bin/windows/contrib/3.5/digest_0.6.20.zip'
Content type 'application/zip' length 222453 bytes (217 KB)
downloaded 217 KB
trying URL
'https://cran.rstudio.com/bin/windows/contrib/3.5/zeallot_0.1.0.zip'
Content type 'application/zip' length 61464 bytes (60 KB)
downloaded 60 KB
trying URL
'https://cran.rstudio.com/bin/windows/contrib/3.5/crayon_1.3.4.zip'
Content type 'application/zip' length 749109 bytes (731 KB)
downloaded 731 KB
trying URL
'https://cran.rstudio.com/bin/windows/contrib/3.5/pillar_1.4.2.zip'
Content type 'application/zip' length 179982 bytes (175 KB)
downloaded 175 KB
trying URL
'https://cran.rstudio.com/bin/windows/contrib/3.5/assertthat_0.2.1.zip'
Content type 'application/zip' length 54021 bytes (52 KB)
downloaded 52 KB
trying URL
'https://cran.rstudio.com/bin/windows/contrib/3.5/magrittr_1.5.zip'
Content type 'application/zip' length 155732 bytes (152 KB)
downloaded 152 KB
trying URL
'https://cran.rstudio.com/bin/windows/contrib/3.5/pkgconfig_2.0.2.zip'
Content type 'application/zip' length 22205 bytes (21 KB)
downloaded 21 KB
trying URL
'https://cran.rstudio.com/bin/windows/contrib/3.5/tidyselect_0.2.5.zip'
Content type 'application/zip' length 625672 bytes (611 KB)
downloaded 611 KB
filter, lag
> library(hflights)
Error in library(hflights) : there is no package called ‘hflights’
> install.packages("hflights")
WARNING: Rtools is required to build R packages but is not currently
installed. Please download and install the appropriate version of Rtools
before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/ASUS/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
trying URL
'https://cran.rstudio.com/bin/windows/contrib/3.5/hflights_0.1.zip'
Content type 'application/zip' length 3473044 bytes (3.3 MB)
downloaded 3.3 MB
# Using lambdas
list(~ mean(., trim = .2), ~ median(., na.rm = TRUE))
This warning is displayed once per session.
# untuk tiap penerbangan, hitung minimum dan maksimum delay untuk kedatangan dan
keberangkatan
> flights %>%
+ group_by(UniqueCarrier) %>%
+ summarise_each(funs(min(., na.rm=TRUE), max(., na.rm=TRUE)), matches("Delay"))
# A tibble: 15 x 5
UniqueCarrier ArrDelay_min DepDelay_min ArrDelay_max DepDelay_max
<chr> <int> <int> <int> <int>
1 AA -39 -15 978 970
2 AS -43 -15 183 172
3 B6 -44 -14 335 310
4 CO -55 -18 957 981
5 DL -32 -17 701 730
6 EV -40 -18 469 479
7 F9 -24 -15 277 275
8 FL -30 -14 500 507
9 MQ -38 -23 918 931
10 OO -57 -33 380 360
11 UA -47 -11 861 869
12 US -42 -17 433 425
13 WN -44 -10 499 548
14 XE -70 -19 634 628
15 YV -32 -11 72 54
> install.packages("reshape2")
WARNING: Rtools is required to build R packages but is not currently installed. Please
download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/ASUS/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
also installing the dependencies ‘stringi’, ‘plyr’, ‘stringr’