我想创建一个gt表。我的表在几列中包含一些html代码,例如<span style=\"color:#FFB400\">➖</span>"
现在当我逃跑的时候gt(table1)
我得到了这一点,这是远远不可取的。
dput(table1)
structure(list(Variable = c("GDP", "", "", "", "Private consumption",
"", "", "", "Business investmnet", "", "", "", "Housing investment",
"", "", "", "", "Trade", "", "", "", "", "Labour markets", "",
"", "", "", "", "Wages", "", "", "Prices", "", "", "", "Memo items",
"", "", "", ""), Indicator = c("Real GDP growth", "Industrial production",
"Composite output PMI", "ESI", "Consum. expenditure", "New passenger car registrations",
"Retail sales", "Consumer confidence", "GFCF-excl. construction",
"Capital goods production", "PMI manu. (output of capital goods)",
"PMI manu. (new orders of capital goods)", "GFCF - residential investment",
"GFCF - construction", "Construction production", "Building constrcution production",
"Building constrcution production", "Net exports - contribution to GDP growth",
"Nominal extra-euro area exports", "Nominal extra-euro area imports",
"Nominal extra-euro area imports", "Assessment of export order-book levels",
"Employment growth", "Unemployment rate", "PMI composite employment",
"ESI - empl. expectations (manufacturing)", "ESI - empl. expectations (construction)",
"ESI - empl. expectations (services)", "Negotiated wages", "Negotiated wages (excl. one-off payments)",
"Compensation per employee (CPE)", "HICP", "HICP x", "Dom. producer price infl. (non-food c. goods)",
"Import price index (extra euro area), Consumer goods industry excluding food and tobacco",
"Loans to the private sector", "PMI services business activity",
"M3", "Forward inflation-linked swap prices (5y5y)", "Citigroup economic surprise index"
), Frequency = c("q", "m", "m", "m", "q", "m", "m", "m", "q",
"m", "m", "m", "q", "q", "m", "m", "m", "q", "m", "m", "m", "m",
"q", "m", "m", "m", "m", "m", "m", "m", "q", "m", "m", "m", "m",
"m", "m", "m", "b", "b"), Units = c("% Changes", "% Changes",
"50 = no change", "% bal", "% Changes", "% Changes", "% Changes",
"% bal", "% Changes", "% Changes", "50 = no change", "50 = no change",
"% Changes", "% Changes", "% Changes", "% Changes", "% Changes",
"pps", "% Changes", "% Changes", "50 = no change", "% bal", "% Changes",
"% Changes", "50 = no change", "% bal", "% bal", "% bal", "% per annum",
"% per annum", "% per annum", "% per annum", "% per annum", "% per annum",
"% per annum", "% per annum", "50 = no change", "% per annum",
"% per annum", "% per annum"), Reference_period = c("2022Q3",
"Sep 22", "Nov 22", "Nov 22", "2022Q3", "Oct 22", "Oct 22", "Nov 22",
"2022Q3", "Sep 22", "Oct 22", "Oct 22", "2022Q3", "2022Q3", "Sep 22",
"Jan 22", "Nov 22", "2022Q2", "Sep 22", "Sep 22", "Nov 22", "Nov 22",
"2022Q3", "Oct 22", "Nov 22", "Nov 22", "Nov 22", "Nov 22", "Sep 22",
"Sep 22", "2022Q3", "Nov 22", "Nov 22", "Oct 22", "Oct 22", "Oct 22",
"Nov 22", "Oct 22", "Dec 22", "Dec 22"), Last_obs = c(0.32, 0.943396226415103,
47.85, 93.7, 0.87, 1.67294099307111, -1.83406113537117, -23.92,
7.73006178714422, 1.50801131008484, 47.37, 39.68, -0.68584269394087,
-0.856691337279713, 0.0909918107370231, 4.15129151291514, -12.0004230219558,
-0.75, 1.64451122685591, -1.97449043365181, 41.56, -8.56, 0.29,
6.54, 51.79, 6.94, 7.65, 10.81, 2.76, 2.78, 1.09363968979366,
10, 5, 9.30674264007595, 8.5148514851485, 6.48, 48.52, 5.11,
2.34, 37.7), Change_over_previous_period = c(NA, 0.51, 0.52,
NA, NA, 10.3875157992464, -1.31694468832308, NA, NA, 1.26, -0.12,
-3.09, NA, NA, -1.04, 3.04228780042592, -11.2255942377121, NA,
2.61, 5.98, 1.98, NA, NA, -1.53651383660012, -0.73, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, -0.09, NA, NA, NA), One_y = c("<span style=\"color:red\"> ▼</span>",
"<span style=\"color:yellow\">➖</span>", "<span style=\"color:red\"> ▼</span>",
"<span style=\"color:red\"> ▼</span>", "<span style=\"color:yellow\">➖</span>",
"<span style=\"color:yellow\">➖</span>", "<span style=\"color:red\"> ▼</span>",
"<span style=\"color:yellow\">➖</span>", "<span style=\"color:yellow\">➖</span>",
"<span style=\"color:yellow\">➖</span>", "<span style=\"color:red\"> ▼</span>",
"<span style=\"color:red\"> ▼</span>", "<span style=\"color:yellow\">➖</span>",
"<span style=\"color:yellow\">➖</span>", "<span style=\"color:yellow\">➖</span>",
"<span style=\"color:green\"> ▲</span>", "<span style=\"color:yellow\">➖</span>",
"<span style=\"color:yellow\">➖</span>", "<span style=\"color:yellow\">➖</span>",
"<span style=\"color:red\"> ▼</span>", "<span style=\"color:red\"> ▼</span>",
"<span style=\"color:red\"> ▼</span>", "<span style=\"color:red\"> ▼</span>",
"<span style=\"color:red\"> ▼</span>", "<span style=\"color:red\"> ▼</span>",
"<span style=\"color:red\"> ▼</span>", "<span style=\"color:yellow\">➖</span>",
"<span style=\"color:yellow\">➖</span>", "<span style=\"color:yellow\">➖</span>",
"<span style=\"color:green\"> ▲</span>", "<span style=\"color:yellow\">➖</span>",
"<span style=\"color:green\"> ▲</span>", "<span style=\"color:green\"> ▲</span>",
"<span style=\"color:green\"> ▲</span>", "<span style=\"color:green\"> ▲</span>",
"<span style=\"color:yellow\">➖</span>", "<span style=\"color:red\"> ▼</span>",
"<span style=\"color:red\"> ▼</span>", "<span style=\"color:green\"> ▲</span>",
"<span style=\"color:yellow\">➖</span>"), Six_y = c("<span style=\"color:#FFB400\">➖</span>",
"<span style=\"color:#FFB400\">➖</span>", "<span style=\"color:#FFB400\">➖</span>",
"<span style=\"color:#FFB400\">➖</span>", "<span style=\"color:#FFB400\">➖</span>",
"<span style=\"color:#FFB400\">➖</span>", "<span style=\"color:#FFB400\">➖</span>",
"<span style=\"color:red\"> ▼</span>", "<span style=\"color:#FFB400\">➖</span>",
"<span style=\"color:#FFB400\">➖</span>", "<span style=\"color:#FFB400\">➖</span>",
"<span style=\"color:red\"> ▼</span>", "<span style=\"color:#FFB400\">➖</span>",
"<span style=\"color:#FFB400\">➖</span>", "<span style=\"color:#FFB400\">➖</span>",
"<span style=\"color:#FFB400\">➖</span>", "<span style=\"color:#FFB400\">➖</span>",
"<span style=\"color:#FFB400\">➖</span>", "<span style=\"color:#FFB400\">➖</span>",
"<span style=\"color:#FFB400\">➖</span>", "<span style=\"color:red\"> ▼</span>",
"<span style=\"color:#FFB400\">➖</span>", "<span style=\"color:#FFB400\">➖</span>",
"<span style=\"color:red\"> ▼</span>", "<span style=\"color:#FFB400\">➖</span>",
"<span style=\"color:#FFB400\">➖</span>", "<span style=\"color:#FFB400\">➖</span>",
"<span style=\"color:#FFB400\">➖</span>", "<span style=\"color:green\"> ▲</span>",
"<span style=\"color:green\"> ▲</span>", "<span style=\"color:#FFB400\">➖</span>",
"<span style=\"color:green\"> ▲</span>", "<span style=\"color:green\"> ▲</span>",
"<span style=\"color:green\"> ▲</span>", "<span style=\"color:green\"> ▲</span>",
"<span style=\"color:green\"> ▲</span>", "<span style=\"color:#FFB400\">➖</span>",
"<span style=\"color:#FFB400\">➖</span>", "<span style=\"color:green\"> ▲</span>",
"<span style=\"color:#FFB400\">➖</span>")), class = "data.frame", row.names = c(NA,
-40L))
我应该怎么做才能启用表格中的html代码?
1条答案
按热度按时间pftdvrlh1#
要呈现HTML列,必须使用
gt::fmt_markdown
对其进行格式化