library(readr)
url <- 'http://richardtwatson.com/data/manheim.txt'
t <- read_delim(url,delim=',')
t %>%
group_by(model) %>%
summarize(frequency = n())
library(readr)
library(sqldf)
url <- 'http://richardtwatson.com/data/manheim.txt' t <- read_delim(url,delim=',')
t %>%
group_by(model) %>%
summarize(mean = mean(price))
max(electricityprices$cost)
mean(electricityprices$cost)
library(readr)
library(sqldf)
url <- 'http://people.terry.uga.edu/rwatson/data/wealth.csv'
t <- read_delim(url,delim = ',')
ts <- sqldf('select * from t order by `GDP per capita`;')
library(readr)
library(sqldf)
url <- 'http://people.terry.uga.edu/rwatson/data/wealth.csv'
sqldf('Select `GDP per capita`/(select avg(`GDP per capita`) from t) as "US ratio" from t where Country = "United States";')
# download the table as csv file and read the file using RStudio's Import Dataset
library(sqldf)
sqldf('Select ST, count(*) from banklist group by ST')
library(sqldf)
options(sqldf.driver = "SQLite") # to avoid a conflict with RMySQL
library(lubridate)
# banklist$closeYear <- year(strptime(banklist$Closing.Date, "%d-%b-%y"))
temp <- strptime(banklist$Closing.Date, "%d-%b-%y")
banklist$closeYear <- year(temp)
sqldf('Select closeYear, count(*) from banklist group by closeYear;')
# Read the file using RStudio's Import Datase # set the column names as R puts an X in front of the year.
colnames(broccoli) <- c('state',1974,1978,1982,1987,1992,1997,2002,2007) library(reshape)
m <- melt(broccoli,id='state')
colnames(m) <- c('state','year','acres')
library(sqldf)
sqldf('select year, sum(hectares) as "Total area" from m group by year;')
This page is part of the promotional and support
material for Data Management (open edition) by Richard T. Watson For questions and comments please contact the author |