使用库rtf将R表达式插入单词

时间:2018-10-22 18:00:07

标签: r insert rtf

我想知道它是否可能在单词中插入R表达式或R对象:

示例:

this.$feathers.service("data").find({
   query: {
       timeSinceCreated: 24*60*60*1000
   }
});

但是我的话会显示:

  data(mtcars)

    (table=head(mtcars,20))
    addParagraph(doc, "\n\n Table cars \n")
    addTable(doc, cbind(rownames(table), table))
    nrow(mtcars)

    In this table we can see that data contain nrow(mtcars) rows

预先感谢 R

1 个答案:

答案 0 :(得分:0)

最后,我可以在一个单词中插入一个对象。使用rtf和胶水包:

(
    [0] => Array
        (
            [0] => SEASON_ID
            [1] => 22017
            [2] => 22017
        )

    [1] => Array
        (
            [0] => Player_ID
            [1] => 203954
            [2] => 203954
        )

    [2] => Array
        (
            [0] => Game_ID
            [1] => 0021701118
            [2] => 0021701105
        )

    [3] => Array
        (
            [0] => GAME_DATE
            [1] => MAR 28, 2018
            [2] => MAR 26, 2018
        )

    [4] => Array
        (
            [0] => MATCHUP
            [1] => PHI vs. NYK
            [2] => PHI vs. DEN
        )

    [5] => Array
        (
            [0] => WL
            [1] => W
            [2] => W
        )

    [6] => Array
        (
            [0] => MIN
            [1] => 9
            [2] => 27
        )

    [7] => Array
        (
            [0] => FGM
            [1] => 2
            [2] => 6
        )

    [8] => Array
        (
            [0] => FGA
            [1] => 6
            [2] => 12
        )

    [9] => Array
        (
            [0] => FG_PCT
            [1] => 0.333
            [2] => 0.5
        )

    [10] => Array
        (
            [0] => FG3M
            [1] => 0
            [2] => 0
        )

    [11] => Array
        (
            [0] => FG3A
            [1] => 1
            [2] => 1
        )

    [12] => Array
        (
            [0] => FG3_PCT
            [1] => 0
            [2] => 0
        )

    [13] => Array
        (
            [0] => FTM
            [1] => 1
            [2] => 8
        )

    [14] => Array
        (
            [0] => FTA
            [1] => 2
            [2] => 10
        )

    [15] => Array
        (
            [0] => FT_PCT
            [1] => 0.5
            [2] => 0.8
        )

    [16] => Array
        (
            [0] => OREB
            [1] => 2
            [2] => 1
        )

    [17] => Array
        (
            [0] => DREB
            [1] => 1
            [2] => 12
        )

    [18] => Array
        (
            [0] => REB
            [1] => 3
            [2] => 13
        )

    [19] => Array
        (
            [0] => AST
            [1] => 0
            [2] => 2
        )

    [20] => Array
        (
            [0] => STL
            [1] => 0
            [2] => 1
        )

    [21] => Array
        (
            [0] => BLK
            [1] => 0
            [2] => 2
        )

    [22] => Array
        (
            [0] => TOV
            [1] => 1
            [2] => 4
        )

    [23] => Array
        (
            [0] => PF
            [1] => 1
            [2] => 5
        )

    [24] => Array
        (
            [0] => PTS
            [1] => 5
            [2] => 20
        )

    [25] => Array
        (
            [0] => PLUS_MINUS
            [1] => 7
            [2] => 20
        )

    [26] => Array
        (
            [0] => VIDEO_AVAILABLE
            [1] => 1
            [2] => 1
        )

)

我的文字秀:

library(rtf)
library(glue)

data(mtcars)
total=nrow(mtcars)
addText(todo, glue("In this table we can see that data contain {nrow(mtcars)} rows"))