R中数据的录入与读取补充

R中数据的录入与读取补充

视频链接

控制台直接录入

  1. x <- readline()
    直接输入一个数据或者字符
  2. x <- scan()
    可以录入多个数据或者字符,但是必须是同一种数据类型,数字或者字符。以空格结束录入。疑问:如果最后以空格结束怎么办呢?

读取和导出数据

字符串的输入和输出

x <- readLines()writeLines(x,”x.txt”)

表格的输入和输出

x <- read.table()write.table(x,”x.csv”) 输出的文件格式为csvx <- read.table(“clipboard”)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s