我想知道如何摆脱我的R闪亮应用程序的文本输出中出现的额外空格。
下面是它的编码方式:
output$summary <- renderText ({
isolate({
paste("The power of this independent samples t-test, with population means of",
input$mu_1,"and", input$mu_2,
", standard deviations of", input$sigma_1, "and", input$sigma_2,
", and sample sizes of", input$N_1, "and", input$N_2, ", is", Power)
})
})
Power = mean(out.df$p.value < .05)
Power})
}
然而,在这款应用上,它是这样的:
这个独立样本t检验的能力是0.770562770562771,总体均值为10和13,标准差为2和5,样本量为21和27
如你所见,逗号前有多余的空格,我想知道如何去掉这些空格?我尝试过sep = "“,但这只是将所有数字捆绑在一起。不确定我是否把它放在正确的位置?
无论如何,提前谢谢你!
玛戈特
发布于 2018-06-26 08:10:15
使用,在文本中定义空格的sep = ""
,
paste("The power of this independent samples t-test, with population means of ",
input$mu_1," and ", input$mu_2,
", standard deviations of ", input$sigma_1, " and ", input$sigma_2,
", and sample sizes of ", input$N_1, " and ", input$N_2, ", is ", Power, sep = "")
# [1] "The power of this independent samples t-test, with population means of 1 and 1,
# standard deviations of 1 and 1, and sample sizes of 1 and 1, is 1"
发布于 2018-06-26 08:14:34
在paste函数中,sep的默认值是“”。您应该使用paste0
(没有SEP值)或在paste
调用中设置sep=""
。
https://stackoverflow.com/questions/51033237
复制相似问题