Skip to content

Commit

Permalink
Move data.table code to own package
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Mar 8, 2016
1 parent a176725 commit 344d23c
Show file tree
Hide file tree
Showing 57 changed files with 150 additions and 1,194 deletions.
11 changes: 5 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: dplyr
Type: Package
Version: 0.4.3.9000
Version: 0.4.3.9001
Title: A Grammar of Data Manipulation
Description: A fast, consistent tool for working with data frame like objects,
both in memory and out of memory.
Expand All @@ -25,7 +25,6 @@ Suggests:
RSQLite (>= 1.0.0),
RMySQL,
RPostgreSQL,
data.table,
testthat,
knitr,
microbenchmark,
Expand All @@ -35,7 +34,10 @@ Suggests:
nycflights13,
methods,
rmarkdown,
covr
covr,
dtplyr
Remotes:
hadley/dtplyr
VignetteBuilder: knitr
LazyData: yes
LinkingTo: Rcpp (>= 0.12.0),
Expand Down Expand Up @@ -70,7 +72,6 @@ Collate:
'group-indices.R'
'group-size.r'
'grouped-df.r'
'grouped-dt.r'
'id.r'
'inline.r'
'join.r'
Expand Down Expand Up @@ -101,7 +102,6 @@ Collate:
'tally.R'
'tbl-cube.r'
'tbl-df.r'
'tbl-dt.r'
'tbl-sql.r'
'tbl.r'
'top-n.R'
Expand All @@ -110,7 +110,6 @@ Collate:
'translate-sql-window.r'
'translate-sql.r'
'type-sum.r'
'utils-dt.R'
'utils-format.r'
'utils.r'
'view.r'
Expand Down
62 changes: 3 additions & 59 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,20 @@ S3method("[",grouped_df)
S3method("[",tbl_df)
S3method("[[",tbl_df)
S3method(all.equal,tbl_df)
S3method(all.equal,tbl_dt)
S3method(anti_join,data.frame)
S3method(anti_join,data.table)
S3method(anti_join,tbl_df)
S3method(anti_join,tbl_sql)
S3method(arrange_,data.frame)
S3method(arrange_,data.table)
S3method(arrange_,grouped_dt)
S3method(arrange_,tbl_df)
S3method(arrange_,tbl_dt)
S3method(arrange_,tbl_sql)
S3method(as.data.frame,grouped_df)
S3method(as.data.frame,rowwise_df)
S3method(as.data.frame,tbl_cube)
S3method(as.data.frame,tbl_df)
S3method(as.data.frame,tbl_dt)
S3method(as.data.frame,tbl_sql)
S3method(as.fun_list,character)
S3method(as.fun_list,fun_list)
S3method(as.tbl,data.frame)
S3method(as.tbl,data.table)
S3method(as.tbl,tbl)
S3method(as.tbl_cube,array)
S3method(as.tbl_cube,data.frame)
Expand All @@ -39,7 +32,6 @@ S3method(as_data_frame,tbl_cube)
S3method(as_data_frame,tbl_df)
S3method(auto_copy,tbl_cube)
S3method(auto_copy,tbl_df)
S3method(auto_copy,tbl_dt)
S3method(auto_copy,tbl_sql)
S3method(c,sql)
S3method(cbind,grouped_df)
Expand Down Expand Up @@ -82,22 +74,15 @@ S3method(db_rollback,DBIConnection)
S3method(db_save_query,DBIConnection)
S3method(dim,tbl_cube)
S3method(dim,tbl_sql)
S3method(dimnames,tbl_dt)
S3method(dimnames,tbl_sql)
S3method(distinct_,data.frame)
S3method(distinct_,data.table)
S3method(distinct_,grouped_df)
S3method(distinct_,grouped_dt)
S3method(distinct_,tbl_df)
S3method(distinct_,tbl_dt)
S3method(distinct_,tbl_sql)
S3method(do_,"NULL")
S3method(do_,data.frame)
S3method(do_,data.table)
S3method(do_,grouped_df)
S3method(do_,grouped_dt)
S3method(do_,rowwise_df)
S3method(do_,tbl_dt)
S3method(do_,tbl_sql)
S3method(escape,"NULL")
S3method(escape,Date)
Expand All @@ -112,11 +97,8 @@ S3method(escape,logical)
S3method(escape,sql)
S3method(explain,tbl_sql)
S3method(filter_,data.frame)
S3method(filter_,data.table)
S3method(filter_,grouped_dt)
S3method(filter_,tbl_cube)
S3method(filter_,tbl_df)
S3method(filter_,tbl_dt)
S3method(filter_,tbl_sql)
S3method(format,sql)
S3method(format,src_local)
Expand All @@ -130,45 +112,34 @@ S3method(glimpse,data.frame)
S3method(glimpse,default)
S3method(glimpse,tbl)
S3method(group_by_,data.frame)
S3method(group_by_,data.table)
S3method(group_by_,rowwise_df)
S3method(group_by_,tbl_cube)
S3method(group_by_,tbl_sql)
S3method(group_indices_,data.frame)
S3method(group_indices_,grouped_df)
S3method(group_size,data.frame)
S3method(group_size,grouped_df)
S3method(group_size,grouped_dt)
S3method(group_size,rowwise_df)
S3method(group_size,tbl_sql)
S3method(groups,data.frame)
S3method(groups,grouped_df)
S3method(groups,grouped_dt)
S3method(groups,tbl_cube)
S3method(groups,tbl_dt)
S3method(groups,tbl_sql)
S3method(head,tbl_dt)
S3method(head,tbl_sql)
S3method(inner_join,data.frame)
S3method(inner_join,data.table)
S3method(inner_join,tbl_df)
S3method(inner_join,tbl_sql)
S3method(intersect,data.frame)
S3method(intersect,default)
S3method(intersect,tbl_sql)
S3method(left_join,data.frame)
S3method(left_join,data.table)
S3method(left_join,tbl_df)
S3method(left_join,tbl_sql)
S3method(mutate_,data.frame)
S3method(mutate_,data.table)
S3method(mutate_,grouped_dt)
S3method(mutate_,tbl_df)
S3method(mutate_,tbl_dt)
S3method(mutate_,tbl_sql)
S3method(n_groups,data.frame)
S3method(n_groups,grouped_df)
S3method(n_groups,grouped_dt)
S3method(n_groups,rowwise_df)
S3method(n_groups,tbl_sql)
S3method(names,sql_variant)
Expand All @@ -179,25 +150,20 @@ S3method(obj_type,default)
S3method(print,BoolResult)
S3method(print,fun_list)
S3method(print,grouped_df)
S3method(print,grouped_dt)
S3method(print,location)
S3method(print,rowwise_df)
S3method(print,sql)
S3method(print,sql_variant)
S3method(print,src)
S3method(print,tbl_cube)
S3method(print,tbl_df)
S3method(print,tbl_dt)
S3method(print,tbl_sql)
S3method(print,trunc_mat)
S3method(query,DBIConnection)
S3method(rbind,grouped_df)
S3method(rename_,data.frame)
S3method(rename_,data.table)
S3method(rename_,grouped_df)
S3method(rename_,grouped_dt)
S3method(rename_,tbl_cube)
S3method(rename_,tbl_dt)
S3method(rename_,tbl_sql)
S3method(reset,default)
S3method(reset,list)
Expand All @@ -208,27 +174,18 @@ S3method(right_join,tbl_sql)
S3method(same_src,data.frame)
S3method(same_src,src_sql)
S3method(same_src,tbl_cube)
S3method(same_src,tbl_dt)
S3method(same_src,tbl_sql)
S3method(sample_frac,data.frame)
S3method(sample_frac,default)
S3method(sample_frac,grouped_df)
S3method(sample_frac,grouped_dt)
S3method(sample_frac,tbl_dt)
S3method(sample_n,data.frame)
S3method(sample_n,default)
S3method(sample_n,grouped_df)
S3method(sample_n,grouped_dt)
S3method(sample_n,tbl_dt)
S3method(select_,data.frame)
S3method(select_,data.table)
S3method(select_,grouped_df)
S3method(select_,grouped_dt)
S3method(select_,tbl_cube)
S3method(select_,tbl_dt)
S3method(select_,tbl_sql)
S3method(semi_join,data.frame)
S3method(semi_join,data.table)
S3method(semi_join,tbl_df)
S3method(semi_join,tbl_sql)
S3method(setdiff,data.frame)
Expand All @@ -237,10 +194,7 @@ S3method(setdiff,tbl_sql)
S3method(setequal,data.frame)
S3method(setequal,default)
S3method(slice_,data.frame)
S3method(slice_,data.table)
S3method(slice_,grouped_dt)
S3method(slice_,tbl_df)
S3method(slice_,tbl_dt)
S3method(sql_escape_ident,"NULL")
S3method(sql_escape_ident,DBIConnection)
S3method(sql_escape_ident,MySQLConnection)
Expand All @@ -262,21 +216,16 @@ S3method(src_translate_env,src_postgres)
S3method(src_translate_env,src_sqlite)
S3method(src_translate_env,tbl_sql)
S3method(summarise_,data.frame)
S3method(summarise_,data.table)
S3method(summarise_,grouped_dt)
S3method(summarise_,tbl_cube)
S3method(summarise_,tbl_df)
S3method(summarise_,tbl_dt)
S3method(summarise_,tbl_sql)
S3method(tail,tbl_dt)
S3method(tail,tbl_sql)
S3method(tbl,src_local)
S3method(tbl,src_mysql)
S3method(tbl,src_postgres)
S3method(tbl,src_sqlite)
S3method(tbl_vars,data.frame)
S3method(tbl_vars,tbl_cube)
S3method(tbl_vars,tbl_dt)
S3method(tbl_vars,tbl_sql)
S3method(transmute_,default)
S3method(type_sum,Date)
Expand All @@ -291,11 +240,8 @@ S3method(type_sum,logical)
S3method(type_sum,matrix)
S3method(type_sum,numeric)
S3method(ungroup,data.frame)
S3method(ungroup,data.table)
S3method(ungroup,grouped_df)
S3method(ungroup,grouped_dt)
S3method(ungroup,rowwise_df)
S3method(ungroup,tbl_dt)
S3method(ungroup,tbl_sql)
S3method(union,data.frame)
S3method(union,default)
Expand All @@ -306,7 +252,6 @@ S3method(union_all,tbl_sql)
S3method(unique,sql)
S3method(update,tbl_sql)
export("%>%")
export(.datatable.aware)
export(add_row)
export(add_rownames)
export(all_equal)
Expand All @@ -316,6 +261,7 @@ export(arrange_)
export(as.tbl)
export(as.tbl_cube)
export(as_data_frame)
export(auto_copy)
export(base_agg)
export(base_no_win)
export(base_scalar)
Expand All @@ -330,6 +276,7 @@ export(coalesce)
export(collapse)
export(collect)
export(combine)
export(common_by)
export(compare_tbls)
export(compute)
export(contains)
Expand Down Expand Up @@ -383,19 +330,18 @@ export(funs_)
export(glimpse)
export(group_by)
export(group_by_)
export(group_by_prepare)
export(group_indices)
export(group_indices_)
export(group_size)
export(grouped_df)
export(grouped_dt)
export(groups)
export(has_lahman)
export(id)
export(ident)
export(inner_join)
export(intersect)
export(is.grouped_df)
export(is.grouped_dt)
export(is.ident)
export(is.sql)
export(is.src)
Expand Down Expand Up @@ -477,7 +423,6 @@ export(sql_variant)
export(src)
export(src_desc)
export(src_df)
export(src_dt)
export(src_local)
export(src_mysql)
export(src_postgres)
Expand All @@ -499,7 +444,6 @@ export(tally)
export(tbl)
export(tbl_cube)
export(tbl_df)
export(tbl_dt)
export(tbl_sql)
export(tbl_vars)
export(temp_srcs)
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# dplyr 0.4.3.9000

* All data table related code has been separated out in to a new dtplyr package.
You'll get a message reminding you to load it if both data.table and dplyr are
loaded.

* Unary `-` minus is better translated in to SQL (fixes #1002).

* New `union_all()` method. Maps to `UNION ALL` for SQL sources, `bind_rows()`
Expand Down
7 changes: 1 addition & 6 deletions R/all-equal.r
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' Flexible equality comparison for data frames.
#'
#' You can use \code{all_equal} with any data frame, and dplyr also provides
#' \code{tbl_df} and \code{tbl_dt} methods for \code{\link{all.equal}}.
#' \code{tbl_df} methods for \code{\link{all.equal}}.
#'
#' @param target,current Two data frames to compare.
#' @param ignore_col_order Should order of columns be ignored?
Expand Down Expand Up @@ -46,8 +46,3 @@ all_equal <- function(target, current, ignore_col_order = TRUE,
#' @rdname all_equal
#' @method all.equal tbl_df
all.equal.tbl_df <- all_equal

#' @export
#' @rdname all_equal
#' @method all.equal tbl_dt
all.equal.tbl_dt <- all_equal
2 changes: 1 addition & 1 deletion R/bench-compare.r
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#' @examples
#' \dontrun{
#' if (require("microbenchmark") && has_lahman()) {
#' lahman_local <- lahman_srcs("df", "dt")
#' lahman_local <- lahman_srcs("df", "sqlite")
#' teams <- lapply(lahman_local, function(x) x %>% tbl("Teams"))
#'
#' compare_tbls(teams, function(x) x %>% filter(yearID == 2010))
Expand Down
13 changes: 11 additions & 2 deletions R/copy-to.r
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' Copy a local data frame to a remote src.
#'
#' This uploads a local data frame into a remote data source, creating the
#' table definition as needed. Wherever possible, the new object will be
#' This function uploads a local data frame into a remote data source, creating
#' the table definition as needed. Wherever possible, the new object will be
#' temporary, limited to the current connection to the source.
#'
#' @param dest remote data source
Expand All @@ -14,6 +14,15 @@ copy_to <- function(dest, df, name = deparse(substitute(df)), ...) {
UseMethod("copy_to")
}

#' Copy tables to same source, if necessary.
#'
#' @param x,y \code{y} will be copied to \code{x}, if neccessary.
#' @param copy If \code{x} and \code{y} are not from the same data source,
#' and \code{copy} is \code{TRUE}, then \code{y} will be copied into the
#' same src as \code{x}. This allows you to join tables across srcs, but
#' it is a potentially expensive operation so you must opt into it.
#' @param ... Other arguments passed on to methods.
#' @export
auto_copy <- function(x, y, copy = FALSE, ...) {
if (same_src(x, y)) return(y)

Expand Down
Loading

0 comments on commit 344d23c

Please sign in to comment.