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.2
## ✔ ggplot2 3.5.2 ✔ tibble 3.3.0
## ✔ lubridate 1.9.4 ✔ tidyr 1.3.1
## ✔ purrr 1.1.0
## ── 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
library(pastecs)
##
## Attaching package: 'pastecs'
##
## The following objects are masked from 'package:dplyr':
##
## first, last
##
## The following object is masked from 'package:tidyr':
##
## extract
library(readxl)
district <- read_excel("district.xls")
View(district)
The variable, DPETECOP, is within the district data set Erik provided. It essentially details the percentage of economically disadvantaged students.
pastecs::stat.desc(district$DPETECOP)
## nbr.val nbr.null nbr.na min max range
## 1.207000e+03 4.000000e+00 0.000000e+00 0.000000e+00 1.000000e+02 1.000000e+02
## sum median mean SE.mean CI.mean.0.95 var
## 7.332580e+04 6.190000e+01 6.075046e+01 6.251430e-01 1.226489e+00 4.717001e+02
## std.dev coef.var
## 2.171866e+01 3.575061e-01
hist(district$DPETECOP, breaks=10,probability = T)
lines(density(district$DPETECOP),col='red',lwd=2)
mt_districts_sqrt<-district |> mutate(DPETECOP_SQRT=sqrt(DPETECOP)) |> select(DPETECOP,DPETECOP_SQRT)
head(mt_districts_sqrt)
## # A tibble: 6 × 2
## DPETECOP DPETECOP_SQRT
## <dbl> <dbl>
## 1 40.8 6.39
## 2 45.4 6.74
## 3 54.2 7.36
## 4 54.1 7.36
## 5 81.6 9.03
## 6 74 8.60
hist(mt_districts_sqrt$DPETECOP_SQRT,breaks=10,probability = T)
lines(density(mt_districts_sqrt$DPETECOP_SQRT),col='red',lwd=2)