Mad*_*ddy 1 excel r load-data-infile
如何将Excel工作表中的数据保存到R中的.RData文件?我想使用R中的一个包并将我的数据集作为数据(数据集)加载我认为我必须将数据保存为.RData文件,然后将其加载到包中.我的数据目前在Excel电子表格中.
我的Excel工作表有列名,如x,y,time.lag.我已将其保存为.csv然后我使用:x = read.csv('filepath',header = T,)然后我说数据(x),它显示数据集'x'未找到
将Excel数据另存为.csv文件,并使用read.csv()或read.table()导入它.每个人的帮助将解释选项.
例如,您有一个名为myFile.xls的文件,将其另存为myFile.csv.
library(BBMM)
# load an example dataset from BBMM
data(locations)
# from the BBMM help file
BBMM <- brownian.bridge(x=locations$x, y=locations$y, time.lag=locations$time.lag[-1], location.error=20, cell.size=50)
bbmm.summary(BBMM)
# output of summary(BBMM)
Brownian motion variance : 3003.392
Size of grid : 138552 cells
Grid cell size : 50
# subsitute locations for myData for your dataset that you have read form a myFile.csv file
myData <- read.csv(file='myFile.csv', header=TRUE)
head(myData) # will show the first 5 entries in you imported data
# use whatever you need from the BBMM package now ....
Run Code Online (Sandbox Code Playgroud)