blu*_*fer 21 statistics r dataset
我需要阅读以下数据文件夹中的''wdbc.data':http: //archive.ics.uci.edu/ml/machine-learning-databases/breast-cancer-wisconsin/
使用命令read.csv可以很容易地在R中执行此操作,但由于缺少标题,我该如何添加它?我有信息,但不知道如何做到这一点,我宁愿不编辑数据文件.
Joc*_*hem 37
您可以执行以下操作:
加载数据:
test <- read.csv(
          "http://archive.ics.uci.edu/ml/machine-learning-databases/breast-cancer-wisconsin/breast-cancer-wisconsin.data",
          header=FALSE)
请注意,header参数的默认值read.csv是TRUE,以便获取您需要设置的所有行FALSE.
将名称添加到data.frame中的不同列
names(test) <- c("A","B","C","D","E","F","G","H","I","J","K")
或者替代和更快,据我所知(不重新加载整个数据集):
colnames(test) <- c("A","B","C","D","E","F","G","H","I","J","K")