R使用特定编码读取tsv文件 [英] R reading a tsv file using specific encoding

查看:3907
本文介绍了R使用特定编码读取tsv文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用特定的编码读取.tsv(制表符分隔值)文件到R中。它应该是 windows-1252 。它有一个头。

I am trying to read a .tsv (tab-separated value) file into R using a specific encoding. It's supposedly windows-1252. And it has a header.

有关将代码放入数据框的任何建议吗?

Any suggestions for the code to put it into a data frame?

推荐答案

这样可能吗?

mydf <- read.table('thefile.txt', header=TRUE, sep="\t", fileEncoding="windows-1252")
str(mydf)

这篇关于R使用特定编码读取tsv文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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