Concept explainers
The “Boston” data set is a built-in dataset in the “MASS” library of R. The “Boston” data set contains
information about the housing values in suburbs of Boston city. First, load the “Boston” data set into
your R workspace. In Rstudio, you can click on the “Packages” tab and then on the checkbox next to
MASS. Without Rstudio, type the following command in R console:
data(Boston,package=”MASS”)
To know more information about this dataset, type the following command in R console:
?Boston
Then, answer the following questions based on the dataset, using R/Rstudio:
a. How many rows and columns in this data set?
b. How many of the suburbs in this dataset bound the Charles River? (Hint: Variable chas is a
dummy variable; chas=1 means tract bounds river, 0 otherwise) You can obtain a list of suburbs
bound the Charles River with the command:
subset(Boston,chas==1)
You can obtain a count of the suburbs bound the Charles River by
sum(Boston$chas==1)
c. What is the probability that you randomly select a suburb that bounds the Charles River?
Trending nowThis is a popular solution!
Step by stepSolved in 5 steps with 1 images
- It is possible to transmit an array of attribute values to the console screen buffer's consecutive cells by using which Win32 method?arrow_forwardChanging the displayBalance command from sac.getBalance () to sac.balance, what would happen if you remove the getBalance member function? Why? Changes to the program must be made in order for it to work with these new features.arrow_forwardInfoFrame Data Storage Process Data File A0 7 B0 0 C0 18 D0 11 E0 16 F0 10 G0 11 H0 8 I0 13 J0 11 A10 19 B10 9 C10 3 D10 4 E10 7 ... F10 3 G10 19 H10 18 I10 15 J10 13 Testing Create a main method in your script. Utilize the data file provided to create the InfoFrame object. Write the code shown below in the main method EXACTLY as shown. Call the main method Substitute your filepath herearrow_forward
- wrong commandsarrow_forwardIn the langauage R: Which of the following statements is NOT correct about themes in R? Select one: Once set, a theme applies to all subsequent plots and remains active until it is replaced by a different theme The theme_set() function takes the name of a theme as an argument If we want to change the overall look of the figure all at once, we can use ggplot’s theme engine The theme_minimal() function can make ggplot output look like it has been featured in the Wall Street Journalarrow_forwardDesign a Client class that interfaces with your SQLDatabase Server (from the class Server). The Client sends a SQLQuery to the SQLDatabase and receives a Dataframe from the SQLDatabase. Your class should contain the default __dunders__ and potentially introduce some custom __dunders__. classServer.py (Just change if this file has something doesn't run or doesn't fit with new code) import sqlite3import pandas as pdclass Server:def __init__(self, db_name):self.db = sqlite3.connect(db_name)self.cursor = self.db.cursor()def __enter__(self):return selfdef __exit__(self, exc_type, exc_val, exc_tb):self.db.close()def create_table(self, table_schema):self.cursor.execute(table_schema)self.db.commit()def insert_data(self, table_name, data):for i in range(len(data)):keys = ", ".join(data.columns)values = ", ".join([f"'{value}'" if pd.isna(value) else str(value) for value in data.iloc[i]])self.cursor.execute(f"INSERT INTO {table_name} ({keys}) VALUES ({values})")self.db.commit()def…arrow_forward
- Output should be 5. Please help me find my error, and create 5 tests below in a seperate file using the corrected code. Thanks. 1. create a strawberryStand object2. create one or more MenuItem objects and add them to the strawberryStand's menu3. create a dictionary of sales for the day that includes sales of at least one item that isn't in the menu4. try calling enter_sales_for_today(), passing that sales dictionary as the argument5. If an InvalidSalesItem is raised, it should be caught with a try/except that prints an explanatory message for the user (otherwise the function should proceed normally). class MenuItem: def __init__(self, name, wholesale_cost, selling_price): self.name = name self.wholesale_cost = wholesale_cost self.selling_price = selling_price def get_name(self): return self.name def get_wholesale_cost(self): return self.wholesale_cost def get_selling_price(self): return self.selling_price class SalesForDay:…arrow_forwardA Stationery supplier “Adwaat Al Maktabiyah” needs a program to display sales as per regions and add the sales to the file called sales.txt. The files Personal Details.txt and Sales.txt have been provided. You may download and use them in your program. They are as shown below: PersonalDetails.txt Id First name Last Name Region E111 Alvin Jones East C121 Blake Kivell Central C253 Edda Jardine Central Sales.txt Rep_Id OrderDate Region Item Units UnitCost E111 1/6/2020 East Pencil 95 1.99 C121 1/23/2020 Central Binder 50 19.99 C253 2/9/2020 Central Pencil 36 4.99 Note: - Use structures in the coding and declare structure array as public as shown below. The question 7 doesn’t need arrays. Structure personaldetails Dim rid As String ' Employee id Dim fn As String 'First name Dim ln As String 'Last name Dim rn As String ' Region he belongs to End Structure Structure Regionalsales Dim id As String 'employee id Dim od As Date 'Order Date Dim region As String…arrow_forwardplease use java to answer the following questionarrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education