I am trying to extract columns from a DT to a new DT using select{dplyr}
extract_Data <- select(.data = master_merge, subjectID, activity_ID,
contains("mean\\(\\)"), contains("std\\(\\)"))
There are 563 columns so I am asking to extract the first and second column (subject, activity) and all other columns where mean() or std() is present.
There are NO duplicate columns that can be created here. so stumped as to the why. I have tried every variation of select but always Error: Duplicated Column name.
How can I troubleshoot this - I have gone through all 563 columns names and there are no duplicates.
The root of the problem is invalid characters in the original column names. The discussion in Variable Name Restrictions in R applies to column names, too. Try forcing unique column names with valid characters, with make.names() .
valid_column_names <- make.names(names=names(master_merge), unique=TRUE, allow_ = TRUE)
names(master_merge) <- valid_column_names
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With