While reading a data set using fread
I have noticed that sometimes I can be repeated The column name, for example ( fread
has check.names
argument)
& gt; Data.table (x = 1, x = 2) xx 1: 1 2
The question is: if there is a way to remove 2 to 1 columns They have the same name?
how about
dt [unique (name (dt ), With = FALSE]
? ? From the Data.table:
:
j: The name of a column, the single expression of the column names, the 'list (') expression of the column names, an expression or function call that is' Evaluates 'list' ('data.frame' and 'data.table', too), or (when 'with = FALSE') to select the vector of names or posts.
This selects the first event of each name (I'm not sure how to handle it).
As suggested by @ David Errenberg, you can use data.table ()
in check.names = TRUE
(However, I do not see the check.names
option in fread () - maybe I'm missing something).
No comments:
Post a Comment