简体   繁体   中英

Reading .data file in r

I need to read a data file of type .data(can be found here ). I have never seen nor read a file like this before and when I try to read.table(file = "ionosphere.data") all of the attributes for a single instance are all grouped together. How do I properly read this file?

您只需要在read.table指定分隔符即可: read.table("https://archive.ics.uci.edu/ml/machine-learning-databases/ionosphere/ionosphere.data", sep = ",")

It's a UTF-16 file with a byte order mark at the beginning. read.table will fail unless you specify the correct encoding. This works for me on MacOS. Decimals are indicated by a comma.

read.table("ionosphere.data", fileEncoding="UTF-16", dec=",")

您可以下载文件并输入x<-read.csv("D:/filedestination/ionosphere.data",header=F)以查看数据view(ionosphere.data)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM