简体   繁体   English

如何在R中解释data.frame

[英]how to interpret data.frame in R

I have problem in interpret the following syntax: 我在解释以下语法时遇到问题:

data=data.frame(X,Z[,5])

I check it in R. I konw that X is the dataset that pass to the data.fram, but I don't find the corresoponding argument to Z[,5] , so how to interpret this syntax? 我在R中进行了检查。我知道X是传递给data.fram的数据集,但是我没有找到Z[,5] ,那么如何解释这种语法?

data.frame(..., row.names = NULL, check.rows = FALSE,
           check.names = TRUE, fix.empty.names = TRUE,
           stringsAsFactors = default.stringsAsFactors())

X and Z[,5] are both being passed as data values through the ... argument. XZ[,5]都作为数据值通过...参数传递。 An attempt will be made to make both of them into separate columns of a data frame. 将尝试将它们都放入数据帧的单独列中。 Any arguments that follow ... in an argument list must be named. 参数列表中...之后的所有参数都必须命名。 In data.frame() , ... is the first argument. data.frame()...是第一个参数。 So to pass values to any argument other than ... , you must use names. 因此,要将值传递给...以外的任何参数,则必须使用名称。 You haven't named any, and therefore both X and Z[,5] are passed to ... . 您尚未命名,因此XZ[,5]都传递给... If you had done, for example, 例如,如果您完成了,

data.frame(X, row.names = Z[,5]) 

where there is a named argument, then Z[,5] would be passed to the row.names argument. 如果有一个命名参数,则Z[,5]将传递给row.names参数。 See the Introduction to R manual for more. 有关更多信息,请参见R简介手册。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM