【问题标题】:Import dataset to predict new data导入数据集以预测新数据
【发布时间】:2015-08-06 13:46:14
【问题描述】:

我是 R 新手。我想从 https://archive.ics.uci.edu/ml/machine-learning-databases/heart-disease/processed.hungarian.data 导入数据集。我能怎么做? 这些是我的尝试

# first attempt
x <- read.table("https://archive.ics.uci.edu/ml/machine-learning-databases/heart-disease/processed.hungarian.data")
Error in file(file, "r") : unable to open connection
In addition: Warning message:
In file(file, "r") : unsupported URL scheme

# second attempt
x <- read.table("C:/Users/Thanushiya/Desktop/processed.hungarian.data.txt", header=TRUE, sep=",", row.names="id")
Error in data[[rowvar]] : attempt to select less than one element

【问题讨论】:

  • 你可以开始阅读how to import data in R
  • 你有什么尝试吗?你收到错误了吗?我们假设您至少已经努力尝试自己解决问题。
  • > mydata 中出现意外符号
  • 只需将s 放入httpsread.table("http://archive.ics.uci.edu/ml/machine-learning-databases/heart-disease/processed.hungarian.data", sep=",") 为我工作。

标签: r import


【解决方案1】:

在数据框中读取它(添加sep = ","

df <- read.table("https://archive.ics.uci.edu/ml/machine-learning-databases/heart-disease/processed.hungarian.data",sep = ",")

【讨论】:

  • 文件中的错误(文件,“r”):无法打开连接另外:警告消息:在文件中(文件,“r”):不支持的 URL 方案
  • 尝试使用不同的网络连接。可能是您的网络不允许 R 连接到该站点。或者您可以将站点数据复制粘贴到记事本中并保存。然后再次将该特定文本文件导入您的 R
  • 代替 https 我试试 http..it 工作正常。谢谢
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-06-12
  • 2019-09-22
  • 1970-01-01
  • 2021-05-31
  • 2017-01-29
  • 2022-11-17
相关资源
最近更新 更多