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

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.

主站蜘蛛池模板: 满洲里市| 漯河市| 家居| 临安市| 柏乡县| 贺州市| 交口县| 孝感市| 黄浦区| 崇州市| 清河县| 常山县| 临武县| 墨玉县| 襄垣县| 靖宇县| 祁东县| 庆云县| 南木林县| 拜泉县| 霍邱县| 正蓝旗| 庆元县| 城口县| 泊头市| 娄烦县| 玛曲县| 晋宁县| 临夏市| 五指山市| 南宁市| 潍坊市| 吉木乃县| 巫溪县| 启东市| 桦南县| 白朗县| 安庆市| 澎湖县| 当雄县| 峡江县|