如何从矩阵列表中调用其名称中具有特定字符串的矩阵?
您是否有一个想法只调用我的十二个矩阵列表中包含一串字符的特定矩阵?对于典范,我有十二个矩阵(代表60个个人对之间的遗传距离的数据,因此矩阵为60*60),在一年中的12个月中,我只想提取3个矩阵3个月一年。 因此,我想调用包含其名称“ APR”,“ May”或“ Jun”的矩阵,例如:Spring< - list(List.Mat [[“ APR”]], list.mat [[“ may”],list.mat [[“ jun”]])
。但是,由于几个月缺少,我想找到一个只能打电话给几个月的功能,这些功能可能以其名称中包含这些字符串。我尝试grep
函数及其派生,但它在矩阵列表上不起作用...
我知道有一种简单的方法可以做到这一点,但我不知道看哪种方式!
我不想手动制作它,因为我有40多个矩阵列表!
感谢您的答复,如果您知道我在寻找什么
Do you have an idea to call only one specific matrix which contain a string of characters in my list of twelve matrices ? For exemple, I have my list of twelve matrices (which represent data of genetic distance between pairs of 60 individuals, a matrix is therefore 60*60) for the 12 months of the year, and I want to extract only 3 matrices for 3 months of the year.
So for that, I want to call the matrices which contain in their name "Apr", "May" or "Jun", like this : spring <- list(list.mat[["Apr"]], list.mat[["May"]], list.mat[["Jun"]])
. But because there is missing months, I want to find a function who call only the months who can possibly contain these string of charactrs in their names. I try grep
function and its derivates but it doesn't work on list of matrices...
I know there is a simple way to do that but I don't know which way to look!
I don't want to make it manually because I have more than 40 list of 12 matrices !
Thanks for any replies if you know what i'm looking for
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我们可以使用
filter
从base r
删除null
列表元素We may use
Filter
frombase R
to remove theNULL
list elements