My data loks like this:
ID:10:237,204,
ID:11:257,239,
ID:12:309,291,
ID:13:310,272,
ID:14:3202,3184,
ID:15:404,388,
I would like to first separate this into different columns then apply a function on each row to calculate the difference of comma separated values such as (237-204). Without the use of external library packages.
Try this except if the data is in a file replace the
readLines
line with something like this:L <- readLines("myfile.csv")
. After that replace the colons with commas usinggsub
and then read the resulting text andtransform
it:giving: