gWidgets packaging

I've made a GUI for an R simulation and bound it to a function in it's own .R file in the R folder of the packages directory: gui <- function(){ mainwin <- gwindow("speEaR - Simulation of Plant-pathogen Effectors in Evolutionary Arms Races") introtext <- glabel("speEaR - Simulation of Plant-pathogen Effectors in Evolutionary Arms Races, version 1.1 This package is maintain

gWidgets包装

我为R模拟做了一个GUI,并将其绑定到packages目录的R文件夹中它自己的.R文件中的一个函数中: gui <- function(){ mainwin <- gwindow("speEaR - Simulation of Plant-pathogen Effectors in Evolutionary Arms Races") introtext <- glabel("speEaR - Simulation of Plant-pathogen Effectors in Evolutionary Arms Races, version 1.1 This package is maintained by Ben ward. <b.ward@uea.ac.uk>", con

How to find out which package version is loaded in R?

I am in a process of figuring out how to use my university cluster. It has 2 versions of R installed. System wide R 2.11 (Debian 6.0) and R 2.14.2 in non-standard location. I am trying to use MPI together with snow. The code I am trying to run is the following library(snow) library(Rmpi) cl <- makeMPIcluster(mpi.universe.size()-1) stopCluster(cl) mpi.quit() It works without the problems

如何找出在R中加载哪个软件包版本?

我正在研究如何使用我的大学集群。 它有2个版本的R安装。 系统范围R 2.11(Debian 6.0)和R 2.14.2非标准位置。 我正在尝试将MPI与雪一起使用。 我试图运行的代码如下 library(snow) library(Rmpi) cl <- makeMPIcluster(mpi.universe.size()-1) stopCluster(cl) mpi.quit() 它在R 2.11中没有问题。 (我用mpirun -H localhost,n1,n2,n3,n4 -n 1 R --slave -f code.R启动脚本mpirun -H localhost,n1,n2,n3,n4 -n 1 R

Collate field in package Description

I apologize as I know that this answer is likely in the manuals for writing an R package but in my reading and looking at other package's Collate fields I can't figure out 100% what this field is for. In plain language (mine is English) what does the Collate field in the Description file of a package do? What would one want to put there? I think it comes from a time and situation when

在包中描述字段

我很抱歉,因为我知道这个答案很可能出现在编写R包的手册中,但是在我阅读并查看其他包的Collat​​e字段时,我无法弄清楚这个字段是100%的。 用简单的语言(我的是英文)包的描述文件中的Collat​​e字段是做什么的? 人们想要放在那里? 我认为它来自时间和情况, R/目录中的文件的采购顺序(而不是字典默认值)仍然很重要。 .onLoad()函数通常位于名为zzz.R的文件中的zzz.R 。 对于它的价值,我的软件包中没有一个使用DES

How to drop columns in a nested data frame in R?

As i know there are different ways to drop a column of a data frame in R like Drop data frame columns by name How to drop columns by name in a data frame Remove an entire column from a data.frame in R Now My question: I have a data frame say df having 400 plus files in the form of nested data frame . df [[1]] SignalIntensity SNR 1 109 6.1823089314

如何删除R中的嵌套数据框中的列?

据我所知,有不同的方法可以像R一样drop一column data frame 按名称删除数据框列 如何在数据框中按名称删除列 从R中的data.frame中删除整列 现在我的问题:我有一个数据帧,说df有400 plus nested data frame形式的文件。 df [[1]] SignalIntensity SNR 1 109 6.1823089314 0.8453576915 2 110 10.1727771385 4.3837077591 3 111 7.2922746927 1.072

Extracting specific columns from a data frame

I have an R data frame with 6 columns, and I want to create a new dataframe that only has three of the columns. Assuming my data frame is df , and I want to extract columns A , B , and E , this is the only command I can figure out: data.frame(df$A,df$B,df$E) Is there a more compact way of doing this? 就在这里。 # data for reproducible example # (and to avoid confusion from trying to subset

从数据框中提取特定的列

我有一个有6列的R数据框,我想创建一个只有三列的新数据框。 假设我的数据框是df ,并且我想提取列A , B和E ,这是我能弄清楚的唯一命令: data.frame(df$A,df$B,df$E) 有没有更紧凑的方式来做到这一点? 就在这里。 # data for reproducible example # (and to avoid confusion from trying to subset `stats::df`) df <- setNames(data.frame(as.list(1:5)), LETTERS[1:5]) # subset df[,c("A","B","E")] 这是subset(

How to drop columns by name in a data frame

I have a large data set and I would like to read specific columns or drop all the others. data <- read.dta("file.dta") I select the columns that I'm not interested in: var.out <- names(data)[!names(data) %in% c("iden", "name", "x_serv", "m_serv")] and than I'd like to do something like: for(i in 1:length(var.out)) { paste("data$", var.out[i], sep="") <- NULL } to drop al

如何在数据框中按名称删除列

我有一个大的数据集,我想阅读特定的列或删除所有其他的。 data <- read.dta("file.dta") 我选择了我不感兴趣的列: var.out <- names(data)[!names(data) %in% c("iden", "name", "x_serv", "m_serv")] 并且比我想要做的事情如: for(i in 1:length(var.out)) { paste("data$", var.out[i], sep="") <- NULL } 删除所有不需要的列。 这是最佳解决方案吗? 您应该使用索引或subset函数。 例如 : R> df

Split a column of a data frame to multiple columns

I'd like to take data of the form before = data.frame(attr = c(1,30,4,6), type=c('foo_and_bar','foo_and_bar_2')) attr type 1 1 foo_and_bar 2 30 foo_and_bar_2 3 4 foo_and_bar 4 6 foo_and_bar_2 and use split() on the column " type " from above to get something like this: attr type_1 type_2 1 1 foo bar 2 30 foo bar_2 3 4 foo bar 4

将数据框的列拆分为多个列

我想收集表格的数据 before = data.frame(attr = c(1,30,4,6), type=c('foo_and_bar','foo_and_bar_2')) attr type 1 1 foo_and_bar 2 30 foo_and_bar_2 3 4 foo_and_bar 4 6 foo_and_bar_2 并在上面的“ type ”列上使用split()来得到如下所示的结果: attr type_1 type_2 1 1 foo bar 2 30 foo bar_2 3 4 foo bar 4 6 foo bar_2 我想出了一些令人难以置信的复杂

R list to data frame

I have a nested list of data. Its length is 132 and each item is a list of length 20. Is there a quick way to convert this structure into a data frame that has 132 rows and 20 columns of data? I am new to R, so I figure there is probably an easy way to do this. I searched here on Stack Overflow and couldn't find a similar question, so I apologize if I missed it. Some sample data: l <

R列表到数据帧

我有一个嵌套的数据列表。 它的长度是132,每个项目是一个长度为20的列表。有没有一种快速的方法将这种结构转换成一个有132行和20列数据的数据框? 我是R新手,所以我想这可能是一个简单的方法。 我在这里搜索了Stack Overflow,找不到类似的问题,所以我很抱歉如果我错过了。 一些示例数据: l <- replicate( 132, list(sample(letters, 20)), simplify = FALSE ) 假设你的列表被列为l : df <- data.frame(

safe version of subset

As subset() manual states: Warning : This is a convenience function intended for use interactively I learned from this great article not only the secret behind this warning, but a good understanding of substitute() , match.call() , eval() , quote() , ‍ call , promise and other related R subjects, that are a little bit complicated. Now I understand what's the warning above for. A super-

安全版本的子集

作为subset()手册指出: 警告 :这是一个旨在交互使用的便利功能 我从这篇大文章,不仅这样的警告背后的秘密,但有很好的理解了解到substitute() match.call() eval() , quote() call , promise和其他相关的研究课题,是一个有点复杂。 现在我明白了上面的警告是什么。 subset()一个超简单实现可以如下所示: subset = function(x, condition) x[eval(substitute(condition), envir=x),] 虽然subset(mtcars, cyl==4)

How to convert multiple columns in R

I have a data frame which is retrieved from a csv file. I need to get the column types of some columns and apply these types to another data.frame's corresponding columns. For example, after certain steps, the data.frame from the csv is called Table1. header <- names(Table1) "Acct" "Tran" class(Table1$Acct) "character" class(Table1$Tran) "character" Then I need to convert Table2's

如何转换R中的多个列

我有一个从csv文件中检索的数据框。 我需要获取某些列的列类型,并将这些类型应用于另一个data.frame的相应列。 例如,在某些步骤之后,来自csv的d​​ata.frame被称为Table1。 header <- names(Table1) "Acct" "Tran" class(Table1$Acct) "character" class(Table1$Tran) "character" 然后我需要将Table2的相应“Acct”和“Tran”列转换为字符。 我试过了 class(Table1[header]) [1] "data.frame" class(Table1$header) [1]