You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want the program to state an expression according to the input float. I have four floats, then I let to calculate the minimum of them and then, let switchCase do the rest. My code:
I could also not use deparse however in that case the values for differenceFrom... and minimum would all be different because of the very small difference that R calculates on the background. And comparing these numbers as strings doesn't seem to work in switchCase.
The text was updated successfully, but these errors were encountered:
I want the program to state an expression according to the input float. I have four floats, then I let to calculate the minimum of them and then, let switchCase do the rest. My code:
ELEMENTAARLAENG = 1.6E-19 velocity = 20 / 230 / ELEMENTAARLAENG / 8.5E28 / (13 * 1E-3) aInSi = 1 * 1e-3 / 3600 bInSi = 1 * 1e-3 cInSi = 1 dInSi = 1 * 1e3 differenceFromA = deparse(abs(aInSi - velocity)) differenceFromA differenceFromB = deparse(abs(bInSi - velocity)) differenceFromB differenceFromC = deparse(abs(cInSi - velocity)) differenceFromC differenceFromD = deparse(abs(dInSi - velocity)) differenceFromD minimum = deparse(min(c(differenceFromA, differenceFromB, differenceFromC, differenceFromD))) minimum library(switchcase) choice <- switchCase( minimum, alt( ..expr == differenceFromA, NULL, "A" ), alt( ..expr == differenceFromB, NULL, "B" ), alt( ..expr == differenceFromC, NULL, "C" ), alt( ..expr == differenceFromD, NULL, "D" ), alt( NULL, NULL, "E" ) ) choice
This code doesn't run and screams this:
I could also not use deparse however in that case the values for differenceFrom... and minimum would all be different because of the very small difference that R calculates on the background. And comparing these numbers as strings doesn't seem to work in switchCase.
The text was updated successfully, but these errors were encountered: