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

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.

主站蜘蛛池模板: 杭州市| 东丽区| 武宁县| 嘉义市| 大荔县| 双辽市| 黔南| 巴林右旗| 闻喜县| 南华县| 镶黄旗| 界首市| 繁昌县| 宽甸| 宣化县| 共和县| 河源市| 清新县| 蒙山县| 临沂市| 江华| 峨边| 济阳县| 南江县| 额敏县| 进贤县| 卢湾区| 镇安县| 镶黄旗| 扶风县| 苍南县| 马鞍山市| 苏尼特左旗| 道孚县| 洛南县| 宜宾县| 江孜县| 舟山市| 许昌县| 绿春县| 南阳市|