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
Hey, so I was taking a stroll through the code in this repo -- looks like a fun project! -- and I saw that you're using purrr! That package definitely revolutionized how I write code!
Anyway, just a quick tip that might be helpful. In lines like these, you might be able to skip the both the call to flatten_int and the anonymous function
If map is given a character string, it pulls out the element of each list item with that name. Adding the _int or _dbl takes care of the flattening down to integer/double.
map_int() does need each element to return a length-1 vector and the type needs to match the suffix or it will complain.
The text was updated successfully, but these errors were encountered:
oh hey, a month late but thanks! I have only really scratched the surface of purrr and always feel like I'm not using it efficiently (as seen in this case). Thanks for the tip, that helps a lot actually.
Hey, so I was taking a stroll through the code in this repo -- looks like a fun project! -- and I saw that you're using
purrr
! That package definitely revolutionized how I write code!Anyway, just a quick tip that might be helpful. In lines like these, you might be able to skip the both the call to
flatten_int
and the anonymous functionEducationOutreach/ParseUserData.R
Lines 17 to 18 in 836ab9f
by rewriting it like
If
map
is given a character string, it pulls out the element of each list item with that name. Adding the_int
or_dbl
takes care of the flattening down to integer/double.map_int()
does need each element to return a length-1 vector and the type needs to match the suffix or it will complain.The text was updated successfully, but these errors were encountered: