在R中重塑:什么是" colsplit,融化,重铸"

时间:2016-12-01 17:12:45

标签: r

新R用户: 当我尝试添加"重塑"时,我收到以下错误到我的图书馆

附加包裹:'重塑'

以下对象从'package:reshape2'屏蔽:

WITH a AS (
    SELECT
        ID
        , [DATE]
        , ID_SECONDARY
        , VALUE
        , ROW_NUMBER() OVER (PARTITION BY ID, DATE ORDER BY ID) AS RNUM
)
SELECT
    a.ID
    , a.[DATE]
    , MAX (
        CASE a.RNUM
            WHEN 1 THEN a.VALUE
            ELSE NULL
      ) AS VALUE_1
    , MAX (
        CASE a.RNUM
            WHEN 1 THEN a.ID_SECONDARY
            ELSE NULL
    ) AS VALUE_1_DESC
    , MAX (
        CASE a.RNUM
            WHEN 2 THEN a.VALUE
            ELSE NULL
      ) AS VALUE_2
    , MAX (
        CASE a.RNUM
            WHEN 2 THEN a.ID_SECONDARY
            ELSE NULL
    ) AS VALUE_2_DESC
    , MAX (
        CASE RNUM
            WHEN 3 THEN a.VALUE
            ELSE NULL
      ) AS VALUE_3
    , MAX (
        CASE RNUM
            WHEN 3 THEN a.ID_SECONDARY
            ELSE NULL
    ) AS VALUE_3_DESC
    , MAX (
        CASE RNUM
            WHEN 4 THEN a.VALUE
            ELSE NULL
      ) AS VALUE_4
    , MAX (
        CASE RNUM
            WHEN 4 THEN a.ID_SECONDARY
            ELSE NULL
    ) AS VALUE_4_DESC
FROM a
GROUP BY a.ID, a.[DATE]

所以像#34; untable"不会跑。有人可以帮忙吗?

0 个答案:

没有答案