hyongd的个人博客分享 http://blog.sciencenet.cn/u/hyongd

博文

Working with data

已有 2878 次阅读 2013-9-6 03:12 |系统分类:科研笔记

1. Read data off of hard drive

2. R stores it as an object

Working directory

setwd("D:/myData/") change a new working directory

list.files() show all the files in this directory


 Read data from this directory

myData <- read.csv("data1.csv")

or

myData <- read.csv(list.files()[3])


 Write data to this directory

write.csv(myData, "updated data.csv")

list.files()


head() shows the first few or 6 lines of the data

tail() shows the last few or 6 lines of the data

names() gives the column name of the data


Pulling out columns

Data$columnname

Data[, columnname]

Data[,3]




https://blog.sciencenet.cn/blog-274809-722653.html

上一篇:利用R语言空间分析,1. 数据输入及查看
下一篇:working with data, exercise 1
收藏 IP: 131.118.230.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-9-19 16:53

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部