Visokio website     Downloads     Video tutorials     KnowledgeBase  
R Analytics: "K-means clustering" option of "R statistics operation" block broken? - Visokio Forums
R Analytics: "K-means clustering" option of "R statistics operation" block broken?
  • joshlk May 7, 2015 12:21PM
    When executing the "K-means clustering" option of "R statistics operation" block an error is raised:

    "Error executing R operation.

    Error in data.frame(input_data, cluster) :
    arguments imply differing number of rows: 139, 61
    Execution halted"

    I had a look at the underlying R code and it looks like the data is first filtered for null values:

    "subset<-na.omit(subset)"<br />
    But the last operation tries to remerge the original dataset with the clustering results even though some of the original lines where omitted.

    Versions -
    Omniscope: 2.9 build 1593 x64
    R version: 3.2.0
  • 1 Comment
  • glen May 8, 2015 10:33AM
    Hi Josh,

    You are quite right about the source of the error. The problem is on the last line of the script (line 22):

    output_data <- data.frame(input_data,cluster)

    If you replace line 22 with this code your script will work:

    output_data<-data.frame(input_data[!apply((sapply(input_data[fields],is.na)),1,any),], cluster)

    We will also amend the error in the script for an upcoming build!

    Sincerely,

    Glen

Welcome!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Apply for Membership