New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fct_c() should not require a list as an argument #42

Closed
AmeliaMN opened this Issue Sep 26, 2016 · 0 comments

Comments

Projects
None yet
1 participant
@AmeliaMN
Copy link
Contributor

AmeliaMN commented Sep 26, 2016

Related to this issue.

If you have the following data,

ds <- factor(c(rep("Male", times=2), rep("Female", times=4), rep("Gender non-conforming", times=2)))
test <- ds[1:4]
train <- ds[5:8]

The base c() does not work as expected:

c(test, train)
[1] 3 3 1 1 1 1 2 2

but you can list() and unlist()

unlist(list(test, train))
[1] Male                  Male                  Female                Female                Female                Female               
[7] Gender non-conforming Gender non-conforming
Levels: Female Gender non-conforming Male

That's annoying! I like fct_c() better because then I don't have to type unlist(), but I still have to give a list.

fct_c(list(test, train))
[1] Male                  Male                  Female                Female                Female                Female               
[7] Gender non-conforming Gender non-conforming
Levels: Female Gender non-conforming Male

I wish I could just fct_c(test, train).

@hadley hadley closed this in f07aace Dec 30, 2016

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