R in action -- 2.3 数据输入
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了R in action -- 2.3 数据输入相关的知识,希望对你有一定的参考价值。
R in action -- 2.3 数据输入
1、从CSV文件导入数据
> gtades <- read.table("1.csv",header=TRUE,sep=",") > gtades ID name age 1 1 qqw 15 2 2 eew 56 3 3 rrw 43 4 4 ttw 58
2、从Excel导入数据
安装openxlsx包
> install.packages("openxlsx") Installing package into ‘C:/Users/iamfe/Documents/R/win-library/3.4’ (as ‘lib’ is unspecified) also installing the dependency ‘Rcpp’ trying URL ‘https://cran.rstudio.com/bin/windows/contrib/3.4/Rcpp_0.12.11.zip‘ Content type ‘application/zip‘ length 3380346 bytes (3.2 MB) downloaded 3.2 MB trying URL ‘https://cran.rstudio.com/bin/windows/contrib/3.4/openxlsx_4.0.17.zip‘ Content type ‘application/zip‘ length 2430742 bytes (2.3 MB) downloaded 2.3 MB package ‘Rcpp’ successfully unpacked and MD5 sums checked package ‘openxlsx’ successfully unpacked and MD5 sums checked The downloaded binary packages are in C:\Users\iamfe\AppData\Local\Temp\Rtmp6h0MaS\downloaded_packages > library(openxlsx) > read.xlsx("1.xlsx") ID name age 1 1 qqw 15 2 2 eew 56 3 3 rrw 43 4 4 ttw 58 >
以上是关于R in action -- 2.3 数据输入的主要内容,如果未能解决你的问题,请参考以下文章
C语言//freopen("data.in", "r", stdin);
SPRING IN ACTION 第4版笔记-第六章RENDERING WEB VIEWS-003- SPRING的GENERAL TAG LIBRARY简介及用<s:message>和R