-
Notifications
You must be signed in to change notification settings - Fork 1
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
Generalizing transmute.R to other columns that contain matrices #12
Comments
This may also be noteworthy, within the dplyr package |
This diagram helps me a lot (from hyperSpec.pdf vignette). It’s not done too often but yes, R allows a matrix or a lot of things for a “column”. hyperSpec allows any number of additional columns (x and y in the diagram, there can be other columns which give per sample (row) info).
… On May 13, 2020, at 6:49 PM, Erick Oduniyi ***@***.***> wrote:
At the moment, transmute.hyperSpec uses eval to handle arithmetic operations on$spc, but other columns in the @DaTa slot with full matrices in the column/row not so much. Initially, the solution for dealing with $spc came out of observing:
***@***.***, spc = spc*2) # throws an error
.***@***.***$spc <- .***@***.***$spc*2 # works as expected
However, I am a) not sure how one even gets a matrix in a column or b) how to deal with non-spc columns that contain matrices...please help
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#12>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AABCIPUJHLSRSYKDS46CO23RRMPYJANCNFSM4NAFS6WQ>.
|
Okay! According to our conversation, the generalized mutate/transmute allows and disallows the following: # Is allowed:
hyperSpec.obj %>%
mutate (x = y, x2 = y2) # allowed
hyperSpec.obj %>%
mutate (c = c*2, c = c*0) # allowed
hyperSpec.obj %>%
mutate (y, x, filename, spc2 = spc*2) # allowed
hyperSpec.obj %>%
mutate(spc2 = spc*2) %>%
mutate(spc2) %>%
mutate(spc2*2) # allowed
# Let a and b be columns with row matrices, then
hyperSpec.obj %>%
mutate (a = a*0, a = a*2, a = a*3, b) # allowed
hyperSpec.obj %>%
mutate (a*0, a*2, a*3, b) # allowed
# Is not allowed:
hyperSpec.obj %>%
mutate (y, x, filename, spc = spc*2) # not allowed
hyperSpec.obj %>%
mutate (spc*2) # not allowed
hyperSpec.obj %>%
mutate(spc2 = spc*2) %>%
mutate(spc) # not allowed Note: |
Sorry for the delay.
|
From my understanding, you should not be able to modify the original |
yes,
for transforming transmission spectra into absorbance. That's a transformation that is very often needed. |
This issue has just become almost a non-issue since dplyr 1.0.0 got published and it natively works with columns containing matrices! 🎉 |
Going to close this then. |
At the moment,
transmute.hyperSpec
useseval
to handle arithmetic operations on$spc
, but other columns in the@data
slot with full matrices in the column/row not so much. Initially, the solution for dealing with$spc
came out of observing:However, I am a) not sure how one even gets a matrix in a column or b) how to deal with non-spc columns that contain matrices...please help
The text was updated successfully, but these errors were encountered: