Читать книгу The Big R-Book - Philippe J. S. De Brouwer - Страница 172
4.8.1 CSV Files
ОглавлениеFor the example we have first downloaded the CSV file with currency exchange rates from http://www.ecb.europa.eu/stats/policy_and_exchange_rates/euro_reference:exchange_rates/html/index.en.html
.4 This file is now on a local hard-drive and will be read in from there.5
CSV
import – csv
# To read a CSV-file it needs to be in the current directory # or we need to supply the full path. getwd() # show actual working directory setwd(“./data”) # change working directory data <- read.csv(“eurofxref-hist.csv”) is.data.frame(data) ncol(data) nrow(data) head(data) hist(data$CAD, col = ‘khaki3’) plot(data$USD, data$CAD, col = ‘red’)