library(tidyverse)
## Warning: package 'tidyverse' was built under R version 4.1.1
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v ggplot2 3.3.5 v purrr 0.3.4
## v tibble 3.1.2 v dplyr 1.0.7
## v tidyr 1.1.3 v stringr 1.4.0
## v readr 1.4.0 v forcats 0.5.1
## Warning: package 'ggplot2' was built under R version 4.1.2
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
Students_score_csv <- read_csv("CASchools.csv")
## Warning: Missing column names filled in: 'X1' [1]
##
## -- Column specification --------------------------------------------------------
## cols(
## X1 = col_double(),
## district = col_double(),
## school = col_character(),
## county = col_character(),
## grades = col_character(),
## students = col_double(),
## teachers = col_double(),
## calworks = col_double(),
## lunch = col_double(),
## computer = col_double(),
## expenditure = col_double(),
## income = col_double(),
## english = col_double(),
## read = col_double(),
## math = col_double()
## )
head(Students_score_csv)
## # A tibble: 6 x 15
## X1 district school county grades students teachers calworks lunch computer
## <dbl> <dbl> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 1 75119 Sunol ~ Alame~ KK-08 195 10.9 0.510 2.04 67
## 2 2 61499 Manzan~ Butte KK-08 240 11.1 15.4 47.9 101
## 3 3 61549 Therma~ Butte KK-08 1550 82.9 55.0 76.3 169
## 4 4 61457 Golden~ Butte KK-08 243 14 36.5 77.0 85
## 5 5 61523 Palerm~ Butte KK-08 1335 71.5 33.1 78.4 171
## 6 6 62042 Burrel~ Fresno KK-08 137 6.40 12.3 87.0 25
## # ... with 5 more variables: expenditure <dbl>, income <dbl>, english <dbl>,
## # read <dbl>, math <dbl>
slice(Students_score_csv, 1:10)
## # A tibble: 10 x 15
## X1 district school county grades students teachers calworks lunch
## <dbl> <dbl> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl>
## 1 1 75119 Sunol Glen U~ Alameda KK-08 195 10.9 0.510 2.04
## 2 2 61499 Manzanita El~ Butte KK-08 240 11.1 15.4 47.9
## 3 3 61549 Thermalito U~ Butte KK-08 1550 82.9 55.0 76.3
## 4 4 61457 Golden Feath~ Butte KK-08 243 14 36.5 77.0
## 5 5 61523 Palermo Unio~ Butte KK-08 1335 71.5 33.1 78.4
## 6 6 62042 Burrel Union~ Fresno KK-08 137 6.40 12.3 87.0
## 7 7 68536 Holt Union E~ San Jo~ KK-08 195 10 12.9 94.6
## 8 8 63834 Vineland Ele~ Kern KK-08 888 42.5 18.8 100
## 9 9 62331 Orange Cente~ Fresno KK-08 379 19 32.2 93.1
## 10 10 67306 Del Paso Hei~ Sacram~ KK-06 2247 108 79.0 87.3
## # ... with 6 more variables: computer <dbl>, expenditure <dbl>, income <dbl>,
## # english <dbl>, read <dbl>, math <dbl>
nrow(Students_score_csv)
## [1] 420
slice(Students_score_csv, 5)
## # A tibble: 1 x 15
## X1 district school county grades students teachers calworks lunch computer
## <dbl> <dbl> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 5 61523 Palerm~ Butte KK-08 1335 71.5 33.1 78.4 171
## # ... with 5 more variables: expenditure <dbl>, income <dbl>, english <dbl>,
## # read <dbl>, math <dbl>
slice(Students_score_csv, 1, 5)
## # A tibble: 2 x 15
## X1 district school county grades students teachers calworks lunch computer
## <dbl> <dbl> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 1 75119 Sunol ~ Alame~ KK-08 195 10.9 0.510 2.04 67
## 2 5 61523 Palerm~ Butte KK-08 1335 71.5 33.1 78.4 171
## # ... with 5 more variables: expenditure <dbl>, income <dbl>, english <dbl>,
## # read <dbl>, math <dbl>
select(Students_score_csv, district, grades, students)
## # A tibble: 420 x 3
## district grades students
## <dbl> <chr> <dbl>
## 1 75119 KK-08 195
## 2 61499 KK-08 240
## 3 61549 KK-08 1550
## 4 61457 KK-08 243
## 5 61523 KK-08 1335
## 6 62042 KK-08 137
## 7 68536 KK-08 195
## 8 63834 KK-08 888
## 9 62331 KK-08 379
## 10 67306 KK-06 2247
## # ... with 410 more rows
filter(Students_score_csv, district == 75119)
## # A tibble: 1 x 15
## X1 district school county grades students teachers calworks lunch computer
## <dbl> <dbl> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 1 75119 Sunol ~ Alame~ KK-08 195 10.9 0.510 2.04 67
## # ... with 5 more variables: expenditure <dbl>, income <dbl>, english <dbl>,
## # read <dbl>, math <dbl>
filter(Students_score_csv, (grades == 'KK-06' & students > 100))
## # A tibble: 60 x 15
## X1 district school county grades students teachers calworks lunch computer
## <dbl> <dbl> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 10 67306 Del P~ Sacra~ KK-06 2247 108 79.0 87.3 0
## 2 27 65961 Alisa~ Monte~ KK-06 7306 320. 17.0 88.0 742
## 3 45 67199 Perri~ River~ KK-06 4258 221 24.7 92.7 324
## 4 53 66142 Salin~ Monte~ KK-06 9028 450. 14.0 69.9 669
## 5 58 67421 Robla~ Sacra~ KK-06 2253 113. 43.5 84.6 196
## 6 62 67397 North~ Sacra~ KK-06 5138 291. 58.8 85.0 560
## 7 63 66423 Anahe~ Orange KK-06 20927 954. 10.9 82.4 1048
## 8 69 68221 Natio~ San D~ KK-06 6639 305. 26.8 100 505
## 9 70 70904 Rosel~ Sonoma KK-06 1154 62.1 22.9 84.9 129
## 10 87 67231 Romol~ River~ KK-06 1358 65 14.8 80.9 178
## # ... with 50 more rows, and 5 more variables: expenditure <dbl>, income <dbl>,
## # english <dbl>, read <dbl>, math <dbl>
summary(Students_score_csv)
## X1 district school county
## Min. : 1.0 Min. :61382 Length:420 Length:420
## 1st Qu.:105.8 1st Qu.:64308 Class :character Class :character
## Median :210.5 Median :67761 Mode :character Mode :character
## Mean :210.5 Mean :67473
## 3rd Qu.:315.2 3rd Qu.:70419
## Max. :420.0 Max. :75440
## grades students teachers calworks
## Length:420 Min. : 81.0 Min. : 4.85 Min. : 0.000
## Class :character 1st Qu.: 379.0 1st Qu.: 19.66 1st Qu.: 4.395
## Mode :character Median : 950.5 Median : 48.56 Median :10.520
## Mean : 2628.8 Mean : 129.07 Mean :13.246
## 3rd Qu.: 3008.0 3rd Qu.: 146.35 3rd Qu.:18.981
## Max. :27176.0 Max. :1429.00 Max. :78.994
## lunch computer expenditure income
## Min. : 0.00 Min. : 0.0 Min. :3926 Min. : 5.335
## 1st Qu.: 23.28 1st Qu.: 46.0 1st Qu.:4906 1st Qu.:10.639
## Median : 41.75 Median : 117.5 Median :5215 Median :13.728
## Mean : 44.71 Mean : 303.4 Mean :5312 Mean :15.317
## 3rd Qu.: 66.86 3rd Qu.: 375.2 3rd Qu.:5601 3rd Qu.:17.629
## Max. :100.00 Max. :3324.0 Max. :7712 Max. :55.328
## english read math
## Min. : 0.000 Min. :604.5 Min. :605.4
## 1st Qu.: 1.941 1st Qu.:640.4 1st Qu.:639.4
## Median : 8.778 Median :655.8 Median :652.5
## Mean :15.768 Mean :655.0 Mean :653.3
## 3rd Qu.:22.970 3rd Qu.:668.7 3rd Qu.:665.9
## Max. :85.540 Max. :704.0 Max. :709.5
total_score <- mutate(Students_score_csv, english*math*read)
total_score
## # A tibble: 420 x 16
## X1 district school county grades students teachers calworks lunch
## <dbl> <dbl> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl>
## 1 1 75119 Sunol Glen U~ Alameda KK-08 195 10.9 0.510 2.04
## 2 2 61499 Manzanita El~ Butte KK-08 240 11.1 15.4 47.9
## 3 3 61549 Thermalito U~ Butte KK-08 1550 82.9 55.0 76.3
## 4 4 61457 Golden Feath~ Butte KK-08 243 14 36.5 77.0
## 5 5 61523 Palermo Unio~ Butte KK-08 1335 71.5 33.1 78.4
## 6 6 62042 Burrel Union~ Fresno KK-08 137 6.40 12.3 87.0
## 7 7 68536 Holt Union E~ San Jo~ KK-08 195 10 12.9 94.6
## 8 8 63834 Vineland Ele~ Kern KK-08 888 42.5 18.8 100
## 9 9 62331 Orange Cente~ Fresno KK-08 379 19 32.2 93.1
## 10 10 67306 Del Paso Hei~ Sacram~ KK-06 2247 108 79.0 87.3
## # ... with 410 more rows, and 7 more variables: computer <dbl>,
## # expenditure <dbl>, income <dbl>, english <dbl>, read <dbl>, math <dbl>,
## # english * math * read <dbl>
total_score2 <- mutate(Students_score_csv, total_score=(english*math*read))
total_score2
## # A tibble: 420 x 16
## X1 district school county grades students teachers calworks lunch
## <dbl> <dbl> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl>
## 1 1 75119 Sunol Glen U~ Alameda KK-08 195 10.9 0.510 2.04
## 2 2 61499 Manzanita El~ Butte KK-08 240 11.1 15.4 47.9
## 3 3 61549 Thermalito U~ Butte KK-08 1550 82.9 55.0 76.3
## 4 4 61457 Golden Feath~ Butte KK-08 243 14 36.5 77.0
## 5 5 61523 Palermo Unio~ Butte KK-08 1335 71.5 33.1 78.4
## 6 6 62042 Burrel Union~ Fresno KK-08 137 6.40 12.3 87.0
## 7 7 68536 Holt Union E~ San Jo~ KK-08 195 10 12.9 94.6
## 8 8 63834 Vineland Ele~ Kern KK-08 888 42.5 18.8 100
## 9 9 62331 Orange Cente~ Fresno KK-08 379 19 32.2 93.1
## 10 10 67306 Del Paso Hei~ Sacram~ KK-06 2247 108 79.0 87.3
## # ... with 410 more rows, and 7 more variables: computer <dbl>,
## # expenditure <dbl>, income <dbl>, english <dbl>, read <dbl>, math <dbl>,
## # total_score <dbl>
summarize(Students_score_csv, mean(income), median(expenditure))
## # A tibble: 1 x 2
## `mean(income)` `median(expenditure)`
## <dbl> <dbl>
## 1 15.3 5215.
school_group <- group_by(Students_score_csv, school)
school_group
## # A tibble: 420 x 15
## # Groups: school [409]
## X1 district school county grades students teachers calworks lunch
## <dbl> <dbl> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl>
## 1 1 75119 Sunol Glen U~ Alameda KK-08 195 10.9 0.510 2.04
## 2 2 61499 Manzanita El~ Butte KK-08 240 11.1 15.4 47.9
## 3 3 61549 Thermalito U~ Butte KK-08 1550 82.9 55.0 76.3
## 4 4 61457 Golden Feath~ Butte KK-08 243 14 36.5 77.0
## 5 5 61523 Palermo Unio~ Butte KK-08 1335 71.5 33.1 78.4
## 6 6 62042 Burrel Union~ Fresno KK-08 137 6.40 12.3 87.0
## 7 7 68536 Holt Union E~ San Jo~ KK-08 195 10 12.9 94.6
## 8 8 63834 Vineland Ele~ Kern KK-08 888 42.5 18.8 100
## 9 9 62331 Orange Cente~ Fresno KK-08 379 19 32.2 93.1
## 10 10 67306 Del Paso Hei~ Sacram~ KK-06 2247 108 79.0 87.3
## # ... with 410 more rows, and 6 more variables: computer <dbl>,
## # expenditure <dbl>, income <dbl>, english <dbl>, read <dbl>, math <dbl>
summarize(school_group, mean(english), sum(read))
## # A tibble: 409 x 3
## school `mean(english)` `sum(read)`
## <chr> <dbl> <dbl>
## 1 Ackerman Elementary 1.94 671.
## 2 Adelanto Elementary 18.0 640.
## 3 Alexander Valley Union Elementary 28.6 662.
## 4 Alisal Union Elementary 73.7 620.
## 5 Allensworth Elementary 42.7 613.
## 6 Alpine Union Elementary 1.32 668.
## 7 Alta-Dutch Flat Union Elementary 0 680.
## 8 Alta Loma Elementary 3.26 663.
## 9 Alta Vista Elementary 39.1 621.
## 10 Alum Rock Union Elementary 49.9 630.
## # ... with 399 more rows
county <- group_by(Students_score_csv, county, school, students)
summarize(county)
## `summarise()` has grouped output by 'county', 'school'. You can override using the `.groups` argument.
## # A tibble: 420 x 3
## # Groups: county, school [420]
## county school students
## <chr> <chr> <dbl>
## 1 Alameda Sunol Glen Unified 195
## 2 Butte Bangor Union Elementary 146
## 3 Butte Golden Feather Union Elementary 243
## 4 Butte Manzanita Elementary 240
## 5 Butte Oroville City Elementary 3401
## 6 Butte Palermo Union Elementary 1335
## 7 Butte Thermalito Union Elementary 1550
## 8 Calaveras Mark Twain Union Elementary 777
## 9 Contra Costa Brentwood Union Elementary 3519
## 10 Contra Costa Knightsen Elementary 353
## # ... with 410 more rows
count(Students_score_csv, county)
## # A tibble: 45 x 2
## county n
## <chr> <int>
## 1 Alameda 1
## 2 Butte 6
## 3 Calaveras 1
## 4 Contra Costa 7
## 5 El Dorado 10
## 6 Fresno 12
## 7 Glenn 3
## 8 Humboldt 17
## 9 Imperial 6
## 10 Inyo 1
## # ... with 35 more rows
unique(Students_score_csv$school)
## [1] "Sunol Glen Unified"
## [2] "Manzanita Elementary"
## [3] "Thermalito Union Elementary"
## [4] "Golden Feather Union Elementary"
## [5] "Palermo Union Elementary"
## [6] "Burrel Union Elementary"
## [7] "Holt Union Elementary"
## [8] "Vineland Elementary"
## [9] "Orange Center Elementary"
## [10] "Del Paso Heights Elementary"
## [11] "Le Grand Union Elementary"
## [12] "West Fresno Elementary"
## [13] "Allensworth Elementary"
## [14] "Sunnyside Union Elementary"
## [15] "Woodville Elementary"
## [16] "Pixley Union Elementary"
## [17] "Lost Hills Union Elementary"
## [18] "Buttonwillow Union Elementary"
## [19] "Lennox Elementary"
## [20] "Lamont Elementary"
## [21] "Westmorland Union Elementary"
## [22] "Pleasant View Elementary"
## [23] "Wasco Union Elementary"
## [24] "Alta Vista Elementary"
## [25] "Livingston Union Elementary"
## [26] "Woodlake Union Elementary"
## [27] "Alisal Union Elementary"
## [28] "Arvin Union Elementary"
## [29] "Terra Bella Union Elementary"
## [30] "Tipton Elementary"
## [31] "San Ysidro Elementary"
## [32] "Soledad Unified"
## [33] "Mountain View Elementary"
## [34] "King City Union Elementary"
## [35] "Ontario-Montclair Elementary"
## [36] "Los Nietos Elementary"
## [37] "Winton Elementary"
## [38] "Raisin City Elementary"
## [39] "Ravenswood City Elementary"
## [40] "Richland-Lerdo Union Elementary"
## [41] "Oxnard Elementary"
## [42] "El Nido Elementary"
## [43] "Fairfax Elementary"
## [44] "Delano Union Elementary"
## [45] "Perris Elementary"
## [46] "Valle Lindo Elementary"
## [47] "Alum Rock Union Elementary"
## [48] "Edison Elementary"
## [49] "Bakersfield City Elementary"
## [50] "Franklin-McKinley Elementary"
## [51] "Hawthorne Elementary"
## [52] "Chowchilla Elementary"
## [53] "Salinas City Elementary"
## [54] "Santa Maria-Bonita Elementary"
## [55] "Whittier City Elementary"
## [56] "Eastside Union Elementary"
## [57] "Lawndale Elementary"
## [58] "Robla Elementary"
## [59] "Santa Rita Union Elementary"
## [60] "Rio Elementary"
## [61] "Strathmore Union Elementary"
## [62] "North Sacramento Elementary"
## [63] "Anaheim Elementary"
## [64] "Lemoore Union Elementary"
## [65] "Armona Union Elementary"
## [66] "Beardsley Elementary"
## [67] "South Whittier Elementary"
## [68] "Hanford Elementary"
## [69] "National Elementary"
## [70] "Roseland Elementary"
## [71] "Di Giorgio Elementary"
## [72] "Keppel Union Elementary"
## [73] "Lakeside Union Elementary"
## [74] "Merced City Elementary"
## [75] "Guadalupe Union Elementary"
## [76] "Cucamonga Elementary"
## [77] "Knightsen Elementary"
## [78] "Rio Dell Elementary"
## [79] "Montague Elementary"
## [80] "McCloud Union Elementary"
## [81] "Santa Paula Elementary"
## [82] "West Park Elementary"
## [83] "Atwater Elementary"
## [84] "Weaver Union Elementary"
## [85] "Pacific Union Elementary"
## [86] "Lucerne Valley Unified"
## [87] "Romoland Elementary"
## [88] "El Monte City Elementary"
## [89] "Greenfield Union Elementary"
## [90] "Palo Verde Union Elementary"
## [91] "Elverta Joint Elementary"
## [92] "Lucerne Elementary"
## [93] "Luther Burbank Elementary"
## [94] "Bangor Union Elementary"
## [95] "Bayshore Elementary"
## [96] "Oak Valley Union Elementary"
## [97] "Wilsona Elementary"
## [98] "Brawley Elementary"
## [99] "Meadows Union Elementary"
## [100] "Little Lake City Elementary"
## [101] "Pond Union Elementary"
## [102] "Taft City Elementary"
## [103] "Brittan Elementary"
## [104] "Arena Union Elementary"
## [105] "Adelanto Elementary"
## [106] "Hollister School District"
## [107] "Palmdale Elementary"
## [108] "Oroville City Elementary"
## [109] "Standard Elementary"
## [110] "Briggs Elementary"
## [111] "Monroe Elementary"
## [112] "Lancaster Elementary"
## [113] "Alview-Dairyland Union Elementary"
## [114] "Magnolia Elementary"
## [115] "Liberty Elementary"
## [116] "Mt. Pleasant Elementary"
## [117] "El Centro Elementary"
## [118] "South Bay Union Elementary"
## [119] "Cascade Union Elementary"
## [120] "Kings River Union Elementary"
## [121] "Gerber Union Elementary"
## [122] "Exeter Union Elementary"
## [123] "American Union Elementary"
## [124] "San Antonio Union Elementary"
## [125] "Burton Elementary"
## [126] "Nuview Union Elementary"
## [127] "Bellevue Union Elementary"
## [128] "Garvey Elementary"
## [129] "Corning Union Elementary"
## [130] "Jefferson Elementary"
## [131] "Big Springs Union Elementary"
## [132] "General Shafter Elementary"
## [133] "Turlock Joint Elementary"
## [134] "Twain Harte-Long Barn Union Elementary"
## [135] "Redwood City Elementary"
## [136] "Camino Union Elementary"
## [137] "Plainsburg Union Elementary"
## [138] "Banta Elementary"
## [139] "Washington Colony Elementary"
## [140] "Rio Linda Union Elementary"
## [141] "Chatom Union Elementary"
## [142] "Merced River Union Elementary"
## [143] "Hueneme Elementary"
## [144] "Cuddeback Union Elementary"
## [145] "Blue Lake Union Elementary"
## [146] "Lemon Grove Elementary"
## [147] "Upper Lake Union Elementary"
## [148] "Peninsula Union Elementary"
## [149] "Ocean View Elementary"
## [150] "Reeds Creek Elementary"
## [151] "Arcohe Union Elementary"
## [152] "New Jerusalem Elementary"
## [153] "Dunsmuir Elementary"
## [154] "Stanislaus Union Elementary"
## [155] "Kingsburg Joint Union Elementary"
## [156] "Buena Park Elementary"
## [157] "Westminster Elementary"
## [158] "Island Union Elementary"
## [159] "Tulare City Elementary"
## [160] "Chula Vista Elementary"
## [161] "Black Butte Union Elementary"
## [162] "McSwain Union Elementary"
## [163] "Franklin Elementary"
## [164] "Escondido Union Elementary"
## [165] "East Whittier City Elementary"
## [166] "Rio Bravo-Greeley Union Elementary"
## [167] "Marcum-Illinois Union Elementary"
## [168] "Vallecitos Elementary"
## [169] "Victor Elementary"
## [170] "Savanna Elementary"
## [171] "West Side Union Elementary"
## [172] "Enterprise Elementary"
## [173] "Red Bluff Union Elementary"
## [174] "Jamestown Elementary"
## [175] "Weed Union Elementary"
## [176] "Brentwood Union Elementary"
## [177] "Summerville Elementary"
## [178] "Ophir Elementary"
## [179] "Montgomery Elementary"
## [180] "Santa Rosa Elementary"
## [181] "Salida Union Elementary"
## [182] "Shasta Union Elementary"
## [183] "Fortuna Union Elementary"
## [184] "Rockford Elementary"
## [185] "Plaza Elementary"
## [186] "Monte Rio Union Elementary"
## [187] "Janesville Union Elementary"
## [188] "Magnolia Union Elementary"
## [189] "Shaffer Union Elementary"
## [190] "Fullerton Elementary"
## [191] "Cinnabar Elementary"
## [192] "Santa Barbara Elementary"
## [193] "Rohnerville Elementary"
## [194] "Pleasant Grove Joint Union Elementary"
## [195] "Mountain Union Elementary"
## [196] "South Fork Union Elementary"
## [197] "Jamul-Dulzura Union Elementary"
## [198] "Live Oak Elementary"
## [199] "Menifee Union Elementary"
## [200] "Whisman Elementary"
## [201] "McCabe Union Elementary"
## [202] "Lammersville Elementary"
## [203] "Lassen View Union Elementary"
## [204] "Loleta Union Elementary"
## [205] "Junction Elementary"
## [206] "Rosemead Elementary"
## [207] "Grass Valley Elementary"
## [208] "Buena Vista Elementary"
## [209] "Kernville Union Elementary"
## [210] "Galt Joint Union Elementary"
## [211] "Southside Elementary"
## [212] "Nuestro Elementary"
## [213] "Alvina Elementary"
## [214] "Oakley Union Elementary"
## [215] "Etna Union Elementary"
## [216] "Berryessa Union Elementary"
## [217] "Kit Carson Union Elementary"
## [218] "Sylvan Union Elementary"
## [219] "Oak View Union Elementary"
## [220] "Auburn Union Elementary"
## [221] "North County Joint Union Elementary"
## [222] "Pioneer Union Elementary"
## [223] "Central Elementary"
## [224] "Pacheco Union Elementary"
## [225] "Chicago Park Elementary"
## [226] "Brisbane Elementary"
## [227] "Central Union Elementary"
## [228] "Happy Valley Union Elementary"
## [229] "Mark Twain Union Elementary"
## [230] "San Rafael City Elementary"
## [231] "Cajon Valley Union Elementary"
## [232] "Campbell Union Elementary"
## [233] "Browns Elementary"
## [234] "Clear Creek Elementary"
## [235] "Trinidad Union Elementary"
## [236] "Guerneville Elementary"
## [237] "San Bruno Park Elementary"
## [238] "Antelope Elementary"
## [239] "Centralia Elementary"
## [240] "Etiwanda Elementary"
## [241] "Wiseburn Elementary"
## [242] "Scotia Union Elementary"
## [243] "Pleasant Valley Joint Union Elementary"
## [244] "Oak Grove Elementary"
## [245] "Pollock Pines Elementary"
## [246] "Castaic Union Elementary"
## [247] "Bishop Union Elementary"
## [248] "Buellton Union Elementary"
## [249] "Chawanakee Jt. Elementary"
## [250] "Yreka Union Elementary"
## [251] "Alexander Valley Union Elementary"
## [252] "Twin Ridges Elementary"
## [253] "Sundale Union Elementary"
## [254] "Three Rivers Union Elementary"
## [255] "Columbia Union Elementary"
## [256] "Westside Union Elementary"
## [257] "Ballico-Cressey Elementary"
## [258] "Millbrae Elementary"
## [259] "Evergreen Elementary"
## [260] "Harmony Union Elementary"
## [261] "Panama Buena Vista Union Elementary"
## [262] "Laguna Salada Union Elementary"
## [263] "Sonora Elementary"
## [264] "Roseville City Elementary"
## [265] "Gratton Elementary"
## [266] "Susanville Elementary"
## [267] "Bella Vista Elementary"
## [268] "Columbine Elementary"
## [269] "Hughes-Elizabeth Lakes Union Elementary"
## [270] "Sulphur Springs Union Elementary"
## [271] "Forestville Union Elementary"
## [272] "Rosedale Union Elementary"
## [273] "Columbia Elementary"
## [274] "Colfax Elementary"
## [275] "Mt. Shasta Union Elementary"
## [276] "Piner-Olivet Union Elementary"
## [277] "Bass Lake Joint Elementary"
## [278] "Cutten Elementary"
## [279] "Placerville Union Elementary"
## [280] "Wright Elementary"
## [281] "Evergreen Union Elementary"
## [282] "Old Adobe Union Elementary"
## [283] "Wilmar Union Elementary"
## [284] "Ackerman Elementary"
## [285] "Santa Cruz City Elementary"
## [286] "Arcata Elementary"
## [287] "Alta Loma Elementary"
## [288] "Foresthill Union Elementary"
## [289] "Mother Lode Union Elementary"
## [290] "Lake Elementary"
## [291] "San Mateo-Foster City Elementary"
## [292] "Goleta Union Elementary"
## [293] "Helendale Elementary"
## [294] "Petaluma City Elementary"
## [295] "Sunnyvale Elementary"
## [296] "College Elementary"
## [297] "La Mesa-Spring Valley"
## [298] "Huntington Beach City Elementary"
## [299] "Solvang Elementary"
## [300] "Soquel Elementary"
## [301] "Capay Joint Union Elementary"
## [302] "Gravenstein Union Elementary"
## [303] "Pleasant Valley Elementary"
## [304] "Santee Elementary"
## [305] "Johnstonville Elementary"
## [306] "Curtis Creek Elementary"
## [307] "Fort Jones Union Elementary"
## [308] "Mark West Union Elementary"
## [309] "Alpine Union Elementary"
## [310] "Sebastopol Union Elementary"
## [311] "Freshwater Elementary"
## [312] "Norris Elementary"
## [313] "Springville Union Elementary"
## [314] "Moreland Elementary"
## [315] "Maple Elementary"
## [316] "Kings River-Hardwick Union Elementary"
## [317] "Julian Union Elementary"
## [318] "Cardiff Elementary"
## [319] "Saucelito Elementary"
## [320] "Bonsall Union Elementary"
## [321] "Cypress Elementary"
## [322] "Lowell Joint Elementary"
## [323] "Newhall Elementary"
## [324] "Lagunitas Elementary"
## [325] "Cambrian Elementary"
## [326] "Richfield Elementary"
## [327] "Fieldbrook Elementary"
## [328] "Dehesa Elementary"
## [329] "Cottonwood Union Elementary"
## [330] "Fruitvale Elementary"
## [331] "Union Elementary"
## [332] "Fountain Valley Elementary"
## [333] "Gold Oak Union Elementary"
## [334] "Buckeye Union Elementary"
## [335] "Rocklin Unified"
## [336] "Gold Trail Union Elementary"
## [337] "Hydesville Elementary"
## [338] "Saugus Union Elementary"
## [339] "Loomis Union Elementary"
## [340] "Placer Hills Union Elementary"
## [341] "Dunham Elementary"
## [342] "San Carlos Elementary"
## [343] "Ready Springs Union Elementary"
## [344] "Coarsegold Union Elementary"
## [345] "Cayucos Elementary"
## [346] "Richmond Elementary"
## [347] "Clay Joint Elementary"
## [348] "Waugh Elementary"
## [349] "Two Rock Union Elementary"
## [350] "Belmont-Redwood Shores Elementary"
## [351] "Rescue Union Elementary"
## [352] "Alta-Dutch Flat Union Elementary"
## [353] "San Pasqual Union Elementary"
## [354] "Latrobe Elementary"
## [355] "Union Hill Elementary"
## [356] "Twin Hills Union Elementary"
## [357] "Douglas City Elementary"
## [358] "Pleasant Ridge Union Elementary"
## [359] "Newcastle Elementary"
## [360] "Mesa Union Elementary"
## [361] "Weaverville Elementary"
## [362] "North Cow Creek Elementary"
## [363] "Nevada City Elementary"
## [364] "Jacoby Creek Elementary"
## [365] "Fort Ross Elementary"
## [366] "Encinitas Union Elementary"
## [367] "Dixie Elementary"
## [368] "Lakeside Joint Elementary"
## [369] "Hermosa Beach City Elementary"
## [370] "Rincon Valley Union Elementary"
## [371] "Washington Union Elementary"
## [372] "Bennett Valley Union Elementary"
## [373] "Loma Prieta Joint Union Elemen"
## [374] "Kenwood Elementary"
## [375] "Knights Ferry Elementary"
## [376] "Kentfield Elementary"
## [377] "Ballard Elementary"
## [378] "Oak Grove Union Elementary"
## [379] "Ross Valley Elementary"
## [380] "Mountain Elementary"
## [381] "Burlingame Elementary"
## [382] "Grant Elementary"
## [383] "Happy Valley Elementary"
## [384] "Bonny Doon Union Elementary"
## [385] "Walnut Creek Elementary"
## [386] "Hope Elementary"
## [387] "Larkspur Elementary"
## [388] "Cupertino Union Elementary"
## [389] "Pacific Elementary"
## [390] "Los Gatos Union Elementary"
## [391] "Montecito Union Elementary"
## [392] "Solana Beach Elementary"
## [393] "Menlo Park City Elementary"
## [394] "Reed Union Elementary"
## [395] "Mill Valley Elementary"
## [396] "Lafayette Elementary"
## [397] "Del Mar Union Elementary"
## [398] "Woodside Elementary"
## [399] "Moraga Elementary"
## [400] "Orinda Union Elementary"
## [401] "Hillsborough City Elementary"
## [402] "Cold Spring Elementary"
## [403] "Portola Valley Elementary"
## [404] "Saratoga Union Elementary"
## [405] "Las Lomitas Elementary"
## [406] "Los Altos Elementary"
## [407] "Somis Union Elementary"
## [408] "Plumas Elementary"
## [409] "Wheatland Elementary"
school_count <- unique(Students_score_csv$school)
paste("There are", length(school_count), "schools")
## [1] "There are 409 schools"
School_subset <- Students_score_csv[1:10, 11:14]
School_subset
## # A tibble: 10 x 4
## expenditure income english read
## <dbl> <dbl> <dbl> <dbl>
## 1 6385. 22.7 0 692.
## 2 5099. 9.82 4.58 660.
## 3 5502. 8.98 30.0 636.
## 4 7102. 8.98 0 652.
## 5 5236. 9.08 13.9 642.
## 6 5580. 10.4 12.4 606.
## 7 5253. 6.58 68.7 604.
## 8 4566. 8.17 47.0 606.
## 9 5356. 7.39 30.1 609.
## 10 5036. 11.6 40.3 612.
head(School_subset)
## # A tibble: 6 x 4
## expenditure income english read
## <dbl> <dbl> <dbl> <dbl>
## 1 6385. 22.7 0 692.
## 2 5099. 9.82 4.58 660.
## 3 5502. 8.98 30.0 636.
## 4 7102. 8.98 0 652.
## 5 5236. 9.08 13.9 642.
## 6 5580. 10.4 12.4 606.
colnames(School_subset)[colnames(School_subset) == 'english'] <- 'Average english score'
colnames(School_subset)[colnames(School_subset) == 'read'] <- 'Average read score'
head(School_subset)
## # A tibble: 6 x 4
## expenditure income `Average english score` `Average read score`
## <dbl> <dbl> <dbl> <dbl>
## 1 6385. 22.7 0 692.
## 2 5099. 9.82 4.58 660.
## 3 5502. 8.98 30.0 636.
## 4 7102. 8.98 0 652.
## 5 5236. 9.08 13.9 642.
## 6 5580. 10.4 12.4 606.
summarize(School_subset, mean(income), median(expenditure))
## # A tibble: 1 x 2
## `mean(income)` `median(expenditure)`
## <dbl> <dbl>
## 1 10.4 5304.
summarize(Students_score_csv, mean(income), median(expenditure))
## # A tibble: 1 x 2
## `mean(income)` `median(expenditure)`
## <dbl> <dbl>
## 1 15.3 5215.
head(School_subset)
## # A tibble: 6 x 4
## expenditure income `Average english score` `Average read score`
## <dbl> <dbl> <dbl> <dbl>
## 1 6385. 22.7 0 692.
## 2 5099. 9.82 4.58 660.
## 3 5502. 8.98 30.0 636.
## 4 7102. 8.98 0 652.
## 5 5236. 9.08 13.9 642.
## 6 5580. 10.4 12.4 606.
Students_score_csv
## # A tibble: 420 x 15
## X1 district school county grades students teachers calworks lunch
## <dbl> <dbl> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl>
## 1 1 75119 Sunol Glen U~ Alameda KK-08 195 10.9 0.510 2.04
## 2 2 61499 Manzanita El~ Butte KK-08 240 11.1 15.4 47.9
## 3 3 61549 Thermalito U~ Butte KK-08 1550 82.9 55.0 76.3
## 4 4 61457 Golden Feath~ Butte KK-08 243 14 36.5 77.0
## 5 5 61523 Palermo Unio~ Butte KK-08 1335 71.5 33.1 78.4
## 6 6 62042 Burrel Union~ Fresno KK-08 137 6.40 12.3 87.0
## 7 7 68536 Holt Union E~ San Jo~ KK-08 195 10 12.9 94.6
## 8 8 63834 Vineland Ele~ Kern KK-08 888 42.5 18.8 100
## 9 9 62331 Orange Cente~ Fresno KK-08 379 19 32.2 93.1
## 10 10 67306 Del Paso Hei~ Sacram~ KK-06 2247 108 79.0 87.3
## # ... with 410 more rows, and 6 more variables: computer <dbl>,
## # expenditure <dbl>, income <dbl>, english <dbl>, read <dbl>, math <dbl>
data1[data1 == "A"] <- "XXX"
## Error in data1[data1 == "A"] <- "XXX": object 'data1' not found
Students_score <- Students_score_csv
print(Students_score)
## # A tibble: 420 x 15
## X1 district school county grades students teachers calworks lunch
## <dbl> <dbl> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl>
## 1 1 75119 Sunol Glen U~ Alameda KK-08 195 10.9 0.510 2.04
## 2 2 61499 Manzanita El~ Butte KK-08 240 11.1 15.4 47.9
## 3 3 61549 Thermalito U~ Butte KK-08 1550 82.9 55.0 76.3
## 4 4 61457 Golden Feath~ Butte KK-08 243 14 36.5 77.0
## 5 5 61523 Palermo Unio~ Butte KK-08 1335 71.5 33.1 78.4
## 6 6 62042 Burrel Union~ Fresno KK-08 137 6.40 12.3 87.0
## 7 7 68536 Holt Union E~ San Jo~ KK-08 195 10 12.9 94.6
## 8 8 63834 Vineland Ele~ Kern KK-08 888 42.5 18.8 100
## 9 9 62331 Orange Cente~ Fresno KK-08 379 19 32.2 93.1
## 10 10 67306 Del Paso Hei~ Sacram~ KK-06 2247 108 79.0 87.3
## # ... with 410 more rows, and 6 more variables: computer <dbl>,
## # expenditure <dbl>, income <dbl>, english <dbl>, read <dbl>, math <dbl>
Students_score[Students_score=="Alameda"] <- "A"
print(Students_score)
## # A tibble: 420 x 15
## X1 district school county grades students teachers calworks lunch
## <dbl> <dbl> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl>
## 1 1 75119 Sunol Glen U~ A KK-08 195 10.9 0.510 2.04
## 2 2 61499 Manzanita El~ Butte KK-08 240 11.1 15.4 47.9
## 3 3 61549 Thermalito U~ Butte KK-08 1550 82.9 55.0 76.3
## 4 4 61457 Golden Feath~ Butte KK-08 243 14 36.5 77.0
## 5 5 61523 Palermo Unio~ Butte KK-08 1335 71.5 33.1 78.4
## 6 6 62042 Burrel Union~ Fresno KK-08 137 6.40 12.3 87.0
## 7 7 68536 Holt Union E~ San Jo~ KK-08 195 10 12.9 94.6
## 8 8 63834 Vineland Ele~ Kern KK-08 888 42.5 18.8 100
## 9 9 62331 Orange Cente~ Fresno KK-08 379 19 32.2 93.1
## 10 10 67306 Del Paso Hei~ Sacram~ KK-06 2247 108 79.0 87.3
## # ... with 410 more rows, and 6 more variables: computer <dbl>,
## # expenditure <dbl>, income <dbl>, english <dbl>, read <dbl>, math <dbl>
Students_score[Students_score=="Butte"] <- "B"
print(Students_score)
## # A tibble: 420 x 15
## X1 district school county grades students teachers calworks lunch
## <dbl> <dbl> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl>
## 1 1 75119 Sunol Glen U~ A KK-08 195 10.9 0.510 2.04
## 2 2 61499 Manzanita El~ B KK-08 240 11.1 15.4 47.9
## 3 3 61549 Thermalito U~ B KK-08 1550 82.9 55.0 76.3
## 4 4 61457 Golden Feath~ B KK-08 243 14 36.5 77.0
## 5 5 61523 Palermo Unio~ B KK-08 1335 71.5 33.1 78.4
## 6 6 62042 Burrel Union~ Fresno KK-08 137 6.40 12.3 87.0
## 7 7 68536 Holt Union E~ San Jo~ KK-08 195 10 12.9 94.6
## 8 8 63834 Vineland Ele~ Kern KK-08 888 42.5 18.8 100
## 9 9 62331 Orange Cente~ Fresno KK-08 379 19 32.2 93.1
## 10 10 67306 Del Paso Hei~ Sacram~ KK-06 2247 108 79.0 87.3
## # ... with 410 more rows, and 6 more variables: computer <dbl>,
## # expenditure <dbl>, income <dbl>, english <dbl>, read <dbl>, math <dbl>
Students_score[Students_score=="Fresno"] <- "F"
print(Students_score)
## # A tibble: 420 x 15
## X1 district school county grades students teachers calworks lunch
## <dbl> <dbl> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl>
## 1 1 75119 Sunol Glen U~ A KK-08 195 10.9 0.510 2.04
## 2 2 61499 Manzanita El~ B KK-08 240 11.1 15.4 47.9
## 3 3 61549 Thermalito U~ B KK-08 1550 82.9 55.0 76.3
## 4 4 61457 Golden Feath~ B KK-08 243 14 36.5 77.0
## 5 5 61523 Palermo Unio~ B KK-08 1335 71.5 33.1 78.4
## 6 6 62042 Burrel Union~ F KK-08 137 6.40 12.3 87.0
## 7 7 68536 Holt Union E~ San Jo~ KK-08 195 10 12.9 94.6
## 8 8 63834 Vineland Ele~ Kern KK-08 888 42.5 18.8 100
## 9 9 62331 Orange Cente~ F KK-08 379 19 32.2 93.1
## 10 10 67306 Del Paso Hei~ Sacram~ KK-06 2247 108 79.0 87.3
## # ... with 410 more rows, and 6 more variables: computer <dbl>,
## # expenditure <dbl>, income <dbl>, english <dbl>, read <dbl>, math <dbl>
To see the results of change value
slice(Students_score, 1:9)
## # A tibble: 9 x 15
## X1 district school county grades students teachers calworks lunch computer
## <dbl> <dbl> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 1 75119 Sunol~ A KK-08 195 10.9 0.510 2.04 67
## 2 2 61499 Manza~ B KK-08 240 11.1 15.4 47.9 101
## 3 3 61549 Therm~ B KK-08 1550 82.9 55.0 76.3 169
## 4 4 61457 Golde~ B KK-08 243 14 36.5 77.0 85
## 5 5 61523 Paler~ B KK-08 1335 71.5 33.1 78.4 171
## 6 6 62042 Burre~ F KK-08 137 6.40 12.3 87.0 25
## 7 7 68536 Holt ~ San J~ KK-08 195 10 12.9 94.6 28
## 8 8 63834 Vinel~ Kern KK-08 888 42.5 18.8 100 66
## 9 9 62331 Orang~ F KK-08 379 19 32.2 93.1 35
## # ... with 5 more variables: expenditure <dbl>, income <dbl>, english <dbl>,
## # read <dbl>, math <dbl>
x <- read_csv("https://raw.githubusercontent.com/uzmabb182/CUNY-SPS-Assignments/main/MQari_R_Bridge_Week2/CASchools.csv")
## Warning: Missing column names filled in: 'X1' [1]
##
## -- Column specification --------------------------------------------------------
## cols(
## X1 = col_double(),
## district = col_double(),
## school = col_character(),
## county = col_character(),
## grades = col_character(),
## students = col_double(),
## teachers = col_double(),
## calworks = col_double(),
## lunch = col_double(),
## computer = col_double(),
## expenditure = col_double(),
## income = col_double(),
## english = col_double(),
## read = col_double(),
## math = col_double()
## )
head(x)
## # A tibble: 6 x 15
## X1 district school county grades students teachers calworks lunch computer
## <dbl> <dbl> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 1 75119 Sunol ~ Alame~ KK-08 195 10.9 0.510 2.04 67
## 2 2 61499 Manzan~ Butte KK-08 240 11.1 15.4 47.9 101
## 3 3 61549 Therma~ Butte KK-08 1550 82.9 55.0 76.3 169
## 4 4 61457 Golden~ Butte KK-08 243 14 36.5 77.0 85
## 5 5 61523 Palerm~ Butte KK-08 1335 71.5 33.1 78.4 171
## 6 6 62042 Burrel~ Fresno KK-08 137 6.40 12.3 87.0 25
## # ... with 5 more variables: expenditure <dbl>, income <dbl>, english <dbl>,
## # read <dbl>, math <dbl>
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:
summary(cars)
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
You can also embed plots, for example:
Note that the echo = FALSE
parameter was added to the code chunk to prevent printing of the R code that generated the plot.