簡體   English   中英

如何將推算數據從 R 腳本發送到另一個腳本

[英]How to send imputed data from R script to another script

我制作了一個腳本,用於估算文件中丟失的數據(NA),但我想從此腳本 my_code 將此估算數據發送到另一個 R.script:

library(randomForest) #We need to load the “randomForest” package in order to use its functions
path.name = "D:/Courses/Bioinformatics Diploma/Statistical Analysis and Visualization/Assignments/Assignment 1/Assignment_01_Data.csv"
GE_Data_Modification = read.table(path.name, sep = ',', header = T, row.names = 1)
GE_Data_Modification = as.data.frame(t(GE_Data_Modification)) #Transposed data to compute column median
GE_Data_Modification = na.roughfix(GE_Data_Modification)#Impute the data through the median of columns
GE_Data_Modification = as.data.frame(t(GE_Data_Modification)) #Return to the original layout of the data

我想將結果發送到另一個名為 GE_Data_Normalization.R 的腳本

我們可以通過將下面的行放在第二個腳本的頂部來將第一個腳本source到第二個腳本

#GE_Data_Normalization.R
source("path/to/your/firstscript.R")
message("Number of rows of GE_Data_Modification")
message(nrow(GE_Data_Modification))
# code start from second script
....
...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM