tomatodata <- c( 6.3, 7.2, 6.8, 5.4, 6.5, 5.9, 6.6, 6.5, 7.1, 7.0)
Take Avrg
mean(tomatodata)
## [1] 6.53
Take Median
median(tomatodata)
## [1] 6.55
Standard Deviation
sd(tomatodata)
## [1] 0.5578729
Largest
max(tomatodata)
## [1] 7.2
Smallest
min(tomatodata)
## [1] 5.4
30th Percentile
quantile(tomatodata, 0.30)
## 30%
## 6.44
5-Number Summary
quantile(tomatodata)
## 0% 25% 50% 75% 100%
## 5.40 6.35 6.55 6.95 7.20
interquartile range
IQR(tomatodata)
## [1] 0.6
Histogram
hist(tomatodata)
Box Plot
boxplot(tomatodata)
Horizontal Box Plot
boxplot(tomatodata, horizontal=TRUE)
Output saying “Tomato Data is Awesome!”
print("Tomato data is awesome!")
## [1] "Tomato data is awesome!"
Saying Mean Tomato size
print(paste("The mean tomato size is", mean(tomatodata)), sep = "")
## [1] "The mean tomato size is 6.53"
Tidyverse
install.packages("tidyverse")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.4'
## (as 'lib' is unspecified)
Load tidyverse
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.5.1 ✔ tibble 3.2.1
## ✔ lubridate 1.9.4 ✔ tidyr 1.3.1
## ✔ purrr 1.0.4
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
Mtcars
data(mtcars)
Mtcars2
head(mtcars)
## mpg cyl disp hp drat wt qsec vs am gear carb
## Mazda RX4 21.0 6 160 110 3.90 2.620 16.46 0 1 4 4
## Mazda RX4 Wag 21.0 6 160 110 3.90 2.875 17.02 0 1 4 4
## Datsun 710 22.8 4 108 93 3.85 2.320 18.61 1 1 4 1
## Hornet 4 Drive 21.4 6 258 110 3.08 3.215 19.44 1 0 3 1
## Hornet Sportabout 18.7 8 360 175 3.15 3.440 17.02 0 0 3 2
## Valiant 18.1 6 225 105 2.76 3.460 20.22 1 0 3 1
tidyverse histogram
ggplot(data = mtcars, aes(x = wt)) + geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this: