Skip to content
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

Select do not rename variable with data.table #284

Closed
cderv opened this issue Feb 26, 2014 · 0 comments
Closed

Select do not rename variable with data.table #284

cderv opened this issue Feb 26, 2014 · 0 comments

Comments

@cderv
Copy link
Contributor

@cderv cderv commented Feb 26, 2014

Hi,

"select() is substantially more powerful. You can use named arguments to rename existing variables"

I tried to use this new functionality. It work with data.frame or tbl_df but don't work with tbl_dt or or data.table. Is this an issue or just no compatibility between dplyr and data.table?

EXAMPLE

data.dt<-data.table(Col1=1:4,Col2=letters[1:4])
data.df<-data.frame(Col1=1:4,Col2=letters[1:4])
 select(data.df,Col1,NewCol2=Col2)

#  Col1 NewCol2
#1    1       a
#2    2       b
#3    3       c
#4    4       d

==> It worked

select(data.dt,Col1,NewCol2=Col2)
#   Col1 Col2
#1:    1    a
#2:    2    b
#3:    3    c
#4:    4    d

==> Do not work

select(tbl_df(data.df),Col1,NewCol2=Col2)
#Source: local data frame [4 x 2]
#
#  Col1 NewCol2
#1    1       a
#2    2       b
#3    3       c
#4    4       d

==> It worked

select(tbl_dt(data.dt),Col1,NewCol2=Col2)
#Source:     local data table [4 x 2]
#
#  Col1 Col2
#1    1    a
#2    2    b
#3    3    c
#4    4    d

==> Do not work

Christophe

@hadley hadley closed this in f8dff98 Feb 26, 2014
@lock lock bot locked as resolved and limited conversation to collaborators Jun 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant