在R中运行Shell命令脚本(Call shell commands from R)
aaa.R
Args <- commandArgs()
cat("Args[1]=",Args[1],"\n")
cat("Args[2]=",Args[1],"\n")
cat("Args[3]=",Args[3],"\n")
cat("Args[4]=",Args[4],"\n")
cat("Args[5]=",Args[5],"\n")
cat("Args[6]=",Args[6],"\n")
shell_cmd<-paste0("grep -n CHR ",Args[6])
grep_out<-system(shell_cmd, intern = TRUE)
cat(grep_out)
how to run:
/myPathToRscript/Rscript aaa.R bbb.vcf
=============================================
Description
system invokes the OS command specified by command.
Usage
system(command, intern = FALSE,
ignore.stdout = FALSE, ignore.stderr = FALSE,
wait = TRUE, input = NULL, show.output.on.console = TRUE,
minimized = FALSE, invisible = TRUE)
Arguments
command |
the system command to be invoked, as a character string. |
intern |
a logical (not |
ignore.stdout, ignore.stderr |
a logical (not |
wait |
a logical (not |
input |
if a character vector is supplied, this is copied one string per line to a temporary file, and the standard input of |
show.output.on.console, minimized, invisible |
arguments that are accepted on Windows but ignored on this platform, with a warning. |
=============================================
Invoke a System Command, using a Shell
Description
shell runs the command specified by cmd, usually under a shell.
Usage
shell(cmd, shell, flag="/c", intern=FALSE, wait=TRUE,
translate=FALSE, mustWork=FALSE, ...)
Arguments
cmd |
the system command to be invoked, as a string. |
shell |
a string giving the name of the shell to be used, or NULL (no shell). If missing, a suitable shell is chosen: see ‘Details’. |
flag |
the switch to run a command under the shell. If the shell is bash or tcsh the default is changed to "-c". |
intern |
a logical, indicates whether to make the output of the command an R object. |
wait |
should the R interpreter wait for the command to finish? The default is to wait, and the interpreter will always wait if intern = TRUE. |
translate |
If TRUE, "/" in cmd is translated to "\". |
mustWork |
a logical; if TRUE failure to run the command will give an R error. |
REF:
http://astrostatistics.psu.edu/datasets/R/html/base/html/shell.html
https://stat.ethz.ch/R-manual/R-devel/library/base/html/system.html
在R中运行Shell命令脚本(Call shell commands from R)的更多相关文章
- 4.Vim编辑器与Shell命令脚本
第4章 Vim编辑器与Shell命令脚本 章节简述: 本章首先讲解如何使用Vim编辑器来编写.修改文档,然后通过逐个配置主机名称.系统网卡以及Yum软件仓库参数文件等实验,帮助读者加深Vim编辑器中诸 ...
- 《Linux就该这么学》培训笔记_ch04_Vim编辑器与Shell命令脚本
<Linux就该这么学>培训笔记_ch04_Vim编辑器与Shell命令脚本 文章最后会post上书本的笔记照片. 文章主要内容: Vim编辑器 Shell脚本 流程控制语句 if语句 f ...
- 安卓日常开发和逆向中常用的shell命令与非shell命令
简述shell 命令与 非shell命令区别 shell命令不用先adb shell进入界面执行 非shell命令必须要 adb shell进入界面执行 基础非shell命令 1.安装app adb ...
- 怎样在Java中运行Hive命令或HiveQL
这里所说的在Java中运行Hive命令或HiveQL并非指Hive Client通过JDBC的方式连接HiveServer(or HiveServer2)运行查询,而是简单的在部署了HiveServe ...
- Vim编辑器与Shell命令脚本
章节简述: 本章节将教给您如何使用Vim编辑器来编写文档.配置主机名称.网卡参数以及yum仓库 ,熟练使用各个模式和命令快捷键. 我们可以通过Vim编辑器将Linux命令放入合适的逻辑测试语句(if. ...
- Linux 就该这么学 CH04 VIM编辑器和Shell命令脚本
0 概述 1 Vim编辑器 在linux 中一切都是文件,而配置一个服务就是修改其配置文件的参数. vim 编辑器有三种模式:命令模式,末行模式和编辑模式. 命令模式:控制光标移动,对文件进行操作. ...
- 第4章 Vim编辑器与Shell命令脚本
章节简述: 本章节将教给您如何使用Vim编辑器来编写文档.配置主机名称.网卡参数以及yum仓库 ,熟练使用各个模式和命令快捷键. 我们可以通过Vim编辑器将Linux命令放入合适的逻辑测试语句(if. ...
- shell及脚本2——shell 环境及命令
一.快捷键.通配符.特殊符号 1. 快捷键 CTRL+C:终止目前的命令 CTRL+D:输入结束,EOF CTRL+M:ENTER CTRL+S:暂停屏幕输出 CTRL+Q:恢复屏幕输出 CTRL+U ...
- R 中的哪些命令或者包让你相见恨晚?--转载知乎
https://www.zhihu.com/question/24501195 节选: 看了这么多答案,觉得 Hadley Wickhamhad.co.nz 在R使用者的地位好高啊.其实我也觉得Had ...
- IDEA清空控制台以及Java中运行cmd命令实现清屏操作
IDEA中清空控制台方法 在网上有看到各种的实现方法,比如: Runtime.getRuntime().exec("cls"); 或者: public static void cl ...
随机推荐
- Kubernetes的系统架构与设计理念
Kubernetes与云原生应用简介 随着Docker技术的发展和广泛流行,云原生应用和容器调度管理系统也成为IT领域大热的词汇.事实上,云原生应用的思想,在Docker技术火爆之前,已经由云计算技术 ...
- Atitti 住房部建设指南
Atitti 住房部建设指南 1. 住房部建设的重要意义2 2. 房屋选址::首要核心要素,环境环境环境!!!2 2.1. 价格要素与地段..2 2.2. 与工作地距离,一般是半小时到一个半小时为好3 ...
- Atitit http2 新特性
Atitit http2 新特性 性能 安全与push Multipexing 多路复用 每个 Frame Header 都有一个 Stream ID 就是被用于实现该特性.每次请求/响应使用不同的 ...
- SPI和RAM IP核
学习目的: (1) 熟悉SPI接口和它的读写时序: (2) 复习Verilog仿真语句中的$readmemb命令和$display命令: (3) 掌握SPI接口写时序操作的硬件语言描述流程(本例仅以写 ...
- django——文件上传_分页_ajax_富文本_celery
上传文件 概述 当Django在处理文件上传时,文件的数据被存储在request.FILES属性中 FILES只有在请求的方法为POST且提交的form表单带有enctype="multip ...
- C#.NET中遍历指定目录下的文件(及所有子目录及子目录里更深层目录里的文件)
//遍历一个目录下所有的文件列表,代码实例 DirectoryInfo dir = new DirectoryInfo(folderName);var list = GetAll(dir); /// ...
- FLINK 设计文档
https://cwiki.apache.org/confluence/display/FLINK/Apache+Flink+Home https://cwiki.apache.org/conflue ...
- Frick'ing Terrain Mesh!
CDLOD地形的实现方法步骤: 1.实现完全二叉树结构的创建2.实现完全四叉树的视锥裁剪与LOD选择(包括节点的部分选择功能)3.使用forward rendering, 实现已选择四叉树节点的普通渲 ...
- #define SIG_DFL ((void(*)(int))0)
在linux内的信号处理函数中,有#define SIG_DFL ((void(*)(int))0)和#define SIG_IGN ((void(*)(int))1)两个宏定义.要理解这两个宏定义, ...
- Leetcode:Interleaving String 解题报告
Interleaving StringGiven s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. For ...