在r命令功能:参数长度不同 [英] Order function in R: argument lengths differ

查看:2521
本文介绍了在r命令功能:参数长度不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到以下错误R:

argument lengths differ.

我有一组数据,我想订购的两列,先caseID,然后在包含时间戳列。我用下面的code:

I have a data set I would like to order on two columns, first on caseID, then on a column that contains a timestamp. I use the following code:

mydata <- mydata[order(mydata[ ,col1], mydata[ ,col2], decreasing = FALSE),]

COL1和col2都拿着一个整数两个变量。我已经看过类似的问题,并试图提出存在的解决方案,但是毫无效果。)

Col1 and col2 are two variables holding an integer. I have looked at similar questions and tried the solutions that were proposed there, but nothing worked ;).

有人能帮帮我吗?

亲切的问候

推荐答案

研究认为你2列有不同的长度,有时会出现这种情况,当你不小心访问不存在的列,检查 COL1 和 COL2 ,以确保它们是适当的数字。另外,也要看看长度(MYDATA [中,col1])长度(MYDATA [,COL2])来看看那些2值相匹配。还检查缺少或其他标点符号,有时如果你没有语法完全正确的,那么你得到长度为1的列表,或者不单个元素的矢量匹配长度其他载体。

R thinks that you 2 columns have different lengths, sometimes that happens when you accidentally access a column that does not exist, check the values of col1 and col2 to make sure that they are appropriate numbers. Also look at length(mydata[,col1]) and length(mydata[,col2]) to see if those 2 values match. Also check for missing , or other punctuation, sometimes if you don't have the syntax exactly right then you get a list of length 1, or a single element vector which does not match the other vector in length.

这篇关于在r命令功能:参数长度不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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