Migrate odin code. This function takes a path to existing odin code and writes out migrated code to a new file. It is possible that no code will be migrated, in which case the written contents will be identical to those read.
Examples
# A file 'path' contains odin code using old features:
writeLines(readLines(path))
#> initial(x) <- 0
#> deriv(x) <- x * r
#> r <- user()
# Migrate this file in place (by overwriting)
odin_migrate(path, path)
#> ℹ Migrating 1 statement
#> ✔ Wrote '/tmp/Rtmp7yRDaI/file1bd01edd9574.R'
writeLines(readLines(path))
#> initial(x) <- 0
#> deriv(x) <- x * r
#> r <- parameter()