Hello, I already read the discussion about the issue in object, but I can't find a way out! That problem came out all of a sudden, in a function that has always worked and has not been modified so far. I describe the problem here. if more code might help, I'll provide it. I have an R function named 'NormaliseEdges', where I set up variables and objects and then call: retEdges <- runNormalisation(miniEdges, fileSAM, numWrks, edgesProb, grain) the function called is a c++ function defined as: // [[Rcpp::export]] SEXP runNormalisation(DataFrame mEd, std::string samfile, int nwrks, float e_lm, int chunk) never had any problems with that. today it started to crash with the above error. Weirdly, this happens only when I call the R function, like: NormaliseEdges(g.Edges, file.SAM) Error: not compatible with requested type Called from: runNormalisation(miniEdges, fileSAM, numWrks, edgesProb, grain) if I simply call the c++ function it works fine retEdges <- runNormalisation(miniEdges, file.SAM, 1, 0, 0) I double-checked that 'miniEdges' is a data.frame (and it is); also, it has always been. I fear this might have something to do with other modifications in other files, that somehow affected the whole? is it possible? I don't see any other error! Regards, Fabio
[Rcpp-devel] Another 'Error: not compatible with requested type'
4 messages · Fabio Tordini, Dirk Eddelbuettel
On 7 August 2015 at 13:40, Fabio Tordini wrote:
| Hello, | I already read the discussion about the issue in object, but I can't | find a way out! We can't either. You supplied a screenful of email but __no reproducible code__ exhibiting an error we can reproduce. Nobody can help you based on what you wrote here. Dirk | That problem came out all of a sudden, in a function that has always | worked and has not been modified so far. | | I describe the problem here. if more code might help, I'll provide it. | | | I have an R function named 'NormaliseEdges', where I set up variables | and objects and then call: | retEdges <- runNormalisation(miniEdges, fileSAM, numWrks, edgesProb, grain) | | the function called is a c++ function defined as: | // [[Rcpp::export]] | SEXP runNormalisation(DataFrame mEd, std::string samfile, int nwrks, | float e_lm, int chunk) | | never had any problems with that. | | today it started to crash with the above error. | Weirdly, this happens only when I call the R function, like: | NormaliseEdges(g.Edges, file.SAM) | Error: not compatible with requested type | Called from: runNormalisation(miniEdges, fileSAM, numWrks, edgesProb, grain) | | if I simply call the c++ function it works fine | retEdges <- runNormalisation(miniEdges, file.SAM, 1, 0, 0) | | I double-checked that 'miniEdges' is a data.frame (and it is); also, it | has always been. | | | I fear this might have something to do with other modifications in other | files, that somehow affected the whole? is it possible? | I don't see any other error! | | | Regards, | Fabio | | _______________________________________________ | Rcpp-devel mailing list | Rcpp-devel at lists.r-forge.r-project.org | https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
I tried to first explaining the scenario.
Anyway, this seems to be the point:
Step1:
BuildGraph("POLR2A", fileSAM = "/space/datasets/ord_LiebermanAiden.sam")
no matter what body and result of this function are, the 'fileSAM'
string gets assigned to '.GlobalEnv' for subsequent reuse:
assign("file.SAM", fileSAM, envir = .GlobalEnv)
three other similar strings and the g.Edges datatable (Step2) are also
assigned to global environment.
Step2:
NormaliseEdges(edgesList=g.Edges, fileSAM = file.SAM)
the global variable 'file.SAM', that stores the string above, is used
again: THIS PRODUCES THE ERROR IN OBJECT, even though it did not give
any problem before.
Step2_BIS:
NormaliseEdges(edgesList=g.Edges, fileSAM =
"/space/datasets/ord_LiebermanAiden.sam")
pass a string instead of a global variable containing the string: THIS
DOES NOT PRODUCE ANY ERROR.
Step2_TER:
retEdges <- runNormalisation(miniEdges, file.SAM, 1, 0, 0)
manually call C++ function, using the global variable 'file.SAM'
(miniEdges is a data.frame): THIS DOES NOT PRODUCE ANY ERROR.
The 'runNormalisation' function's signature:
SEXP runNormalisation(Rcpp::DataFrame mEd, std::string samfile, int
nwrks, float e_lm, int chunk)
The code executed within these functions does not seem to play a part in
the error. to me it looks like it has to do with 'file.SAM' scope, or
with variables declared in GlobalEnv in general, but I might be wrong.
Also, it wasn't a problem until early this morning!
Regards,
Fabio
On 08/07/2015 02:19 PM, Dirk Eddelbuettel wrote:
On 7 August 2015 at 13:40, Fabio Tordini wrote: | Hello, | I already read the discussion about the issue in object, but I can't | find a way out! We can't either. You supplied a screenful of email but __no reproducible code__ exhibiting an error we can reproduce. Nobody can help you based on what you wrote here. Dirk | That problem came out all of a sudden, in a function that has always | worked and has not been modified so far. | | I describe the problem here. if more code might help, I'll provide it. | | | I have an R function named 'NormaliseEdges', where I set up variables | and objects and then call: | retEdges <- runNormalisation(miniEdges, fileSAM, numWrks, edgesProb, grain) | | the function called is a c++ function defined as: | // [[Rcpp::export]] | SEXP runNormalisation(DataFrame mEd, std::string samfile, int nwrks, | float e_lm, int chunk) | | never had any problems with that. | | today it started to crash with the above error. | Weirdly, this happens only when I call the R function, like: | NormaliseEdges(g.Edges, file.SAM) | Error: not compatible with requested type | Called from: runNormalisation(miniEdges, fileSAM, numWrks, edgesProb, grain) | | if I simply call the c++ function it works fine | retEdges <- runNormalisation(miniEdges, file.SAM, 1, 0, 0) | | I double-checked that 'miniEdges' is a data.frame (and it is); also, it | has always been. | | | I fear this might have something to do with other modifications in other | files, that somehow affected the whole? is it possible? | I don't see any other error! | | | Regards, | Fabio | | _______________________________________________ | Rcpp-devel mailing list | Rcpp-devel at lists.r-forge.r-project.org | https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
3 days later
Fabio, That is not a _minimally reproducible example_ as we do not have your data. This write-up may be helpful: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example Dirk
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org