diff --git a/NEWS.md b/NEWS.md index ff149b232..cfb5949e3 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,8 @@ # tidyr 0.5.1.9000 +* Renamed `table4` and `table5` to `table4a` and `table4b` to make their + connection more clear. + * `full_seq()` works correctly for dates and date/times. # tidyr 0.5.1 diff --git a/R/data.R b/R/data.R index 4576ff37e..afecfa732 100644 --- a/R/data.R +++ b/R/data.R @@ -18,22 +18,35 @@ "who" -#' tabular layouts +#' Example tabular representations #' #' Data sets that demonstrate multiple ways to layout the same tabular data. #' -#' \code{table1}, \code{table2}, \code{table3}, \code{table4}, \code{table5}, and \code{table6} all display the number of TB cases documented by the World Health Organization in Afghanistan, Brazil, and China between 1999 and 2000. The data contains values associated with four variables (country, year, cases, and population), but each table organizes the values in a different layout. +#' \code{table1}, \code{table2}, \code{table3}, \code{table4a}, \code{table4b}, and \code{table5} all display the number of TB cases documented by the World Health Organization in Afghanistan, Brazil, and China between 1999 and 2000. The data contains values associated with four variables (country, year, cases, and population), but each table organizes the values in a different layout. #' #' The data is a subset of the data contained in the World Health #' Organization Global Tuberculosis Report #' -#' #' @source \url{http://www.who.int/tb/country/data/download/en/} -#' -#' @aliases table2 table3 table4 table5 table6 -#' "table1" +#' @rdname table1 +"table2" + +#' @rdname table1 +"table3" + +#' @rdname table1 +"table4a" + +#' @rdname table1 +"table4b" + +#' @rdname table1 +"table5" + + + #' Population data #' #' Populations of 219 countries for 1995-2013. diff --git a/data-raw/table4.csv b/data-raw/table4a.csv similarity index 100% rename from data-raw/table4.csv rename to data-raw/table4a.csv diff --git a/data-raw/table5.csv b/data-raw/table4b.csv similarity index 100% rename from data-raw/table5.csv rename to data-raw/table4b.csv diff --git a/data-raw/tables.R b/data-raw/tables.R index 55064dabb..1221bdfed 100644 --- a/data-raw/tables.R +++ b/data-raw/tables.R @@ -26,30 +26,30 @@ table3 <- table1 %>% unite("rate", cases, population, sep = "/") -table4 <- +table4a <- table1 %>% select(country, year, cases) %>% spread(year, cases) -table5 <- +table4b <- table1 %>% select(country, year, population) %>% spread(year, population) -table6 <- +table5 <- table3 %>% separate(year, into = c("century", "year"), sep = 2) write_csv(table1, "data-raw/table1.csv") write_csv(table2, "data-raw/table2.csv") write_csv(table3, "data-raw/table3.csv") -write_csv(table4, "data-raw/table4.csv") -write_csv(table5, "data-raw/table5.csv") -write_csv(table6, "data-raw/table6.csv") +write_csv(table4a, "data-raw/table4a.csv") +write_csv(table4b, "data-raw/table4b.csv") +write_csv(table5, "data-raw/table6.csv") save(table1, file = "data/table1.rdata") save(table2, file = "data/table2.rdata") save(table3, file = "data/table3.rdata") -save(table4, file = "data/table4.rdata") +save(table4a, file = "data/table4a.rdata") +save(table4b, file = "data/table4b.rdata") save(table5, file = "data/table5.rdata") -save(table6, file = "data/table6.rdata") diff --git a/data/table3.rdata b/data/table3.rdata index 23b25e0be..c1190ea15 100644 Binary files a/data/table3.rdata and b/data/table3.rdata differ diff --git a/data/table4.rdata b/data/table4.rdata deleted file mode 100644 index f8886ec5c..000000000 Binary files a/data/table4.rdata and /dev/null differ diff --git a/data/table4a.rdata b/data/table4a.rdata new file mode 100644 index 000000000..c1cfbd9b4 Binary files /dev/null and b/data/table4a.rdata differ diff --git a/data/table4b.rdata b/data/table4b.rdata new file mode 100644 index 000000000..d6c6251ae Binary files /dev/null and b/data/table4b.rdata differ diff --git a/data/table5.rdata b/data/table5.rdata index b37a399b9..ca55e4f1c 100644 Binary files a/data/table5.rdata and b/data/table5.rdata differ diff --git a/data/table6.rdata b/data/table6.rdata deleted file mode 100644 index d62ca2979..000000000 Binary files a/data/table6.rdata and /dev/null differ diff --git a/man/table1.Rd b/man/table1.Rd index 8c6a1b03f..bc1917df7 100644 --- a/man/table1.Rd +++ b/man/table1.Rd @@ -5,22 +5,32 @@ \alias{table1} \alias{table2} \alias{table3} -\alias{table4} +\alias{table4a} +\alias{table4b} \alias{table5} -\alias{table6} -\title{tabular layouts} +\title{Example tabular representations} \format{An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 6 rows and 4 columns.} \source{ \url{http://www.who.int/tb/country/data/download/en/} } \usage{ table1 + +table2 + +table3 + +table4a + +table4b + +table5 } \description{ Data sets that demonstrate multiple ways to layout the same tabular data. } \details{ -\code{table1}, \code{table2}, \code{table3}, \code{table4}, \code{table5}, and \code{table6} all display the number of TB cases documented by the World Health Organization in Afghanistan, Brazil, and China between 1999 and 2000. The data contains values associated with four variables (country, year, cases, and population), but each table organizes the values in a different layout. +\code{table1}, \code{table2}, \code{table3}, \code{table4a}, \code{table4b}, and \code{table5} all display the number of TB cases documented by the World Health Organization in Afghanistan, Brazil, and China between 1999 and 2000. The data contains values associated with four variables (country, year, cases, and population), but each table organizes the values in a different layout. The data is a subset of the data contained in the World Health Organization Global Tuberculosis Report