安装库
安装xlsx
install.packages("xlsx")
使用
library(xlsx)ray = read.xlsx('D:/Code/R/Data in Excel/Chapter 8/gamma-ray.xls',1)
后面的参数,第一个放地址,第二个放具体sheet页(这里除了可以放数值之外,还可以放对应的名字(字符串))。除此之外,还可以使用encoding="utf-8"
的方式来定义使用中文数据。
效果:
> a = read.xlsx('D:/Code/R/Data in Excel/Chapter 8/gamma-ray.xls',1)> aseconds count1116.002112.003160.00451.505102.01677.40714.508 1070.03999.111049.601150.801277. 114.0014 165.0015 106.001652.9017 104.021851.021951.4020 316.0221 687.0422 101.002399.702449.202549.2126 104.002753.5028 124.0029 168.0030 109.0031 107.0132 103.003352.1034 104.0135 656.0536 111.0137 417.0238 149.013956.514012.5041 101.0142 107.0043 113.014480.8045 110.0046 109.0047 105.0048 104.0149 107.005053.305151.1052 868.0153 105.0054 105.0055 103.0256 104.0057 105.005852.105952.3060 1110.006130.4062 116.006344.906446.106597.9066 102.0167 162.0068 102.0069 102.007098.707198.7272 103.007351.617453.1075 1290.037656.807789.217852.817972.2080 111.008157.708232.808399.628450.918551.2086 1350.068769.108867.708938.219037.909131.3092 121.009355.8094 460.0795 128.009638.719741.809881.709988.30100 37.40
更高阶文章
/cl1143015961/article/details/50035529/question/20950125如果觉得《【两行命令】R语言读取excel数据》对你有帮助,请点赞、收藏,并留下你的观点哦!