LAMP Consortium

Preparing to analyze your data in R

Check out the following document to learn how to get from raw LAMP data to a flat table (csv) along with sample analyses:

2 Likes

@phenson - This is super helpful. I really appreciate the work you put into this. I attempted to follow your guide and got hung on in a few places. I added the dplyr package and that helped, but I’ve been troubleshooting the preprocessing step and reached a road block with the error:

Error in LAMP$ResultEvent$allByParticipant(participants[i]) :
attempt to apply non-function"

I saw in your guide that this code may be deprecated, so I was wondering if I am doing something wrong or this code is no longer functional. Thanks in advance!

@czysz - Thanks for checking out the guide and trying the code! The non-function error is something we are trying to work out at the moment, but the current solution is to make sure that the LAMP object initialization, e.g. LAMP <- LAMP$new(‘https://api.lamp.digital’, USERNAME, PASSWORD), is only ever run once for a given environment. If/when you get this error, try removing all objects from the environment and re-run the code, again making sure that LAMP$new() is only ever called once. Let me know if that fixes your issue!

@phenson Wow! Thanks for writing back so fast.

I had run into this same issue when I had tried running the LAMP objective initialization twice in the same environment without clearing it - so I had quickly learned to clear out my environment each time I ran code.

So yeah, I’ve tried running the processing step several times in the fresh environment (even on R Studio Cloud to ensure its not something funky with my local build of R Studio). Nonetheless I get the same error each time. I wonder if it has to do with any other packages I need installed, or perhaps the data itself I’m pulling (It is a demo account with only myself as a participant)?

Ah yes, so ResultEvent is indeed deprecated. Use ActivityEvent instead and let me know if that works!

@phenson Worked beautifully! Very awesome, thank you kindly!

As a side note, I also needed to install two other packages:
library(anytime)
library(data.table)

Glad to hear it! I will update the notion guide to add those libraries and the change to the ActivityEvent.