簡體   English   中英

在 r 中導入 excel 文件

[英]importing excel files in r

我正在嘗試在 r 工作室中加載 excel 文件,但每次我運行它

Error in read_excel("R/win-library/3.6/IMDB_data.xlsx", sheet = "IMDB_data",
  : 
  could not find function "read_excel" this is displayed.
 i have tried changing directory
saving the data to load, in the same as working directory
none of the articles resolve my issues concerned yet
tried changing directory
saving the file in the same place as my working directory
importing through choose directory


setwd("~/R/win-library/3.6")
library(readxl)
IMDB_data <- read_excel("R/win-library/3.6/IMDB_data.xlsx", 
                        sheet = "IMDB_data", skip = 2)
  1. 使用數據“IMDB_data”將 R 代碼寫入
  2. 通過跳過第二行將 CSV 加載到 R 中。

在此處輸入圖像描述

似乎您的readxl庫未加載。
運行library(readxl)時是否出現任何錯誤?
您的工作文件夾無關緊要,您應該避免在 R 的庫中工作。
read_excel命令應該根據提供的路徑讀取文件,但您的錯誤並不是在抱怨丟失的文件。 它抱怨缺少 function。
最后,如果您將工作目錄設置為~/R/win-library/3.6 ,那么運行以下代碼就足夠了(前提是您的readxl庫已正確加載):

IMDB_data <- read_excel("IMDB_data.xlsx", sheet = "IMDB_data", skip = 2)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM