# NOT RUN {
# The built in nasa dataset records meterological data (temperature,
# cloud cover, ozone etc) for a 4d spatio-temporal dataset (lat, long,
# month and year)
nasa
head(as.data.frame(nasa))
titanic <- as.tbl_cube(Titanic)
head(as.data.frame(titanic))
admit <- as.tbl_cube(UCBAdmissions)
head(as.data.frame(admit))
as.tbl_cube(esoph, dim_names = 1:3)
# Some manipulation examples with the NASA dataset --------------------------
# select() operates only on measures: it doesn't affect dimensions in any way
select(nasa, cloudhigh:cloudmid)
select(nasa, matches("temp"))
# filter() operates only on dimensions
filter(nasa, lat > 0, year == 2000)
# Each component can only refer to one dimensions, ensuring that you always
# create a rectangular subset
# }
# NOT RUN {
filter(nasa, lat > long)
# }
# NOT RUN {
# Arrange is meaningless for tbl_cubes
by_loc <- group_by(nasa, lat, long)
summarise(by_loc, pressure = max(pressure), temp = mean(temperature))
# }
Run the code above in your browser using DataLab