--- title: "Assignment One" author: "Professor Lepore" date: "9/08/2022" output: html_document --- # *Task(s):* - ***[1]*** Run the chunks labeled with help_screen, read the help tab, refer to our...

1 answer below »


hi i have a beginner level assignment, im attaching the word document here and i also have the text version. let me know if you need any other information.



--- title: "Assignment One" author: "Professor Lepore" date: "9/08/2022" output: html_document --- # *Task(s):* - ***[1]*** Run the chunks labeled with help_screen, read the help tab, refer to our week one lesson lessons, look at the resources in the syllabus, and then in your own words write a summary of what this function does. [5 Points] - ***[2]*** Scroll down to the 'Examples' section of the help tab to see the examples provided. Then create your own example for how to use these functions. Make sure to 'comment' # on what's happening in your example. [5 Points] - ***[3]*** When turning in your assignment please attach both this RMD file and the html knitted file. I've already set the specific chunk settings for this assignment. Also be sure to rename both as assignment_one_first_lastname. - ***[4]*** Extra point (1): Make your HTML document aesthetically pleasing by using RMARKDOWN syntax: https://www.rstudio.com/wp-content/uploads/2015/02/rmarkdown-cheatsheet.pdf - Partial credit points are possible with tasks one and two. # AS CHARACTER ```{r as_character_help_screen, eval=FALSE, include=TRUE} ?"as.character" ``` ## Summary of function as.character() Your summary goes here, delete this line and type out your summary in the white space. ```{r example_of_as_character} # Example: ``` # AS LOGICAL ```{r as_logical_help_screen, eval=FALSE, include=TRUE} ?"as.logical" ``` ## Summary of function as.logical() Your summary goes here, delete this line and type out your summary in the white space. ```{r example_of_as_logical} # Example: ``` # AS NUMERIC ```{r as_numeric_help_screen, eval=FALSE, include=TRUE} ?"as.numeric" ``` ## Summary of function as.numeric() Your summary goes here, delete this line and type out your summary in the white space. ```{r example_of_as_numeric} # Example: ``` # c() ```{r c_help_screen, eval=FALSE, include=TRUE} ?"c" ``` ## Summary of function c() Your summary goes here, delete this line and type out your summary in the white space. ```{r example_of_c} # Example: ``` # list() ```{r list_help_screen, eval=FALSE, include=TRUE} ?"list" ``` ## Summary of function list() Your summary goes here, delete this line and type out your summary in the white space. ```{r example_of_list} # Example: ``` --- title: "Assignment Two" author: "Professor Lepore" date: "9/15/2022" output: html_document --- # *Task(s):* - ***[1]*** Select and rename the columns/variables [2 Points] - ***[2]*** Mutate the data frame [5 Points] - ***[3]*** Count and average, describe the results [3 Points] - ***[4]*** When turning in your assignment please attach both this RMD file and the html knitted file. I've already set the specific chunk settings for this assignment. Also be sure to rename both as assignment_two_first_lastname. ### Extra points (3) - (1): Make your HTML document aesthetically pleasing by using RMARKDOWN syntax: https://www.rstudio.com/wp-content/uploads/2015/02/rmarkdown-cheatsheet.pdf - (2): Describe the logic behind your mutates and replacements Partial credit points are possible with tasks two and three. # R [PART ONE] ```{r setup, include = TRUE} # Chunk Options ---------------------------------------------------------------- knitr::opts_chunk$set( echo = TRUE ) # R PACKAGES ------------------------------------------------------------------- if (!require('tidyverse')) install.packages('tidyverse', repos = "http://cran.us.r-project.org"); library('tidyverse') if (!require('reticulate')) install.packages('reticulate', repos = "http://cran.us.r-project.org"); library('reticulate') ``` ```{r data_import} homebase_data <- jsonlite::fromjson("https://data.cityofnewyork.us/resource/ntcm-2w4k.json?$limit="200")" ```="" ```{r="" data_inspection}="" head(homebase_data)="" tail(homebase_data)="" summary(homebase_data)="" colnames(homebase_data)="" ```="" ```{r="" data_cleaning}="" #="" create="" the="" object="" homebase_data_clean="" and="" make="" sure="" to:="" #="" 1.="" select="" the="" following="" columns/variables:="" #="" (homebase_office,="" service_area_zip_code,="" postcode)="" #="" 2.="" rename:="" service_area_zip_code="" to="" servicing_zipcodes="" and="" #="" postcode="" to="" homebase_location_zipcode="" homebase_data_clean=""><- homebase_data="" ```="" ```{r="" data_cleaning_part_two}="" #="" mutate="" the="" object="" homebase_data_clean="" with="" the="" following:="" #="" 1.="" homebase_office="" capitalized="" #="" 2.="" remove="" the="" i,="" ii,="" and="" iii="" from="" the="" homebase="" office="" names="" #="" hint:="" we="" need="" to="" use="" a="" string="" replacement="" and="" trimming="" white="" space="" #="" 3.="" replace="" the="" servicing_zipcodes="" with="" any="" corrections="" #="" 4.="" find="" the="" number="" of="" servicing_zipcodes="" homebase_data_clean=""><- homebase_data_clean ``` ```{r hints, eval=false} # possible functions for 2: ?"str_replace_all" ?"gsub" ?"trimws" ?"str_trim" ``` ```{r simple_stats} # perform a count by homebase_office # find the mean number of zipcodes per organization # describe the number of homebase offices each organization has and on average # how many zipcodes each organization services. ``` # results: # python [part two] ```{python setup_python} # python packages -------------------------------------------------------------- import json import requests import pandas as pd pd.options.mode.chained_assignment = none # default='warn' ``` ```{python data_import_python} json_link = requests.get('https://data.cityofnewyork.us/resource/ntcm-2w4k.json?$limit=200') json_loaded = json.loads(json_link.text) homebase_data_python = pd.dataframe(json_loaded) ``` ```{python data_inspection_python} homebase_data_python.head(5) homebase_data_python.tail(5) homebase_data_python.dtypes list(homebase_data_python.columns) ``` ```{python data_cleaning_python} # create the object homebase_data_clean and make sure to: # 1. select the following columns/variables: # (homebase_office, service_area_zip_code, postcode) # 2. rename: service_area_zip_code to servicing_zipcodes and # postcode to homebase_location_zipcode ``` ```{python data_cleaning_part_two_python} # mutate the object homebase_data_clean with the following: # 1. homebase_office capitalized # 2. remove the i, ii, and iii from the homebase office names # hint: we need to use a string replacement and trimming white space # 3. replace the servicing_zipcodes with any corrections # 4. find the number of servicing_zipcodes ``` ```{python hints_python, eval = false} # possible functions for 2: str.replace? str.strip? ``` ```{python simple_stats_python} # perform a count by homebase_office # find the mean number of zipcodes per homebase organization ``` homebase_data_clean="" ```="" ```{r="" hints,="" eval="FALSE}" #="" possible="" functions="" for="" 2:="" "str_replace_all"="" "gsub"="" "trimws"="" "str_trim"="" ```="" ```{r="" simple_stats}="" #="" perform="" a="" count="" by="" homebase_office="" #="" find="" the="" mean="" number="" of="" zipcodes="" per="" organization="" #="" describe="" the="" number="" of="" homebase="" offices="" each="" organization="" has="" and="" on="" average="" #="" how="" many="" zipcodes="" each="" organization="" services.="" ```="" #="" results:="" #="" python="" [part="" two]="" ```{python="" setup_python}="" #="" python="" packages="" --------------------------------------------------------------="" import="" json="" import="" requests="" import="" pandas="" as="" pd="" pd.options.mode.chained_assignment="None" #="" default='warn' ```="" ```{python="" data_import_python}="" json_link="requests.get('https://data.cityofnewyork.us/resource/ntcm-2w4k.json?$limit=200')" json_loaded="json.loads(json_link.text)" homebase_data_python="pd.DataFrame(json_loaded)" ```="" ```{python="" data_inspection_python}="" homebase_data_python.head(5)="" homebase_data_python.tail(5)="" homebase_data_python.dtypes="" list(homebase_data_python.columns)="" ```="" ```{python="" data_cleaning_python}="" #="" create="" the="" object="" homebase_data_clean="" and="" make="" sure="" to:="" #="" 1.="" select="" the="" following="" columns/variables:="" #="" (homebase_office,="" service_area_zip_code,="" postcode)="" #="" 2.="" rename:="" service_area_zip_code="" to="" servicing_zipcodes="" and="" #="" postcode="" to="" homebase_location_zipcode="" ```="" ```{python="" data_cleaning_part_two_python}="" #="" mutate="" the="" object="" homebase_data_clean="" with="" the="" following:="" #="" 1.="" homebase_office="" capitalized="" #="" 2.="" remove="" the="" i,="" ii,="" and="" iii="" from="" the="" homebase="" office="" names="" #="" hint:="" we="" need="" to="" use="" a="" string="" replacement="" and="" trimming="" white="" space="" #="" 3.="" replace="" the="" servicing_zipcodes="" with="" any="" corrections="" #="" 4.="" find="" the="" number="" of="" servicing_zipcodes="" ```="" ```{python="" hints_python,="" eval="FALSE}" #="" possible="" functions="" for="" 2:="" str.replace?="" str.strip?="" ```="" ```{python="" simple_stats_python}="" #="" perform="" a="" count="" by="" homebase_office="" #="" find="" the="" mean="" number="" of="" zipcodes="" per="" homebase="" organization="">
Answered 4 days AfterSep 08, 2022

Answer To: --- title: "Assignment One" author: "Professor Lepore" date: "9/08/2022" output: html_document --- #...

Monica answered on Sep 13 2022
64 Votes
Python Result:
homebase_office ... homebase_location_zipcode
0
ARCHNY ... 10472
1 ARCHNY ... 10474
2 ARCHNY ... 10466
3 ARCHNY ... 10467
4 BRONXWORKS ... 10456
5 BRONXWORKS ... 10455
6 HELP ... 10460
7 HELP ... 10457
8 HELP ... 10467
9 HELP ... 10453
10 ...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here