I have one R file with a function:
screen <- read_excel("Template.xlsx", 1)
screen_norm <- function() {
screen <- screen %>%
group_by(Day, Plate) %>%
mutate(Normalization_Mean = mean(Normalization_Control[!is.na(Normalization_Control)]))
return(screen)
}
screen_norm()
data_norm_mean <- screen_norm()
I need to access the dataframe data_norm_mean in another R file. I know how to do it within the same R file but not another.
CodePudding user response:
You can save the object in your original R script
saveRDS(data_norm_mean, file = "my_data.rds")
Then import it in your second R script
readRDS(file = "my_data.rds")
CodePudding user response:
You can source the file which has screen_norm() function in another file where you need the data. If the name of the file is 'file1.R', in another file you can source it and you should have the dataframe.
source('file1.R')
data_norm_mean
