R数组操作 [英] R array manipulation

查看:133
本文介绍了R数组操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Python列表可切片这样的 X [4:0] 从第四去的最后一个元素

In python lists can be sliced like this x[4:-1] to get from the fourth to the last element.

在类似的能为向量与 X来完成ř东西[4:长度(X)] 并与一些多维数组像 X [ ,,,, 4:昏暗(X)[5] ,,,] 。这是数组从元素中间切片特定维度到最后一个元素更加优雅的语法?

In R something similar can be accomplished for vectors with x[4:length(x)] and for multidimensional arrays with something like x[,,,,4:dim(x)[5],,,]. Is this more elegant syntax for array slicing for a particular dimension from an element in the middle to the last element?

感谢

推荐答案

您可以使用下拉元素语法:

You could use the drop elements syntax:

> (1:10)[-(1:4)]
[1]  5  6  7  8  9 10

这篇关于R数组操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆