Skip to content

error: ‘Load’ is not a member of ‘mlpack::data’ #19

@nikhilsingh13

Description

@nikhilsingh13

The problem is with loading and saving the data. Am I doing it correctly or are there some changes that I am supposed to make. Kindly advise.

The code I am using is mentioned below.

library("inline")
library("RcppMLPACK")

write.table(iris[,1:4] , "iris.csv" , col.names = FALSE , row.names = FALSE)

code <- '
  std::string inputFile = Rcpp::as<std::string>(input);
  std::string outputFile = Rcpp::as<std::string>(output);
  arma::mat data;
  mlpack::data::Load(inputFile ,data ,true);
  arma::mat cov = data * trans(data) / data.n_cols;
  mlpack::data::Save(outputFile, cov)
'
mlCov_2 <- cxxfunction(signature(input="iris.csv" , output = "cov.csv") , code, plugin="RcppMLPACK")

The error is mentioned below:

Error in compileCode(f, code, language = language, verbose = verbose) : 
  Compilation ERROR, function(s)/method(s) not created! file27c07f10c076.cpp: In function ‘SEXPREC* file27c07f10c076(SEXP, SEXP)’:
file27c07f10c076.cpp:34:3: error: ‘Load’ is not a member of ‘mlpack::data’
   mlpack::data::Load(inputFile ,data ,true);
   ^
file27c07f10c076.cpp:36:3: error: ‘Save’ is not a member of ‘mlpack::data’
   mlpack::data::Save(outputFile, cov)
   ^
In file included from /home/nikhil/R/x86_64-pc-linux-gnu-library/3.3/Rcpp/include/Rcpp/r/headers.h:50:0,
                 from /home/nikhil/R/x86_64-pc-linux-gnu-library/3.3/Rcpp/include/RcppCommon.h:29,
                 from /home/nikhil/R/x86_64-pc-linux-gnu-library/3.3/RcppArmadillo/include/RcppArmadilloForward.h:26,
                 from /home/nikhil/R/x86_64-pc-linux-gnu-library/3.3/RcppArmadillo/include/RcppArmadillo.h:31,
                 from /home/nikhil/R/x86_64-pc-linux-gnu-library/3.3/RcppMLPACK/include/mlpack/core/arma_extend/arma_extend.hpp:19,
                 from /home/nik
In addition: Warning message:
running command '/usr/lib/R/bin/R CMD SHLIB file27c07f10c076.cpp 2> file27c07f10c076.cpp.err.txt' had status 1

Version of

RcppMLPACK_1.0.10-6 
inline_0.3.14

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions