使用Windows在R中的文件路径问题(“字符串中的十六进制数字"错误) [英] File path issues in R using Windows ("Hex digits in character string" error)

查看:222
本文介绍了使用Windows在R中的文件路径问题(“字符串中的十六进制数字"错误)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows上运行R,并且在桌面上有一个csv文件.我将其加载如下,

I run R on Windows, and have a csv file on the Desktop. I load it as follows,

x<-read.csv("C:\Users\surfcat\Desktop\2006_dissimilarity.csv",header=TRUE)

但是R给出了以下错误消息

but the R gives the following error message

错误:字符串'C:\ U'中使用不带十六进制数字的'\ U'

Error: '\U' used without hex digits in character string starting "C:\U"

那么加载此文件的正确方法是什么.我正在使用Vista

So what's the correct way to load this file. I am using Vista

推荐答案

将所有\替换为\\.

在这种情况下,它试图转义下一个字符U,因此要插入\,您需要插入转义的\,即\\

it's trying to escape the next character in this case the U so to insert a \ you need to insert an escaped \ which is \\

这篇关于使用Windows在R中的文件路径问题(“字符串中的十六进制数字"错误)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆