对于小数据:用键盘输入数据、
> 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 first 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)