zoukankan      html  css  js  c++  java
  • R读取数据和导出数据

    对于小数据:用键盘输入数据、

    > mydata<-data.frame(age=numeric(0),gender=character(0),weight=numeric(0))
    > mydata<-edit(mydata)

    就会出现一个文本编辑器

    读入文本文件

    scan(file,what=" "(如有字符“charactor”和数字"number"必须有),sep=" "(表示以行来读取))-----用于读取多行文本

    readline(prompt = "")----------用于一行读取

    读取带分隔符的数据

    read.table(file,header=logical_value,sep=","(" "," "," ",还可以自己设置分隔符),row.name=,colclasses=为每一列指定一个类(logical,numeric,character,factor))

    If the fi rst line of your input le contains the names of the variables in your data separated
    with the same separator used for the rest of the data, you can pass the header=TRUE argument

    read.csv()  read.delim()

    输出

    write.table(x,file)

  • 相关阅读:
    Vue项目搭建及原理三
    Vue项目搭建及原理一
    JS Cookie丢失问题
    1027 Colors in Mars
    1028 List Sorting
    1029 Median
    1030 Travel Plan
    1031 Hello World for U
    1032 Sharing
    1033 To Fill or Not to Fill
  • 原文地址:https://www.cnblogs.com/yupeter007/p/5295671.html
Copyright © 2011-2022 走看看