Skip to content

Commit

Permalink
Rename table4 and table5 to make connection more clear
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Jul 25, 2016
1 parent 52aabaf commit 4fb915d
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 18 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
25 changes: 19 additions & 6 deletions R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
File renamed without changes.
File renamed without changes.
16 changes: 8 additions & 8 deletions data-raw/tables.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Binary file modified data/table3.rdata
Binary file not shown.
Binary file removed data/table4.rdata
Binary file not shown.
Binary file added data/table4a.rdata
Binary file not shown.
Binary file added data/table4b.rdata
Binary file not shown.
Binary file modified data/table5.rdata
Binary file not shown.
Binary file removed data/table6.rdata
Binary file not shown.
18 changes: 14 additions & 4 deletions man/table1.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4fb915d

Please sign in to comment.