whichSetOfN | R Documentation |
Finds the sequential number of sets of data when reading fixed size multirow blocks of rows.
whichSetOfN(x, n)
x |
object to test |
n |
size of set |
integer: the number of the set, 1,2,3 ...
I am quite often importing data with a multirow nested structure so I may have data from participants with different ID values and with different occasions per participant and then some fixed number of rows of data per person per occasion. For one set of data I might have say four rows of medication data per participant per occasion per actual medication prescribed. I use whichSetOfN(row_number(), 4) to tell me the sequential number of the prescription this row (found by row_number() inside a group_by()).
Started 12.x.24
Chris Evans
Other utility functions:
convertClipboardAuthorNames()
,
fixVarNames()
,
getAttenuatedR()
,
getCorrectedR()
whichSetOfN(1:7, 3)
### shows that 1:3 belong to set 1, 4:6 to set 2 and 7 to set 3
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.