Making a matrix of a specific structure

后端 未结 1 1682
暖寄归人
暖寄归人 2021-01-22 05:56

Please note: I don\'t know where I am mistaking but I have spent whole day trying to solve this problem. So, I request not to discard it as duplicate question and treat this as

相关标签:
1条回答
  • 2021-01-22 06:42

    We can set the dimnames to NULL after converting to matrix (assuming from the expected output showed in the OP's post without any dimnames)

    m1 <- `dimnames<-`(as.matrix(c.m.q), NULL)
    

    If we check the dput of 'm1', it is of similar structure

    dput(m1)
    
    structure(c(1801, 1687.3, 1687.2, 1688.95, 1687.15, 1688.95, 
    1687.5, 1688.85, 1689, 1688.95, 1687.5, 1688, 1688, 1687.5, 1689.95, 
    1685.85, 1689.9, 1689.95, 1688.8, 1688.95, 1687.15, 1687.2, 1690, 
    1688, 1688, 1690, 1688.7, 1690, 1688.7, 1689.9, 1688.7, 1689.9, 
    1688.7, 1689.9, 1689.8, 1687.95, 1689.75, 1689.7, 1687.95, 1689.35, 
    1689.3, 1651, 1688.5, 1687, 1688.5, 1687, 1688.5, 1687.05, 1688.5, 
    1687.05, 1687.05, 1688.5, 1688.5, 1688.5, 1688.5, 1688.7, 1685.35, 
    1688.2, 1688.95, 1685.6, 1685.6, 1689.05, 1685.8, 1689.1, 1686.1, 
    1686.25, 1689.95, 1688.05, 1689.95, 1688.1, 1689.8, 1688.1, 1689.8, 
    1686.1, 1689.8, 1689.7, 1686.15, 1689.7, 1689.15, 1686.15, 1689.15, 
    1689.15), .Dim = c(41L, 2L))
    
    0 讨论(0)
提交回复
热议问题