对于学位字符,哪个是正确的编码?
我有一系列代码,使文本
temperature<-as.numeric(gsub("°.*","",temp))
r不喜欢“°”字符。保存文件时,它说我需要使用其他编码。
我已经尝试了列表中的各种不同的编码,但是它们都以
temperature<-as.numeric(gsub("??.*","",temp))
当前解决方案的某些变化保存代码是在记事本中打开脚本,并将代码粘贴到rstudio中。我需要在rstudio中保存哪个编码?
I have a line of code that alters text
temperature<-as.numeric(gsub("°.*","",temp))
R does not like the "°" character. When I save the file it says I need to use a different encoding.
I have tried all sorts of different encodings from the list, but they all save the code in some variation of
temperature<-as.numeric(gsub("??.*","",temp))
My current solution is to open the script in notepad and copy paste the code into rstudio. Which encoding do I need to save a ° in rstudio?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在rstudio中对此的完整解决方案是转到文件 - &gt;保存使用编码 - &gt;选择ISO-8859-1-&GT;将框设置为默认编码源文件。现在,该文件每次都以学位字符正确打开。
The full solution to this in rstudio was to go to file -> save with encoding -> select ISO-8859-1 -> check the box Set as default encoding for source files. Now the file opens properly with the degree character every time.