Execute functions in R from your phone. This will require an open R session connected to your phone. Using this function, you can specify the functions that R will execute on your demand.

Foo_Bot(Bot_Name = NULL, Info_Loc = NULL, Token = NULL, Function_List,
  LoadMessage = "\nConnection established with R\n", KillR = TRUE,
  KillCPU = FALSE)

Arguments

Bot_Name

Name of the bot to do the sending.

Info_Loc

Where the RDS file with your needed bot info is saved. Defaults to path.expand("~")

Token

Token of your bot if not using the saved file call from Rbot::Add_Bot()

Function_List

Function_List containing for each function: The function to be called, the call handle, as well as the message sent to Telegram.

LoadMessage

What to display on your phone when this call is initialised

KillR

Add option to kill R from your phone. Default to TRUE

KillCPU

Add option to turn off your computer completely, no questions asked. Default to FALSE. Useful if working e.g. on a public CPU that you want to log out from remotely.

Value

Switches R on to listen for Bot

Examples

# NOT RUN {
# Create function list to fill with your commands.
# Each function needs a Function, Call and Message. You will be alerted if one is missing.
Function_List <- list()
First_Foo <- function(){
x <- 10
y <- 20
print(x*y)
message("....Message 1 executed....")

}

Function_List$Foo1 <-
list(Function = First_Foo,
Call = "F1",  # How to call your function from Telegram
Message = "First function executed. This function sources the data fetch.")

Second_Foo <- function(){

x <- 100
y <- 20
print(x* y / 1000)
message("....Message 2 executed....")
}

Function_List$Foo2 <-
list(Function = Second_Foo,
       Call = "F2",  # How to call your function from Telegram
       Message = "Report is now being built.")

 Bot_Name <- "MyBot"
 Foo_Bot(Bot_Name = Bot_Name, Function_List = Function_List, LoadMessage = "My connection with R" )

# }