Colmn Regex Filter

Any chance of a Regex column name filter, or indeed splitter, so that columns with a common name type can be separated from the others.

likewise it would be useful to be able to split out columns of different type casts from other columns.

i find the range of column filtering tools very limited in knime at the moment, especially when compared to the row filtering options.

thanks,

simon.

Hi Simon, 

This one is already on our board and tentatively scheduled for 2.8. 

Aaron

Thanks for the replies.

simon.

Hi Simon,

In the meantime you can use the RapidMiner integration for KNIME (assuming you are already on KNIME 2.7), where the Select Attribute operator does similar things you described.

Or for the regexp replace you can customize this R code for an R snippet node:

#sample data
#R <- data.frame(a1 = rnorm(150), a2 = rnorm(150), a3 = rnorm(150), a4 = rnorm(150), label=c(rep("Iris-setosa", 50), rep("Iris-virginica", 50), rep("Iris-versicolor", 50)))

#replace
#dimnames(R) <- sapply(dimnames(R), function(colName) sub("a(\\d+)", "param_\\1", colName, perl=TRUE))
#filter
keep <- sapply(dimnames(R)[[2]], function(colName) grepl(pattern="a(\\d+)", colName, perl=TRUE))

R<-R[keep]

gabor

Hi all, 

Was this ever implemented? I still can't seem to find a regex column filter anywhere. 

Thanks!

Hi,

the regular Column Filter and Column Splitter node have an option  to allow you the filtering by regex or data type.

Bye,

Tobias

Hi Tobias, 

Sorry I don't think I was very clear in my last post. What I want to do is use the column filter node to filter based on a list of patterns, like the one in the column rename(Regex) node. Basically, to be able to use the wildcard functions of "?" and "*" , and the " | " function to seperate patterns. Is there a simple way to do that? 

Thank you!

Hi,

sorry for the delayed response. As I said you can filter columns based on regular expressions in the regular Column Filter and Column Splitter node by using the Wildcard/Regex Selection option as demonstrated in the attached workflow.

Bye,

Tobias

2 Likes