r - How do I get information for new element in column from other rows in dataframe? -
for project want total time used scrabble. have data frame in there localtime column. want add column dataframe difference between localtime now, , localtime previous element. when using diff function, following message:
error in `$<-.data.frame`(`*tmp*`, "timespend", value = c(1.5577, 1.0657, : replacement has 49313 rows, data has 49314
how can fix this?
at moment have used this:
dualtasktime$timespend <- na dualtasktime$timespend <- diff(dualtasktime$localtime)
Comments
Post a Comment