seqformat(TraMineR)
seqformat()所属R语言包:TraMineR
Conversion between sequence formats
序列格式之间的转换
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Convert a sequence data set from one format to another.
转换序列数据从一种格式转换到另一个。
用法----------Usage----------
seqformat(data, var=NULL, id=NULL,
from, to, compressed=FALSE,
nrep=NULL, tevent, stsep=NULL, covar=NULL,
SPS.in=list(xfix="()", sdsep=","),
SPS.out=list(xfix="()", sdsep=","),
begin=NULL, end=NULL, status=NULL,
process=TRUE, pdata=NULL, pvar=NULL,
limit=100, overwrite=TRUE,
fillblanks=NULL, tmin=NULL, tmax=NULL)
参数----------Arguments----------
参数:data
a data frame or matrix containing sequence data.
一个数据框或含有序列数据的矩阵。
参数:var
the list of columns containing the sequences. Default is NULL, i.e. all the columns. Whether the sequences are in the compressed (character strings) or extended format is automatically detected by counting the number of columns.
列表中包含序列的列。默认是NULL,即所有列。无论是在序列(字符串)的压缩或扩展格式被自动检测到计数的列数。
参数:id
column containing the identification numbers for the sequences. When using SPELL format as input, this identification number is mandatory, in order to identify all spells belonging to each individual in the data set.
列包含的识别号码的序列。当使用SPELL格式作为输入,该识别号码是强制性的,以确定所有属于数据集合中的每个个体的咒语。
参数:from
format of the original data. Available formats are: "STS", "SPS", "SPELL". If data is a sequence object, format is automatically set to "STS".
的原始数据格式。可用的格式有:"STS","SPS","SPELL"。如果data是一个序列对象,格式会自动设置为"STS"。
参数:to
format of the output data. Available formats are: "STS", "SPS", "SRS", "DSS", "TSE".
的输出数据格式。可用的格式有:"STS","SPS","SRS","DSS","TSE"。
参数:compressed
if TRUE and output format is one of "STS", "SPS" or "DSS", the output sequences are compressed into character strings
如果TRUE和输出格式是"STS","SPS"或"DSS",输出序列被压缩成字符串
参数:nrep
number of previous states replicated, for the "SRS" format
一些以前的状态复制,"SRS"格式
参数:tevent
when converting to time-stamped-event ("TSE") format, a matrix of size d * d where d is the number of distinct states appearing in the sequences must be given. In this matrix, the cell (i,j) contains all events associated with a transition from state i to state j.
当转换为时间标记的事件("TSE")格式,矩阵的大小d * d其中d是必须给予不同的状态出现在序列的数量。在这个矩阵中中,单元(i,j)包含所有事件与过渡状态i声明j。
参数:stsep
the character used as separator in the original data if input format is a vector of character strings. If NULL (default value), the seqfcheck function is called for detecting automatically a separator among "-" and ":". Other separators must be specified explicitly.
使用的字符作为分隔符,在原始数据中,如果输入格式是一个字符串向量。如果NULL(默认值),seqfcheck功能被称为自动检测分隔符“ - ”和“:”。必须明确指定其他分隔符。
参数:covar
the list of columns containing associated covariates to be included in the output data frame. If to="SRS" is chosen, the covariates are replicated across each row. Default is NULL.
相关的协变量的列表列包含被包含在输出数据框。如果="SRS"选择,每一行的协变量之间进行复制。默认是NULL。
参数:SPS.in
a list with the characters used as prefix/suffix and state/duration separator for each state duration couple if input data contains sequences in SPS format. Set the xfix element of the list to "" if there are no pre-suf-fixes.
如果输入数据包含序列SPS格式的字符作为前缀/后缀和状态/持续时间分离状态的持续时间为每对夫妇的列表。设置了xfix元素的列表""前如果没有足够修复。
参数:SPS.out
a list with the characters used as prefix/suffix and state/duration separator to be used for each state duration couple if output is in SPS format. Set the xfix element of the list to "" if there are no pre-suf-fixes.
一个列表,所使用的字符作为前缀/后缀和状态/持续时间分隔符,用于每个状态的持续时间夫妻如果输出是SPS格式,。设置了xfix元素的列表""前如果没有足够修复。
参数:begin
when converting from SPELL, the column with the beginning position of the spell
从SPELL转换时,列的开始位置的法术
参数:end
when converting from SPELL, the column with the end position of the spell
转换时,SPELL,列的结束位置的法术
参数:status
when converting from SPELL, the column with the status
SPELL,列的状态转换时,
参数:process
If TRUE (default) when converting from SPELL, sequences are created on a process time axis. If set to FALSE, they are created on a calendar time axis.
如果TRUE(默认)转换时,SPELL,序列上创建的处理时间轴。如果设置为FALSE,它们被创建在日历上时间轴。
参数:pdata
when converting from SPELL and process=TRUE, either NULL, "auto" or the name of the data frame containing the individual 'birth' time, that is, the entering time from which the process time will be computed. If set to NULL (default), the starting and ending time of each spell are supposed to be ages. If set to "auto", ages are computed using the starting time of the first spell of each individual as her/his birth date. If external birth dates are provided, the data must contain two columns: an id to match the birth time with SPELL data and a 'birth' time.
转换时,SPELL和process=TRUE是NULL,"auto"的名称的数据框,其中包含个人的出生的时间,也就是进入的时间将被计算的处理时间。如果设置为NULL(默认),每个法术的开始和结束的时间都应该是年龄。如果设置为"auto",年龄计算的起始时间的第一个法术的每一个人他/她的出生日期。如果外部的出生日期,数据必须包含两列:id的相匹配的诞生时间SPELL数据和“birth时间。
参数:pvar
names or numbers of the columns containing the individual identification number and the 'birth' time in pdata.
的名字或数字的列中包含的个体识别号码和“出生”时间在pdata。
参数:limit
when converting from SPELL, size of the resulting dataframe when creating age sequences (by default goes from age 1 to age 100)
转换时,SPELL,年龄序列(默认情况下,当数据框的大小,从1岁到100岁)
参数:overwrite
when converting from SPELL, if overwrite is set to TRUE, the most recent episode overwrites the older one if they overlap each other. If set to FALSE, the most recent episode starts from the end of the previous one.
转换时,SPELL如果overwrite设置为TRUE,最近的事件将覆盖旧的,如果互相重叠。如果设置为FALSE,最近的图开始结束的前一个。
参数:fillblanks
when converting from SPELL, if fillblanks is not NULL, gaps between episodes are filled with any character given as argument.
转换时,SPELL,fillblanks是不是NULL都充满了任何字符作为参数给定,图之间的差距。
参数:tmin
when converting from SPELL, if sequences are to be defined on a calendar time axis, it defines the starting time of the axis. If set to NULL, the minimum time is taken from the 'begin' column in the data.
转换从SPELL时,如果序列是要的日历的时间轴上定义的,它的轴定义的起始时间。如果设置为NULL,在最短的时间从“开始”列中的数据。
参数:tmax
when converting from SPELL, if year sequences are wanted, defines the ending year of the dataframe. If set to NULL, it is guessed from the data (not so accurately!). </table>
转换时,SPELL,如果今年序列的希望,定义的数据框的收尾年。如果设置为NULL,它是从数据(不那么准确!)猜测。 </ TABLE>
Details
详细信息----------Details----------
The seqformat function is used to convert data from one format to another. The input data is first converted into the STS format and then converted to the output format. Depending on input and output formats, some information can be lost in the conversion process. The output is a matrix, NOT a sequence object to be passed to TraMineR functions for plotting and mining sequences (use the seqdef function for that). See <CITE>Gabadinho et al. (2009)</CITE> and <CITE>Ritschard et al. (2009)</CITE> for more details on longitudinal data formats and converting between them.
seqformat功能是用来将数据转换为另一种格式。输入数据首先转换到STS格式,然后转换为输出格式。根据输入和输出格式,可能会丢失一些信息在转换过程中。输出是一个矩阵,而不是一个序列对象进行策划和挖掘序列(使用seqdef的功能,)传递到特拉米纳功能。请参阅<CITE> Gabadinho等。 (2009年)</ CITE>和<CITE>时Ritschard等。 (2009年)</ CITE>纵向数据格式的详细信息,以及它们之间的转换。
值----------Value----------
a data frame
一个数据框
参考文献----------References----------
(2009). Mining Sequence Data in <code>R</code> with the <code>TraMineR</code> package: A user's guide. Department of Econometrics and Laboratory of Demography, University of Geneva.
between various sequence representations. in Ras, Z. & Dardzinska, A. (ed.) Advances in Data Management, Springer, 2009, 223,
参见----------See Also----------
seqdef
seqdef
实例----------Examples----------
## Converting sequences into SPS format[#SPS格式转换序列为]
data(actcal)
actcal.SPS.A <- seqformat(actcal,13:24, from="STS", to="SPS")
head(actcal.SPS.A)
## SPS (compressed) format with no prefix/suffix "/" as state/duration separator[#SPS(压缩)格式前缀/后缀“/”状态/持续时间分离器]
actcal.SPS.B <- seqformat(actcal,13:24,
from="STS", to="SPS", compressed=TRUE,
SPS.out=list(xfix="", sdsep="/"))
head(actcal.SPS.B)
## Converting sequences into DSS (compressed) format[#转换成DSS(压缩)格式的序列]
actcal.DSS <- seqformat(actcal,13:24,
from="STS", to="DSS", compressed=TRUE)
head(actcal.DSS)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|