Open yabellini opened 1 week ago
Some thoughts.
Currently we do not parse the code at all. To parse it and differentiate comments from code, we'd need to use a code parser (base R + xmlparsedata would allow us to use XPath; treesitter).
In code comments how would we escape code. For instance we don't want to translate variable names, package names, etc.
At the moment because we do not translate code comments, one would obtain better results by extracting/repeating the ideas of the code comments in text around the code chunks.
In the code below we use the packages tidyverse (for dplyr functions and the pipe), rio (for importing data), here (for easy file referencing) and cleanepi.
```r
# Load packages
library(tidyverse) # for {dplyr} functions and the pipe %>%
library(rio) # for importing data
library(here) # for easy file referencing
library(cleanepi)
Sometimes, we have code examples with comments explaining the code. It would be nice to be able to translate those comments.
Example:
Original:
Translated to Spanish: