我的R Shiny脚本将点复制到Google表格中,但我需要点以整数格式表示。

huangapple go评论76阅读模式
英文:

My R shiny script copies the points to google sheets as "string" and i need points to be in integer format

问题

我创建了一个应用程序,将数据收集到Google表格中。一个文本“名字”和一个数字“分数”。在Google表格中,分数会以带有数字之前的单引号字符串的形式出现。我希望用户能立即看到分数,以便图表可以捕捉它们。

目前在Google表格中添加了第三列,将文本转换为值。这并不理想。

这是应用程序代码的链接:https://github.com/Nxatha/Rshiny-apps/blob/main/trashketballstats.R

在这里输入数据以查看输出:https://nxatha.shinyapps.io/TrashketballChallenge/

我尝试使用as.numeric将分数强制转换为数字,但在Google表格中仍然显示为文本'数字。

英文:

I created an app that collects data to google sheets. a text "name" and a number "points". On google sheets, points appears as a string with ' before the number. I would like the user to immediately see points so that the chart can pick them up .

Currently added a third column in google sheets to convert text to value. Not ideal.

Here is the link to the app code: https://github.com/Nxatha/Rshiny-apps/blob/main/trashketballstats.R

Enter data here to view output: https://nxatha.shinyapps.io/TrashketballChallenge/

i tried using as.numeric to force the points into numeric but still appears on google sheet as text 'number

答案1

得分: 0

你似乎正在进行cbinding操作,因此将变量强制转换为最常见的类型,即字符型。
考虑并比较

cbind(a=1, b="x")
data.frame(a=1, b="x")
英文:

You seem to be cbinding, and so getting variables coerced to the most common type, i.e character.
consider and compare

cbind(a=1,b="x")
data.frame(a=1,b="x")

</details>



huangapple
  • 本文由 发表于 2023年7月12日 22:56:49
  • 转载请务必保留本文链接:https://go.coder-hub.com/76671944.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定