For our data analysis below, we will use the crime dataset that appears in Stati
ID: 3722273 • Letter: F
Question
For our data analysis below, we will use the crime dataset that appears in Statistical Methods for Social Sciences, Third Edition by Alan Agresti and Barbara Finlay (Prentice Hall, 1997). The variables are state id (sid) state name(state), violent crimes per 100,000 people(crime),murders per 1,000,000(murder), the percent of the population living in metropolitan areas(petmetro) the percent of the population that is white(petwhite) percent of population with a high school education or above(pcths), percent of population living under poverty line (poverty) and percent of population that are single parents(single).It has 5lobservations. Assuming that your file is saved as crime.csv in a data folder on your C drive. 1) Write the R statement to load the file and store it in a variable cdata. 2) Write the R statement that will give you the statistics about your dataset After you entered that statement, assume that you get this table: sid Min.: 1.0 1st Qu. : 13.5 crime Min.:82 murder state Length: 51 Min.: 1.60 1st Qu.:3.90 Class:character 1st Qu.: 326Explanation / Answer
cdata < - read.csv(file = 'data/crime.csv' , header = TRUE)
This statement will read the file stored in data folder named as crime.csv and store it in cdata.
By settin header argumennt to true, thr fridt row of values in the .csv is set as geader information (column names).
summary( cdata )
This statement provides summary statistics of the cdata.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.