I. Problem description
When using the R language, you want to use the order function for a matrix to sort by a column, and the result is an error
> print(rep_motion)
[,1] [,2] [,3]
[1,] NaN NaN NaN
[2,] 0.0434575 0.01098376 0.9512894
[3,] 0.001588562 0.001588562 0.99722
[4,] 0.004219409 0 0.9978903
[5,] 0.004721435 0.0006295247 0.9952786
[6,] 0.008078995 0.000598444 0.9931179
[7,] 0.01246883 0.009975062 0.9806733
[8,] 0 0 1
[9,] 0.03324361 0.02113055 0.9510094
[10,] 0.02582149 0.01563 0.9611535
[11,] 0.006769826 0.005802708 0.9883946
[12,] 0.001959248 0.0003918495 0.9980408
[13,] 0.002842524 0.0005685048 0.9971575
[14,] 0.00748183 0.001710133 0.9910218
[15,] 0.02713675 0.01901709 0.9626068
[16,] 0.03195067 0.009529148 0.9646861
[17,] 0.01386159 0.01799938 0.9778628
[18,] 0.02140673 0.1569827 0.9006116
[19,] 0.06902854 0.01588641 0.9190215
[20,] 0.006300257 0.003150128 0.9912957
[21,] 0.01619586 0.006779661 0.9777778
[22,] 0.006226313 0.00351922 0.9910666
[23,] 0.01170929 0.005552047 0.9836333
> rep_motion[order(rep_motion[,3])]
Error in order(rep_motion[, 3]) : unimplemented type 'list' in 'orderVector1'
Ii. Problem Solving
Check out the type of REP_motion:
> typeof(rep_motion)
[1] "list"
> mode(rep_motion)
[1] "list"
> class(rep_motion)
[1] "matrix"
The reason is that when you create this matrix, you group each row together as a list, so that when you order, you are ordering the list, not the number. Numbers are sized so they can be sorted, while list is not, so it will report an error.
when your matrix changes to the following type, it will not report an error.
> typeof(evaluated)
[1] "double"
> mode(evaluated)
[1] "numeric"
> class(evaluated)
[1] "matrix"
It depends on how you define it. If you still have not solved, welcome to exchange in the comments section!
Read More:
- Grpc client access server prompt: RPC error: code = unimplemented desc = unknown service possible reasons
- The solution of “error in NLS loop more than 50” in R language
- [Mac OS] ASUS z97-k r2.0 + gtx960 + clover v2.4k r4098 install Sierra 10.12.5 problems and Solutions
- On the usage of ‘ref.stor.type search’ field in SAP WM movement type
- Pre initialization of list content and length in Python
- Type definition error – one of the causes of type definition errors is WM in Oracle_ Concat function usage
- Error: (22,57) Java: type parameter… Mapper is not in the range of type variable M
- Use of rep function in R
- Common attributes and methods of list and map in Dar
- Error Code: 1055. Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated
- JNI calls the add function of list in Java to flash back
- R-DataCamp-Data Manipulation with dplyr in R
- Type error: cannot unpack non Iterable non type object appears when starting Bert server in Ubuntu system
- How many pieces of data can list store in Java?
- #error identifier-list parameters may only be used in a function definition
- Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and co
- R language error in hist.default ():’x’must be a value
- The reason of error in R file
- Usage and examples of three important functions of tidyr package in R language: gather, spread and separate