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

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -