Hi Carl,
I'm not 100% sure what you're after, but I'm assuming you're looking for something like:

dt[, .SD, .SDcols=names(dt) %like% "Call1"]

That's syntax you can use to select all columns of a data.table containing "Call1".
--Mel.

On 3/10/2016 2:00 PM, carlsutton wrote:
Hi

I did search but did not see an answer.

I have a dt with 580 + columns.  many of the columns will have variations of
a name to specifically identify them, ie, call23,Call111, doCall.now, etc.
Since I cannot recall the exact column names I have been resorting to    df
<- data.frame(dt)  and then
                              a <- grep("Call1", colnames(df))
                             colnames(df[a])

which then returns the columns names containing Call1.

If I try this with the data table ie, colnames(dt[a]) I get null.

Any suggestions?  I am feeling rather ignorant converting a dt back to a
data frame and available memory may be a concern further down the road.

Carl Sutton



-----
Carl Sutton
--
View this message in context: 
http://r.789695.n4.nabble.com/finding-dt-columns-by-partial-name-tp4718464.html
Sent from the datatable-help mailing list archive at Nabble.com.
_______________________________________________
datatable-help mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help

_______________________________________________
datatable-help mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help

Reply via email to