Welcome to Knowage Q&A, where you can ask questions and receive answers from other members of the community.
+1 vote
1 view
Hello,

I have a dataset against which I want to run some R code. I have defined my input dataset and added the R code to the script tab.

But how to make the R code recognize the input data? Now we run this manually and in R we define a dataframe with the data that is our input (with the name "df"). How do I do that when I run the R in Knowage?

I see that in the CE documentation functions are not described. Any answer is much appreciated.

Kind regards,

Jeroen
in Data Mining by (590 points)
retagged by

1 Answer

0 votes

Hi,

datasets are executed at the beginning of the document’s execution so that data.frames can be used further by every script.

Let's assume you added two datasets as input, and one dataset as output.

Input:

  • SALES_BY_PROD_PROM_14
  • SALES_BY_PROD_PROM

Output

  • DS_FORECAST

You can use the input datasets as if they are loaded into dataframe. Same applies for the output, you can assign a dataframe to the output dataset by using its label.

Example

mydataframevar <-SALES_BY_PROD_PROM_14 // assign Knowage dataset to mydataframevar

myseconddataframevar <-SALES_BY_PROD_PROM // assign Knowage dataset to mydataframevar

// do something with my data frames

DS_FORECAST <- data.frame(args) // assign the resulting dataframe to the output Knowage dataset

by (15.2k points)
...