-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document how to handle matrix #76
Comments
Could you make it more generic and try to document the array case instead? |
Oh, thanks for your interest! You can use cf. https://cran.r-project.org/web/packages/reticulate/vignettes/arrays.html What I think I'll have to struggle about is how to do it efficiently. Since I'm not familiar with matrix and array, it might take some time. By the way, just curious, I think extendr is simple enough for simple usages. In what part of extendr do you feel is not simple? |
There's a couple of months I don't use extendr but here is what I can remember:
For error handling, I dont think this crate solves my problem of using my own rust errors in R. I have an old pIan of using external pointers of an enum to represent my own errors on rust side and unwrap these it on the R side, but the lack of |
Thanks for sharing, I see. I agree, if you prefer explicitness, probably my framework should fit better than extendr. I added a simple example of using array with conversion from R to Rust (ndarray). Does this help? |
Nice! I think an example helps a lot new users, the only missing thing is the reverse conversion, from ndarray to an R array, probably using |
Yes, I need a reverse conversion example... You can use https://yutannihilation.github.io/savvy/savvy/sexp/real/struct.OwnedRealSexp.html#method.set_dim |
Note to self. It seems I was wrong here.
|
@daniellga https://github.com/yutannihilation/savvy-matrix-examples/tree/master/src/rust/src |
Hey @yutannihilation! Sorry for taking so long, I am really struggling to find some time to code. I looked at your example code for ndarray and have some points:
I run into weird errors when doing |
Oh, thanks for the suggestions!
Yes. savvy doesn't work without a real R session. While you might feel comfortable with extendr's experience of I'm hoping savvy can eventually work with |
While I thought this is a good idea, now I think this isn't 100% safe. As long as the SEXP of |
But what if I get dim by using |
Ah, sorry, please forget my comment above. The input SEXP is read-only, so |
Hmm, my Rust-fu is not enough to pass the lifetime check. I'm giving up for now. Sorry. |
No problem! A way easier solution seems to be returning the |
No description provided.
The text was updated successfully, but these errors were encountered: