I already read the tutorial about create the new package in R. I can use my custom function after clean and rebuild button in Rstudio. Now I want to create custom operation like %>%
in the magrittr pacakge, so I define the function blow in the function.r
, I want my +
function can paste two string like python.
`+` = function(x, y){
if( is.character(x) & is.character(y) ){
return( paste0(x, y) )
}else{
`+` <- base::`+`
return( x + y )
}
}
When I clean and rebuild, I can not find this function in my package, also can not use this function.
But it successful by using the source("function.r")
to call the function.
How do I create the operation function in my package like magrittr pacakge?
Here is my package folder blow: https://drive.google.com/file/d/1Jse3qamEg_wsYLrZDd-nekGbqPMi8f76/view?usp=sharing
Thanks.