Reputation: 1
With this script:
# I) Go to the working directory
setwd("/home/***/Desktop/***")
# II) Verify the current working directory
print(getwd())
# III) Load te nedded package
require("csv")
# IV) Read the desired file
read.csv(file="serious-injury-outcome-indicators-2000-18-csv.csv", header=TRUE, sep=",")
I tried to read this file: Serious injury outcome indicators: 2000–18 – CSV
But the output in the consol is not well, Can someone try it and tell me if he encoutred the same problem. Thanks
Upvotes: 0
Views: 46
Reputation: 11056
You can read the file directly from the website:
dta <- url("https://www.stats.govt.nz/assets/Uploads/Serious-injury-outcome-indicators/Serious-injury-outcome-indicators-200018/Download-data/serious-injury-outcome-indicators-2000-18-csv.csv")
injury <- read.csv(dta, header=TRUE)
str(injury)
# 'data.frame': 2460 obs. of 13 variables:
# $ Series_reference: chr "W_A11" "W_A11" "W_A11" "W_A11" ...
# $ Period : chr "2000-02" "2001-03" "2002-04" "2003-05" ...
# $ Type : chr "Moving average" "Moving average" "Moving average" "Moving average" ...
# $ Data_value : num 59.7 60 59 59 61.3 ...
# $ Lower_CI : num 50.9 51.2 50.3 50.3 52.5 ...
# $ Upper_CI : num 68.4 68.8 67.7 67.7 70.2 ...
# $ Units : chr "Injuries" "Injuries" "Injuries" "Injuries" ...
# $ Indicator : chr "Number" "Number" "Number" "Number" ...
# $ Cause : chr "Assault" "Assault" "Assault" "Assault" ...
# $ Validation : chr "Validated" "Validated" "Validated" "Validated" ...
# $ Population : chr "Whole pop" "Whole pop" "Whole pop" "Whole pop" ...
# $ Age : chr "All ages" "All ages" "All ages" "All ages" ...
# $ Severity : chr "Fatal" "Fatal" "Fatal" "Fatal" ...
Upvotes: 2