#Install package install.packages(“tidyverse”) install.packages(“readxl”) install.packages(“MASS”)
#Library library(tidyverse) library(readxl)
#set working directory setwd(“~/Desktop/My Class Stuff”)
#Data
district <- read_excel(“district.xls”)
#means
mean(district)
#calculate mean mean_dips<-mean(disp) mean_hp <-mean(hp) mean_drat <-mean(drat)
library(dplyr)
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:
library(stargazer)
##
## Please cite as:
## Hlavac, Marek (2022). stargazer: Well-Formatted Regression and Summary Statistics Tables.
## R package version 5.2.3. https://CRAN.R-project.org/package=stargazer
summary(DPETSPEP)
library(ggplot2)
str(district)
your_variable_here <-district %>% select(DISTNAME,DPETSPEP,DPFPASPEP) head(your_variable_here)
summary(DPETSPEP) district<-as.data.frame(DPFPASPEP)
summary(DPETSPEP) DPFPASPEP<-as.data.frame(district)
stargazer(district2.type=“text”,summary.stat = c(“n”,“mean”,“median”,“sd”,“min”,“max”))
stargazer(District.type=“text”,summary.stat = c(“n”,“mean”,“median”,“sd”,“min”,“max”))
summary(district$DPETSPEP)
summary(district$DPFPASPEP)
(cor(district\(DPETSPEP,district\)DPFPASPEP))
R version 4.5.2 (2025-10-31) – “[Not] Part in a Rumble” Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-apple-darwin20
R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type ‘license()’ or ‘licence()’ for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors. Type ‘contributors()’ for more information and ‘citation()’ on how to cite R or R packages in publications.
Type ‘demo()’ for some demos, ‘help()’ for on-line help, or ‘help.start()’ for an HTML browser interface to help. Type ‘q()’ to quit R.
DISTNAME DPETSPEP DPFPASPEP
1 CAYUGA ISD 14.6 28.9 2 ELKHART ISD 12.1 8.8 3 FRANKSTON ISD 13.1 8.4 4 NECHES ISD 10.5 10.1 5 PALESTINE ISD 13.5 6.1 6 WESTWOOD ISD 14.5 9.4
[Workspace loaded from ~/.RData]
summary(your_variable_here$DPETSPEP) Error: object ‘your_variable_here’ not found
setwd(“~/Desktop/My Class Stuff”) library(readxl) district <- read_excel(“district.xls”) View(district)
summary(your_variable_here$DPETSPEP) Error: object ‘your_variable_here’ not found
summary(district\(DPETSPEP) Min. 1st Qu. Median Mean 3rd Qu. Max. 0.00 9.90 12.10 12.27 14.20 51.70 summary(district\)DPFPASPEP) Min. 1st Qu. Median Mean 3rd Qu. Max. NA’s 0.000 5.800 8.900 9.711 12.500 49.000 5
cor(district\(DPETSPEP,district\)DPFPASPEP) [1] NA (cor(district\(DPETSPEP,district\)DPFPASPEP)) [1] NA
#The minimum is the variable with the missing values. #There are 1205 observations if we were to remove DPETSPEP and DPFPASPEP.
#I thought that there would be a correlation between the percent of special education with money spent on special education however, when i put cor(district\(DPETSPEP,district\)DPFPASPEP) it says that there is no correlation.