解决 R shiny 报错:Error in sourceUTF8(fullpath, envir = new.env(parent = sharedEnv)) 问题

14 篇文章 0 订阅

在学习「R shiny 基础」如何进行网页布局 时,打这段代码又双报错:

ui <- fluidPage(
  titlePanel("title Panel"),
  sidebarLayout(
    sidebarPanel(
      tags$hgroup(h1("Side Bar"), h2("Panel"))
    ),
   mainPanel(
      HTML("<p>You can add content to your Shiny app by placing it inside a <code>*Panel</code> function. For example, the apps above display a character string in each of their panels. The words “sidebar panel” appear in the sidebar panel, because we added the string to the <code>sidebarPanel</code> function, e.g. <code>sidebarPanel(\"sidebar panel\")</code>. The same is true for the text in the title panel and the main panel.</p>"),
      div()
    )
  )
)

我就纳闷了,我过年前打的时候也没见过这么红的R啊。

解决方案:

“sidebar panel”里面这个“”用的是中文符号……改成\"sidebar panel\"
可能是语法升级或者别的什么原因(几次报错都有显示我这个file不是UTF-8编写的,我也不知道怎么弄)
反正现在能正常显示了在这里插入图片描述

将R的编码设置为UTF-8

参考这篇文章进行设置即可

补充一点,每次改了点东西记得保存了再重新run,否则会出现以下情况还不知道代码出了啥问题。
在这里插入图片描述

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值