Short examples for moving average and cumulative average usig R. Moving average Some alternatives to do moving average, sometimes called running mean or rolling mean. You can use base R, data.table or zoo package. Use function frollmean from data.table package or rollmean from zoo package.
Read MoreError handling
Handling error in R can easily be done with debugger or by activating error options with recover. options(error = recover) Or to activate warning as error with: options(warn = 2) Nevertheless this blog post explain nicely other alternative including the code below that you can put in your .
Read MoreRscript command
Makefile
Updated: 11.10.2022 Here are some references to start using makefile. It makes automation easily by just running make. Nevertheless, some Apps need to be installed if running in Windows. The easiest way to install Apps is to use scoop to install make and additionally with sed.
Read MoreSubset DT
Subsetting data.table can be done using base R subset with S3 Class for data.table object. Alternatively is to use the recode approach as mentioned in StackOverflow. lookup <- list(v1 = 1:3, v2 = letters[5:7]) DT[lookup, on = names(lookup), nomatch = NULL] This will return all columns in DT that match lookup list.
Read More