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

r
#1

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){
		return(e)
	}
	else if (grepl(e, l[1], fixed=TRUE)){
		return(l[1])
	}
	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.

0 Likes

#2

Hey @saqib

could you send me the ouput of

Cstack_info()

for both KNIME and RStudio?

0 Likes