无法在R上上传数据集

问题描述

以下是我要上传的数据集的链接https://www.kaggle.com/zynicide/wine-reviews?select=winemag-data-130k-v2.csv

我将数据集和R Notebook保存到了桌面上的同一文件夹中。

这是我的代码

$features = $surrender->character->image->features()->get();
$totalCost = 0;

foreach ($features as $traits) {
    $rarity = Rarity::where('id',$traits->rarity_id)->first();

    switch ($rarity->name) {
        // e.g if the rarity name returns rare,the cost is 100
        case 'rare':
            $totalCost += 100;
            break;
    }
}

这是我的错误:file(file,“ rt”)中的错误:无法打开连接

解决方法

我们需要带有扩展名的完整文件名

wine <- read.table("winemag.data_first150k.csv",sep = ",",header = TRUE,quote = "",fill = TRUE)

下载数据后尝试代码

wine <- read.csv(file.choose(),fill = TRUE)

dim(wine)
#[1] 150930     11