#!/usr/bin/env Rscript
# Instll the Lock 5 Data
# install.packages("Lock5Data")
library(Lock5Data)
# Load the data
df <- Lock5Data::ExerciseHours
head(df)
## | LH | RH |
## -----------
## M | 2 | 1 |
## F | 1 | 0 |
a <- c("L", "R", "L", "L")
b <- c("M", "M", "M", "W")
table(a, b)
table(c(3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2))
barplot(table(df$Sex, df$Hand),
col = c("red", "blue"), legend = TRUE,
main = "My plot",
xlab = "xlab",
ylab = "My Y-Axis", beside = TRUE
)
head(df)
# Load the data
df <- Lock5Data::ExerciseHours
## Y ~ X
head(df)
formula <- Pulse ~ Exercise
mod <- lm(formula, df)
plot(formula, df)
abline(mod, col = "red")
summary(mod)
## X Y
p <- plot(df$Exercise, df$Pulse)
save.image("/tmp/1400.png")
# Exercise Pulse
# 15 57
# 20 70
# 2 70
# 10 66
# 8 62
# 14 62
## Pulse and Sex
boxplot(df$Pulse ~ df$Sex, data = df)
plot(df$Pulse ~ df$Sex, data = df)
Created
March 21, 2024 03:18
-
-
Save RyanGreenup/dd2baa6a3b601c151273d429fd7b2c6f to your computer and use it in GitHub Desktop.
class stuff
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment