The first block of R code in this r Notebook will download any necessary packages, compile where necessary and load them for use in this file.
Change include to TRUE and see what happens when you Knit the output HTML document.
We should probably comment out this code as it keeps opening and switching to the Viewer window!
Change echo to TRUE and see what happens when you Knit the output HTML document.
## [1] horsebean horsebean horsebean horsebean horsebean horsebean horsebean
## [8] horsebean horsebean horsebean linseed linseed linseed linseed
## [15] linseed linseed linseed linseed linseed linseed linseed
## [22] linseed soybean soybean soybean soybean soybean soybean
## [29] soybean soybean soybean soybean soybean soybean soybean
## [36] soybean sunflower sunflower sunflower sunflower sunflower sunflower
## [43] sunflower sunflower sunflower sunflower sunflower sunflower meatmeal
## [50] meatmeal meatmeal meatmeal meatmeal meatmeal meatmeal meatmeal
## [57] meatmeal meatmeal meatmeal casein casein casein casein
## [64] casein casein casein casein casein casein casein
## [71] casein
## Levels: casein horsebean linseed meatmeal soybean sunflower
## [1] "weight" "feed"
## 'data.frame': 71 obs. of 2 variables:
## $ weight: num 179 160 136 227 217 168 108 124 143 140 ...
## $ feed : Factor w/ 6 levels "casein","horsebean",..: 2 2 2 2 2 2 2 2 2 2 ...
## weight feed
## Min. :108.0 casein :12
## 1st Qu.:204.5 horsebean:10
## Median :258.0 linseed :12
## Mean :261.3 meatmeal :11
## 3rd Qu.:323.5 soybean :14
## Max. :423.0 sunflower:12
A Stripchart with title (main) and plot character (pch) set. Try typing ?pch in the console and hitting Enter to see help on what difference values for pch will look like.
# title and plotting character set
stripchart(chickwts$weight,
main = "Strip Chart of Chick Weights",
pch = 21)
A Histogram with title (main) and x/y labels (xlab, ylab) and color set. Try setting color using rgb() (e.g., col = rgb(1,0,0) or col = “#ff0000”).
For more information on HTML Hex Codes click here
# title and xy labels and color
hist(chickwts$weight, main = "Frequency of Chick Weights",
xlab = "Chick Weight (grams)",
ylab = "Weight Range Frequency",
col = "red")
# simple box plot
boxplot(chickwts$weight,
main = "Weight of Chickens",
ylab = "Weight(grams)")
# box-plot (multiple categories using ~)
boxplot(chickwts$weight~chickwts$feed,
main = "Chick Weights in Grams",
col = rgb(0.75, 0.5, 0.75))