0

I have created a string of code in r to do some analysis. I plan to make these codes in the form of an executable program in Windows. What is the process of doing this? Some of the relevant codes are as follows:

library(dplyr)
library(EnvStats)
library(plotrix)
library(tidyverse)
library(emmeans)
library(multcomp)
library(ggplot2)

fn_G <- function(x){
  replace (replace(x, x > 35 ,  mean (x[x<= 35 ])) ,  x < 5 ,  mean (x[x>= 5 ]))
}

df1 <- df %>%
  group_by(Samples) %>%
  mutate(across(starts_with("GOI"), fn_G)) 

View(df1)

1 Answers1

0

As far as I know, R does not have the capability of run code in form of an executable.

However, you can use the RScript.exe, located in the the "bin" directory within the installation folder of R.

You would save your code as an *.r file and then call RScript from a command window like this:

Path_to_R_installation\bin\x64\RScript.exe < Path_to_your_RCode\your_code.r
smoff
  • 592
  • 5
  • 21