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

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.

主站蜘蛛池模板: 北京市| 衡阳县| 南城县| 旬邑县| 古交市| 荔浦县| 金阳县| 高淳县| 大英县| 和平区| 延吉市| 克拉玛依市| 北票市| 广灵县| 新竹市| 沛县| 瑞昌市| 广水市| 涞水县| 兴海县| 和政县| 贺州市| 临漳县| 屯昌县| 麟游县| 新巴尔虎右旗| 揭阳市| 葫芦岛市| 肥西县| 东源县| 黔西| 浑源县| 高邮市| 宣城市| 山东| 温泉县| 宝鸡市| 湘潭县| 裕民县| 吴川市| 桃源县|