cran
这个没有简单的方法,只能慢慢写。我写了一个,给大家看看。
######################################
write("list(",file="tempdata.txt",sep='')
write("N=200,",file="tempdata.txt",sep='',append =TRUE)
write("y=c(",file="tempdata.txt",sep='',append =TRUE)
write(y,file="tempdata.txt",sep=',',ncolumns=2*n,append =TRUE)
write("),x=c(",file="tempdata.txt",sep='',append =TRUE)
write(x,file="tempdata.txt",ncolumns=2*n,sep=',',append =TRUE)
write("),uind=c(",file="tempdata.txt",sep=',',append =TRUE)
write(uind,file="tempdata.txt",sep=',',ncolumns=2*n,append =TRUE)
write("))",file="tempdata.txt",append =TRUE)
#####################################
tempdata是我要存入的文件
我的数据里,N=200,y是某些离散的随机数,200个(n=100);x是fixed effect,100个0,100个1;uind是一些random effects的index,我的数据是模拟出来的,有10个random effect,所以uind=rep(1:10,each=20)。
大家也可以看看write 怎么用的。---?write
rtist,有什么更好的方法?