"Error: C stack usage is too close to the limit" when using a R Recursive function in Knime

I have the following code in a R Snippet in Knime.

ngrams <- as.list(knime.in$Ngram)

calc <- function(e, l){
	if(length(l) == 0){
	else if (grepl(e, l[1], fixed=TRUE)){
	else {
		return(calc(e, (tail(l, -1))))

reduced_ngrams <- lapply(ngrams, calc, l=ngrams)
knime.out <- as.data.frame(unlist(reduced_ngrams))

However Knime was errors out on “Eval Script” when there more than 100 rows in the R snippet input. Here is the error:

`Error: C stack usage is too close to the limit`

The code runs and function fine in RStudio.

Hey @saqib

could you send me the ouput of


for both KNIME and RStudio?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.