官术网_书友最值得收藏!

Exporting data in R

Once we have processed our data, we need to save it to an external device or send it to our colleagues. It is possible to export data in R in many different formats.

How to do it…

To export data from R, we can use the write.table() function. Please note that R will export the data to our current directory or the folder we have assigned using the setwd() function:

write.table(data, "mydata.csv", sep=",")

How it works…

The first argument in the write.table() function is the data in R that we would like to export. The second argument is the name of the file. We can export data in the .xls or .txt format, simply by replacing the mydata.csv file extension with mydata.txt or mydata.xls in the write.table() function.

主站蜘蛛池模板: 凉山| 来宾市| 象州县| 漳浦县| 泸州市| 霸州市| 荥阳市| 息烽县| 北海市| 博罗县| 黑山县| 阳高县| 阿瓦提县| 北海市| 长沙市| 新化县| 绍兴市| 金山区| 新兴县| 时尚| 平遥县| 克山县| 临颍县| 三明市| 集贤县| 黎城县| 乡城县| 盐津县| 建德市| 界首市| 灵宝市| 依兰县| 田阳县| 屯昌县| 化德县| 贵定县| 收藏| 乌兰察布市| 确山县| 隆林| 阿巴嘎旗|