@@ -1278,6 +1278,7 @@ sample_frac.SingleCellExperiment <- function(tbl, size=1, replace=FALSE,
12781278
12791279# ' Count observations by group
12801280# '
1281+ # ' @importFrom dplyr count
12811282# '
12821283# ' @description
12831284# ' `count()` lets you quickly count the unique values of one or more variables:
@@ -1311,30 +1312,19 @@ sample_frac.SingleCellExperiment <- function(tbl, size=1, replace=FALSE,
13111312# ' An object of the same type as `.data`. `count()` and `add_count()`
13121313# ' group transiently, so the output has the same groups as the input.
13131314# ' @export
1315+ # '
1316+ # ' @rdname dplyr-methods
1317+ # ' @name count
1318+ # '
13141319# ' @examples
13151320# '
1321+ # '
13161322# ' `%>%` <- magrittr::`%>%`
13171323# ' pbmc_small %>%
13181324# '
13191325# ' count(groups)
1320- count <- function (x , ... , wt = NULL , sort = FALSE , name = NULL , .drop = group_by_drop_default(x )) {
1321- UseMethod(" count" )
1322- }
1326+ NULL
13231327
1324- # ' @export
1325- count.default <- function (x , ... , wt = NULL , sort = FALSE , name = NULL , .drop = group_by_drop_default(x )) {
1326- if (! missing(... )) {
1327- out <- dplyr :: group_by(x , ... , .add = TRUE , .drop = .drop )
1328- }
1329- else {
1330- out <- x
1331- }
1332- out <- dplyr :: tally(out , wt = !! enquo(wt ), sort = sort , name = name )
1333- if (is.data.frame(x )) {
1334- out <- dplyr :: dplyr_reconstruct(out , x )
1335- }
1336- out
1337- }
13381328# ' @export
13391329count.SingleCellExperiment <- function (x , ... , wt = NULL , sort = FALSE , name = NULL , .drop = group_by_drop_default(x )) {
13401330 message(data_frame_returned_message )
@@ -1352,23 +1342,19 @@ count.SingleCellExperiment <- function(x, ..., wt=NULL, sort=FALSE, name=NULL, .
13521342 dplyr :: count(... , wt = !! enquo(wt ), sort = sort , name = name , .drop = .drop )
13531343}
13541344
1355- # ' @export
1356- # ' @rdname count
1357- add_count <- function (x , ... , wt = NULL , sort = FALSE , name = NULL , .drop = group_by_drop_default(x )) {
1358- UseMethod(" add_count" )
1359- }
13601345
13611346# ' @export
1362- # ' @rdname count
1363- add_count.default <- function (x , ... , wt = NULL , sort = FALSE , name = NULL , .drop = group_by_drop_default(x )) {
1364-
1365- dplyr :: add_count(x = x , ... , wt = !! enquo(wt ), sort = sort , name = name , .drop = .drop )
1366-
1367- }
1347+ # '
1348+ # '
1349+ # ' @importFrom dplyr add_count
1350+ # '
1351+ # ' @name add_count
1352+ # '
1353+ # ' @rdname dplyr-methods
1354+ NULL
13681355
13691356# ' @export
1370- # ' @rdname count
1371- add_count.SingleCellExperiment <- function (x , ... , wt = NULL , sort = FALSE , name = NULL , .drop = group_by_drop_default(x )) {
1357+ add_count.SingleCellExperiment <- function (x , ... , wt = NULL , sort = FALSE , name = NULL ) {
13721358
13731359 # Deprecation of special column names
13741360 if (is_sample_feature_deprecated_used(
@@ -1378,16 +1364,18 @@ add_count.SingleCellExperiment <- function(x, ..., wt = NULL, sort = FALSE, name
13781364 x = ping_old_special_column_into_metadata(x )
13791365 }
13801366
1381- colData(x ) =
1382- x %> %
1383- as_tibble %> %
1384- dplyr :: add_count(... , wt = !! enquo(wt ), sort = sort , name = name , .drop = .drop ) %> %
1385- as_meta_data(x )
1367+ colData(x ) =
1368+ x %> %
1369+ as_tibble %> %
1370+ dplyr :: add_count(... , wt = !! enquo(wt ), sort = sort , name = name ) %> %
1371+ as_meta_data(x )
13861372
1387- x
1373+ x
13881374
13891375}
13901376
1377+
1378+
13911379# ' Extract a single column
13921380# '
13931381# '
0 commit comments