This report was generated using AI under general human direction. At the time of generation, the contents have not been comprehensively reviewed by a human analyst.
library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.2.1 ✔ readr 2.2.0
✔ forcats 1.0.1 ✔ stringr 1.6.0
✔ ggplot2 4.0.4 ✔ tibble 3.3.1
✔ lubridate 1.9.5 ✔ tidyr 1.3.2
✔ purrr 1.2.2
── 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
cats1 <-read_csv("data/cats1.csv")
Rows: 31 Columns: 8
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (3): id, name, gender
dbl (4): length_cm, height_cm, weight_kg, age_years
lgl (1): neutered
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Introduction
This report presents an exploratory data analysis of the cats1.csv dataset. The dataset contains physical measurements and characteristics for 31 cats, including identifier, name, gender, length, height, weight, age, and neutered status.
Data cleaning and preparation
Before conducting the analysis, we inspect the dataset for missing values, inconsistent coding, and potential data issues.
The average weight of the cats in the sample is 6.55 kg, and the average length is 48.33 cm.
Distribution of physical traits
ggplot(cats1_clean, aes(x = length_cm, y = weight_kg)) +geom_point(aes(color = gender), size =3, na.rm =TRUE) +geom_smooth(method ="lm", se =FALSE, color ="darkblue", na.rm =TRUE) +labs(title ="Cat weight versus length",x ="Length (cm)",y ="Weight (kg)",color ="Gender" ) +theme_minimal()
Regression analysis
We fit a simple linear regression model to examine the relationship between cat weight and length.
cats_model <-lm(weight_kg ~ length_cm, data = cats1_clean)summary(cats_model)
Call:
lm(formula = weight_kg ~ length_cm, data = cats1_clean)
Residuals:
Min 1Q Median 3Q Max
-4.571 -2.538 -2.003 -0.819 49.464
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 4.65147 8.67744 0.536 0.596
length_cm 0.03934 0.17519 0.225 0.824
Residual standard error: 9.969 on 26 degrees of freedom
(3 observations deleted due to missingness)
Multiple R-squared: 0.001936, Adjusted R-squared: -0.03645
F-statistic: 0.05043 on 1 and 26 DF, p-value: 0.8241
The regression model indicates the relationship between length and weight. Specifically, for each additional centimeter in length, weight is estimated to change by 0.039 kg.
Conclusion
This analysis explored the physical characteristics of cats using the cats1.csv dataset. Summary statistics and regression modeling provide insights into the physical measurements and proportions of the sampled cats.