Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

.n column in result of rdply is numeric again #201

Merged
merged 3 commits into from Feb 21, 2014

Conversation

Projects
None yet
2 participants
Contributor

krlmlr commented Feb 20, 2014

Tests had to be altered, because this was actually the behavior of plyr 1.8.

Fixes #199.

.n column in result of rdply is numeric again
Tests had to be altered, because this was actually the behavior of plyr 1.8.

@krlmlr krlmlr and 1 other commented on an outdated diff Feb 20, 2014

@@ -31,10 +31,10 @@ rdply <- function(.n, .expr, .progress = "none", .id = NA) {
res <- .rlply_worker(.n, .progress,
eval.parent(substitute(function() .expr)))
names(res) <- seq_len(.n)
- if (is.na(.id)) {
- .id <- ".n"
- id_as_factor <- FALSE
- } else
- id_as_factor <- TRUE
- list_to_dataframe(res, id_name = .id, id_as_factor = id_as_factor)
+ labels <- data.frame(.n = seq_len(.n))
+ if (!is.na(.id)) {
+ labels$.n <- factor(labels$.n, levels = labels$.n)
@krlmlr

krlmlr Feb 20, 2014

Contributor

I'm not sure anymore if it makes sense to have the .n column as factor in rdply(). The "natural order" of a sequence of integers should be enough here.

@hadley

hadley Feb 20, 2014

Owner

Yeah, I'm not sure why you'd need a factor here either.

@krlmlr

krlmlr Feb 20, 2014

Contributor

I'll add to this pull request.

Contributor

krlmlr commented Feb 21, 2014

Fixed, ready for merging.

hadley added a commit that referenced this pull request Feb 21, 2014

Merge pull request #201 from krlmlr/199-nullabor
.n column in result of rdply is numeric again

@hadley hadley merged commit 6c7f15f into hadley:master Feb 21, 2014

1 check passed

default The Travis CI build passed
Details
Owner

hadley commented Feb 21, 2014

Thanks!

@krlmlr krlmlr deleted the krlmlr:199-nullabor branch Mar 10, 2014

@krlmlr krlmlr restored the krlmlr:199-nullabor branch Mar 13, 2014

@krlmlr krlmlr deleted the krlmlr:199-nullabor branch Mar 13, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment