This function takes a sema dataset (must contain a variable sema_id and rownr) and calculates 'datanr', a survey number variable tracking only surveys with data for each participant. This is useful if you want to time-lag using all available data (though of course this can mean that you are lagging across larger time gaps for some participants than others or on some days). This variable is calculated when the clean_sema function is initially called, but you can also call it directly afterwards if you remove additional data (for example, removing surveys where responsecount is too low)
An R dataframe containing both sema_id and rownr variables (most likely, a sema dataset -after- processing with clean_sema)
Note that this will overwrite the previous version of datanr, so if you want to keep that variable for some reason, (for instance, you want to keep absolute data number separate from data number after surveys with too few responses are removed) then simple copy datanr into a new variable before using this function (e.g. mydata$old_data_nr <- mydata$datanr), then use this function.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.