Subsetting (子集)

Subsetting 

There are a number of operators that can be used to extract subsets of R objects.

  • [ always returns an object of the same class as the original; can be used to select more than one element (there is one exception)
  • [[ is used to extract elements of a list or a data frame; it can only be used to extract a single element and the class of the returned object will not necessarily be a list or data frame
  • $ is used to extract elements of a list or data frame by name; semantics(语义) are similar to that of [[. 

subsetting vector

Subsetting (子集)

前三个属于数字索引,后三个是逻辑索引。

Subsetting Lists 

Subsetting (子集)

The [[ operator can be used with computed indices(计算指令); $ can only be used with literal names.(字面名称)

Subsetting (子集)

The [[ can take an integer sequence.

Subsetting (子集)

 

 

上一篇:javascript – 如何使用Perl的LWP提取网站的XML并保存在文件中?


下一篇:BugkuCTF extract变量覆盖