rivers
## [1] 735 320 325 392 524 450 1459 135 465 600 330 336 280 315
## [15] 870 906 202 329 290 1000 600 505 1450 840 1243 890 350 407
## [29] 286 280 525 720 390 250 327 230 265 850 210 630 260 230
## [43] 360 730 600 306 390 420 291 710 340 217 281 352 259 250
## [57] 470 680 570 350 300 560 900 625 332 2348 1171 3710 2315 2533
## [71] 780 280 410 460 260 255 431 350 760 618 338 981 1306 500
## [85] 696 605 250 411 1054 735 233 435 490 310 460 383 375 1270
## [99] 545 445 1885 380 300 380 377 425 276 210 800 420 350 360
## [113] 538 1100 1205 314 237 610 360 540 1038 424 310 300 444 301
## [127] 268 620 215 652 900 525 246 360 529 500 720 270 430 671
## [141] 1770
length(rivers)
## [1] 141
Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.
summary(rivers)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 135.0 310.0 425.0 591.2 680.0 3710.0
# The following command generates a histogram of rivers
hist(rivers, breaks=100)
# data.frame function converts a variable to the dataframe format
myrivers <- data.frame(rivers)
#nrow function displays the total number of rows in the dataframe
nrow(myrivers)
## [1] 141
# head funtion displays the first six rows of dataframe
head(myrivers)
## rivers
## 1 735
## 2 320
## 3 325
## 4 392
## 5 524
## 6 450
# tail function displays the last six rows of dataframe
tail(myrivers)
## rivers
## 136 500
## 137 720
## 138 270
## 139 430
## 140 671
## 141 1770
myrivers$km <- myrivers$rivers * 1.609
head(myrivers)
## rivers km
## 1 735 1182.615
## 2 320 514.880
## 3 325 522.925
## 4 392 630.728
## 5 524 843.116
## 6 450 724.050
```