mercredi 4 avril 2018

Equal values in R: function?

i've a db like this:

id, time, scale
1,3, 40
1,5,42
1,7,44
2,3,34
2,4,34
2,5,36
3,3,40
3,4,44
3,8,48 

Id represents subjects; a scale is measured at irregular intervals (time, expressed in month).

For each ID (1,2,3) I would like to know if there any plateaus in the scale values (i.e. equal values) and in the case for how long.

I guess I should write a function... but I have no idea! Can anyone help?

Aucun commentaire:

Enregistrer un commentaire