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

strip.white trailing [REQUEST] #1820

Closed
masip85 opened this issue Aug 21, 2016 · 9 comments
Closed

strip.white trailing [REQUEST] #1820

masip85 opened this issue Aug 21, 2016 · 9 comments
Labels

Comments

@masip85
Copy link

masip85 commented Aug 21, 2016

If I have got a header name like "X Y", by default,the result of fread has a header called "X Y". Spaces are not changed by points like read.csv does by default. So after fread I've got to do ...
setnames(DT, make.names(colnames(DT)))
... to fix it. Could it be an option? Does it exist?

data.table package 1.9.6

@MichaelChirico
Copy link
Member

could you please provide the first several lines of the file?

@masip85
Copy link
Author

masip85 commented Aug 21, 2016

@masip85
Copy link
Author

masip85 commented Aug 21, 2016

I'm sorry, is read.csv which does that by default, but no fread. Let me edit it, and I will change it to request.

@masip85 masip85 changed the title strip.white trailing [BUG] strip.white trailing [REQUEST] Aug 21, 2016
@MichaelChirico
Copy link
Member

MichaelChirico commented Aug 22, 2016

Please install the development version, which has improved the check.names argument. I get this from your file:

names(fread("~/Downloads/Business_Licenses.csv", check.names = TRUE))
#  [1] "ID"                                "LICENSE.ID"                       
#  [3] "ACCOUNT.NUMBER"                    "SITE.NUMBER"                      
#  [5] "LEGAL.NAME"                        "DOING.BUSINESS.AS.NAME"           
#  [7] "ADDRESS"                           "CITY"                             
#  [9] "STATE"                             "ZIP.CODE"                         
# [11] "WARD"                              "PRECINCT"                         
# [13] "WARD.PRECINCT"                     "POLICE.DISTRICT"                  
# [15] "LICENSE.CODE"                      "LICENSE.DESCRIPTION"              
# [17] "LICENSE.NUMBER"                    "APPLICATION.TYPE"                 
# [19] "APPLICATION.CREATED.DATE"          "APPLICATION.REQUIREMENTS.COMPLETE"
# [21] "PAYMENT.DATE"                      "CONDITIONAL.APPROVAL"             
# [23] "LICENSE.TERM.START.DATE"           "LICENSE.TERM.EXPIRATION.DATE"     
# [25] "LICENSE.APPROVED.FOR.ISSUANCE"     "DATE.ISSUED"                      
# [27] "LICENSE.STATUS"                    "LICENSE.STATUS.CHANGE.DATE"       
# [29] "SSA"                               "LATITUDE"                         
# [31] "LONGITUDE"                         "LOCATION"  

Development version can be installed with

install.packages("data.table", type = "source", repos = "http://Rdatatable.github.io/data.table")

@MichaelChirico
Copy link
Member

@arunsrinivasan duplicate of #1027

@arunsrinivasan
Copy link
Member

check.names argument has been added to fread since v1.9.6. Set it to TRUE.

@MichaelChirico
Copy link
Member

MichaelChirico commented Aug 26, 2016

@arunsrinivasan the check.names in 1.9.6 doesn't incorporate David Arenburg's improvement (filling #1027) which fixes this issue... anyway, it is indeed fixed on development.

@arunsrinivasan
Copy link
Member

Michael, that's right, thanks.

@masip85
Copy link
Author

masip85 commented Oct 10, 2016

Right. Thanks,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants