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

R语言 semTools包 splitSample()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-9-30 00:46:58 | 显示全部楼层 |阅读模式
splitSample(semTools)
splitSample()所属R语言包:semTools

                                         Randomly Split a Data Set into Halves
                                         随机分割成两半的数据集

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

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

This function randomly splits a data set into two halves, and saves the resulting data sets to the same folder as the original.
此功能随机将一个数据集分为两部分,产生的数据集保存到同一文件夹中原来的。


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


splitSample(dataset,path="default", div=2, type="default", name="splitSample")



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

参数:dataset
The original data set to be divided. Can be a file path to a .csv or .dat file (headers will automatically be detected) or an R object (matrix or dataframe). (Windows users: file path must be specified using FORWARD SLASHES ONLY.)
的原始数据集进行划分。可以的。csv的文件路径。DAT文件(头会自动检测)或的R对象(矩阵或数据框)。 (Windows用户必须指定文件的路径,只使用正斜杠)。


参数:path
File path to folder for output data sets. NOT REQUIRED if dataset is a filename. Specify ONLY if dataset is an R object, or desired output folder is not that of original data set. If path is specified as "object", output data sets will be returned as a list, and not saved to hard drive.  
输出数据集文件夹中的文件路径。如果不要求数据集是一个文件名。只有当指定数据集是一个R对象,或所需的输出文件夹是不是原始数据集。如果路径被指定为“对象”,将输出数据集返回的列表中,而不是保存到硬盘驱动器。


参数:div
Number of output data sets. NOT REQUIRED if default, 2 halves.        
的输出数据集的数量。如果不要求默认情况下,两半。


参数:type
Output file format ("dat" or "csv"). NOT REQUIRED unless desired output formatting differs from that of input, or dataset is an R object and csv formatting is desired.        
输出文件格式(DAT“或”CSV“)。不需要,除非输入所需的输出格式不同,或数据集是R对象和csv格式所需。


参数:name
Output file name. NOT REQUIRED unless desired output name differs from that of input, or input dataset is an R object. (If input is an R object and name is not specified, name will be "splitSample".)        
输出文件名。不需要,除非所需的输出输入名称不同,或输入数据集是R对象。 (如果输入是一个R对象和未指定名称,名称将是“splitSample”)。


Details

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

This function randomly orders the rows of a data set, divides the data set into two halves, and saves the halves to the same folder as the original data set, preserving the original formatting. Data set type (.csv or .dat) and formatting (headers) are automatically detected, and output data sets will preserve input type and formatting unless specified otherwise. Input can be in the form of a file path (.dat or .csv), or an R object (matrix or dataframe). If input is an R object and path is default, output data sets will be returned as a list object.  
随机对行进行排序的数据集,此功能将数据分为两半,并节省了半原始数据集相同的文件夹,保留原来的格式。自动检测,数据集类型(csv或。DAT)格式(头),除另有指明外,将保存输入输出数据集类型和格式。输入可以是一个文件路径(dat或的。csv),或R对象(矩阵或数据框)中的形式。如果输入是一个R对象和路径默认情况下,输出数据集将返回一个列表对象。


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


参数:dataL
List of output data sets. ONLY IF dataset is an R object and path is default. Otherwise, output will saved to hard drive with the same formatting as input.
输出的数据集的列表。 ONLY IF数据集是R对象和路径是默认的。否则,输出将保存到硬盘驱动器相同的格式输入。


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



Corbin Quick (University of Kansas; <a href="mailto:corbinq@ku.edu">corbinq@ku.edu</a>)




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


#### Input is .dat file[###输入dat文件。]
#splitSample("C:/Users/Default/Desktop/MYDATA.dat")[splitSample(“C :/用户/预设/桌面/ MYDATA.dat的”)]
#### Output saved to "C:/Users/Default/Desktop/" in .dat format[###输出保存到“C :/用户/预设/桌面/”中。dat格式]
#### Names are "MYDATA_s1.dat" and "MYDATA_s2.dat"[###名称是“MYDATA_s1.dat的”和“MYDATA_s2.dat”]

#### Input is R object[###的输入是R对象]
##Split C02 dataset from the datasets package[#分割C02数据集的数据集包]
library(datasets)
splitMyData <- splitSample(CO2, path="object")
summary(splitMyData[[1]])
summary(splitMyData[[2]])
#### Output object splitMyData becomes list of output data sets[###的输出对象splitMyData成为输出数据集列表]

#### Input is .dat file in "C:/" folder[###输入“C :/”文件夹中。dat文件]
#splitSample("C:/testdata.dat", path = "C:/Users/Default/Desktop/", type = "csv")[splitSample(“C :/ testdata.dat”路径=“C :/用户/预设/桌面/”,“CSV”)]
#### Output saved to "C:/Users/Default/Desktop/" in .csv format[###。csv格式输出保存到“C :/用户/预设/桌面/”]
#### Names are "testdata_s1.csv" and "testdata_s2.csv"[###的名称“testdata_s1.csv”和“testdata_s2.csv的”]

#### Input is R object[###的输入是R对象]
#splitSample(myData, path = "C:/Users/Default/Desktop/", name = "splitdata")[splitSample(MYDATA,路径=“C :/用户/预设/桌面/”,名称=“splitdata”)]
#### Output saved to "C:/Users/Default/Desktop/" in .dat format[###输出保存到“C :/用户/预设/桌面/”中。dat格式]
#### Names are "splitdata_s1.dat" and "splitdata_s2.dat"[###名称是“splitdata_s1.dat的”和“splitdata_s2.dat”]

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-5-19 07:30 , Processed in 0.023311 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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