[R] Conditional operation on data frame, shift/roll of vector
Conditionally, when Ind of a certain row is 1, want to get sum or delta of Val in that row and 1 row above. Val Ind Val Ind Del 10 010 0NA 11 011 0NA 13 1 ---> 13 124 or 2 16 0
[R] Skipping missing files when importing data
Trying to import a bunch of data files named like f001, f002, f999. Some of the files may be missing and the missing files vary from time to time. Used for loop and read.table. When it reaches the missing file (say f100), it shows: Error in file(file, "r") : cannot open the connection In ad