Open sebastian-fox opened 5 years ago
Any chance there's a solution to this yet? I'm running into the same problem with pairwise_pmi(); using pairwisepmi() doesn't help either. The calls work outside the function, but not when utilized inside a function. Specifically, when passing the arguments directly to pairwisepmi() via {{ var }} I'm getting:
`Error in (function (cl, name, valueClass) :
assignment of an object of class “numeric” is not valid for @‘Dim’ in an object of class “dgTMatrix”; is(value, "integer") is not TRUE`
The same call outside of my function does work, however. Using the standard pairwise_pmi() call always results in
Error: Invalid column specification
no matter how I specify the colnames.
Any help appreciated!
Okay, I found the error. It was actually on my side, with the function producing erroneous dates to subset on, thus passing an empty dataframe to pairwisepmi.
So for anyone trying to pass columns with {{ embrace }} to functions like pairwise_pmi(), pairwise_cor() etc within a function or loop: Use the pairwisecor(), pairwisepmi() etc. functions. They can handle the {{ embrace }}. The "normal" function without the additional _ are just wrappers around them checking the column specifications, producing errors with {{ embrace }} (or with !!as.name() ).
Thanks for the info @TimBMK! I did some refactoring of how these functions use NSE a while back but still need to do more to be aligned with all the available ways to use rlang currently. In the meantime, your workaround looks good. 👍
Hi There,
I love your package. I can't see anything about this in the current issues. I've been trying to create a function that uses
widyr::pairwise_cor()
using the new tidy eval method embrace, but it doesn't work. I can't see why. Here is a reproducible example:This returns:
Are you able to help? Many thanks
Session info: