找回密码
 注册
查看: 1830|回复: 0

R语言 sna包 sna-coercion()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-9-30 11:02:03 | 显示全部楼层 |阅读模式
sna-coercion(sna)
sna-coercion()所属R语言包:sna

                                         sna Coercion Functions
                                         SNA转换函数

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

Functions to coerce network data into one form or another; these are generally internal, but may in some cases be helpful to the end user.
函数来强迫网数据转换成一种或另一种形式,这些通常是内部的,但在某些情况下,可能会有所帮助到最终用户。


用法----------Usage----------


as.sociomatrix.sna(x, attrname=NULL, simplify=TRUE, force.bipartite=FALSE)
as.edgelist.sna(x, attrname = NULL, as.digraph = TRUE,
    suppress.diag = FALSE, force.bipartite = FALSE)



参数----------Arguments----------

参数:x
network data in any of several acceptable forms (see below).
在任何若干可接受的形式的网络数据(见下文)。


参数:attrname
if x is a network object, the (optional) edge attribute to be used to obtain edge values.
如果x是network对象,被用来获取边缘值(可选的)边缘属性。


参数:simplify
logical; should output be simplified by collapsing adjacency matrices of identical dimension into adjacency arrays?
逻辑,简化了崩溃的相同尺寸的邻接矩阵,邻接阵列的输出呢?


参数:force.bipartite
logical; should the data be interpreted as bipartite (with rows and columns representing different data modes)?
逻辑;数据应解释为二部(行和列代表不同的数据模式)?


参数:as.digraph
logical; should network objects be coded as digraphs, regardless of object properties?  (Recommended)
逻辑;network对象编码为有向图,无论对象的属性? (推荐)


参数:suppress.diag
logical; should loops be suppressed?
逻辑循环受到抑制?


Details

详细信息----------Details----------

The sna coercion functions are normally called internally within user-level sna functions to convert network data from various supported forms into a format usable by the function in question.  With few (if any) exceptions, formats acceptable by these functions should be usable with any user-level function in the sna library.
sna转换函数通常被称为内部用户级sna函数问题中的函数能够使用的格式转换网络数据从各种支持的形式。很少(如果有的话)的异常,通过这些函数可以接受的格式应该是可与任何用户级的功能sna库。

as.sociomatrix.sna takes one or more input graphs, and returns them in adjacency matrix (and/or array) form.  If simplify==TRUE, consolidation of matrices having the same dimensions into adjacency arrays is attempted; otherwise, elements are returned as lists of matrices/arrays.
as.sociomatrix.sna需要一个或多个输入图形,并将它们返回在邻接矩阵(和/或阵列)形式。如果simplify==TRUE,合并到相邻阵列矩阵具有相同尺寸的企图,否则,返回元素的矩阵/数组的列表。

as.edgelist.sna takes one or more input graphs, and returns them in sna edgelist form – i.e., a three-column matrix whose rows represent edges, and whose columns contain (respectively) the sender, receiver, and value of each edge.  (Undirected graphs are generally assumed to be coded as fully mutual digraphs; edges may be listed in any order.)  sna edgelists must also carry an attribute named n indicating the number of vertices in the graph, and may optionally contain the attributes vnames (carrying a vector of vertex names, in order) and/or bipartite (optionally, containing the number of row vertices in a two-mode network).  If the bipartite attribute is present and non-false, vertices whose numbers are less than or equal to the attribute value are taken to belong to the first mode (i.e., row vertices), and those of value greater than the attribute are taken to belong to the second mode (i.e., column vertices).  Note that the bipartite attribute is not strictly necessary to represent two-mode data, and may not be utilized by all sna functions.
as.edgelist.sna需要一个或多个输入图,并返回他们在snaEdgeList,在该列表的形式 - 即,一个三列的矩阵的行代表的边缘,而其列包含()发送器,接收器,和值的每个边缘。 (无向图的一般都被编码为完全相互有向图,边可能会被任意顺序列出。)sna的:edgelists还必须进行属性名为n表示图中的顶点的数量,可任选地包含的属性vnames(携带一个向量的顶点的名称,按顺序)和/或bipartite(任选地,含有所指定数目的行顶点中的两个模式的网络)。如果二部的属性是本非false,顶点属性值小于或等于其号码被视为属于第一模式(即,行顶点),并且这些值大于该属性属于到第二模式(即,列顶点)。请注意bipartite属性是不是绝对必要的,代表两个模式数据,并可能无法利用所有sna函数。

Data for sna coercion routines may currently consist of any combination of standard or sparse (via SparseM) adjacency matrices or arrays, network objects, or sna edgelists.  If multiple items are given, they must be contained within a list.  Where adjacency arrays are specified, they must be in three-dimensional form, with dimensions given in graph/sender/receiver order.  Matrices or arrays having different numbers of rows and columns are taken to be two-mode adjacency structures, and are treated accordingly; setting force.bipartite will cause square matrices to be treated in similar fashion.  In the case of network or sna edgelist matrices, bipartition information is normally read from the object's internal properties.
sna的胁迫例程的数据,目前包括任何标准或稀疏(通过SparseM)邻接矩阵或数组,network对象,或snaedgelists的组合。如果有多个项目,它们就必须被包含内list。邻接数组指定在哪里,他们必须以三维的形式,尺寸图/发送/接收命令。具有不同数量的行和列的矩阵或数组采取两个模式邻接结构,并相应地处理;设置force.bipartite将导致以类似的方式被处理的方阵。的情况下,network或sna EdgeList都矩阵,二分法的信息通常是从该对象的内部属性读取。


值----------Value----------

An adjacency or edgelist structure, or a list thereof.
的邻接或EdgeList,在该列表中的结构,或它们的列表。


注意----------Note----------

For large, sparse graphs, edgelists can be dramatically more efficient than adjacency matrices.  Where such savings can be realized, sna package functions usually employ sna edgelists as their “native” format (coercing input data with as.edgelist.sna as needed).  For this reason, users of large graphs can often obtain considerable savings by storing data in edgelist form, and passing edgelists (rather than adjacency matrices) to sna functions.
对于大型,稀疏图,的edgelists会更加效率比邻接矩阵。如可节约sna包功能通常采用sna的edgelists为他们的“原生”格式(强迫输入数据,用as.edgelist.sna根据需要)。出于这个原因,大的图形的用户可以经常通过存储EdgeList,在该列表中的数据形式,并通过edgelists(而非邻接矩阵)sna函数获得相当大的节约。

The maximum size of adjacency matrices and edgelists depends upon R's vector allocation limits.  On a 64-bit platform, these limits are currently around 4.6e4 vertices (adjacency case) or 7.1e8 edges (edgelist case).  The number of vertices in the edgelist case is effectively unlimited (and can technically be infinite), although not all functions will handle such objects gracefully.  (Use of vertex names will limit the number of edgelist vertices to around 2e9.)
取决于“R的矢量分配限制的最大尺寸邻接矩阵和EdgeLists的。在64位平台上,这些限制是目前周围4.6e4的顶点(邻接的情况下)或7.1e8的边缘(EdgeList,在该列表中的情况下)。的EdgeList都案的顶点的数量实际上是无限的(可以在技术上是无限的),虽然并非所有的功能将处理对象的优雅。 (顶点名称的使用将限制EdgeList,在该列表中的顶点周围2E9)。


(作者)----------Author(s)----------


Carter T. Butts <a href="mailto:buttsc@uci.edu">buttsc@uci.edu</a>




参见----------See Also----------

sna, network
sna,network


实例----------Examples----------


#Produce some random data, and transform it[产生一些随机的数据,并将其转换]
g<-rgraph(5)
g
all(g==as.sociomatrix.sna(g))     #TRUE[TRUE]
as.edgelist.sna(g)                #View in edgelist form[在EdgeList,在该列表的形式查看]
as.edgelist.sna(list(g,g))        #Double the fun[双倍的乐趣]
g2&lt;-as.sociomatrix.sna(list(g,g)) #Will simplify to an array[将简化到一个数组中]
dim(g2)
g3&lt;-as.sociomatrix.sna(list(g,g),simplify=FALSE)  #Do not simplify[不要简化]
g3                                                #Now a list[现在的列表]

#We can also build edgelists from scratch...[我们也可以从头开始建立edgelists,...]
n<-6
edges<-rbind(
c(1,2,1),
c(2,1,2),
c(1,3,1),
c(1,5,2),
c(4,5,1),
c(5,4,1)
)
attr(edges,"n")<-n
attr(edges,"vnames")<-letters[1:n]
gplot(edges,displaylabels=TRUE)               #Plot the graph[绘制图形]
as.sociomatrix.sna(edges)                     #Show in matrix form[显示的矩阵形式]

#Two-mode data works similarly[双模式数据的工作方式类似于]
n<-6
edges<-rbind(
c(1,4,1),
c(1,5,2),
c(4,1,1),
c(5,1,2),
c(2,5,1),
c(5,2,1),
c(3,5,1),
c(3,6,2),
c(6,3,2)
)
attr(edges,"n")<-n
attr(edges,"vnames")<-c(letters[1:3],LETTERS[4:6])
attr(edges,"bipartite")<-3
edges
gplot(edges,displaylabels=TRUE,gmode="twomode")  #Plot[图]
as.sociomatrix.sna(edges)                        #Convert to matrix[转换为矩阵]


转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-6-7 08:14 , Processed in 0.021413 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表