R language XLSX data import

First download "rJava", "xlsxjars", "xlsx", "openxlsx"

An error may appear during the download process: JAVA_HOME cannot be datemind from the Rsgistry, for example, as shown below

It is necessary to install the JAVA environment, to download the JDK (you can go to the WeChat official account to search), after the JDK is installed successfully, download the package---"rJava", "xlsxjars", "xlsx", "openxlsx" can use the following code

install.packages("rJava")

library(rJava)

install.packages("xlsxjars")

library(xlsxjars)

install.packages("xlsx")

library(xlsx)

install.packages("openxlsx")

library(openxlsx)

You can also search and download directly in the area shown in the figure below

 

After downloading all the above, enter the data import code

x<-read.xlsx("file path/file name")

For example

Pay attention to the direction of the slash in the file path. If it is reversed, an error will be reported as follows: Error:'\U' used without hex digits in character string starting ""C:\U"

 

 

Guess you like

Origin blog.csdn.net/weixin_64589302/article/details/128699771