excel - R XLConnect readWorksheet: rename column names in each worksheet -
i parsing excel file several worksheets , 3 columns in each worksheet. 3 columns have different names in each worksheet (date vs date, etc), when execute code df data frame has several columns of data. want condense df 3 columns renaming headers each excel sheet. how can rename header values when read in each worksheet?
require(xlconnect) wb <- loadworkbook("~/downloads/bearriverband-rancheria-windturbine-log-2009-2014.xlsx") lst = readworksheet(wb, sheet = getsheets(wb)) df <- ldply (lst, data.frame)
i solved problem:
require(xlconnect) require(plyr) wb <- loadworkbook("~/downloads/bearriverband-rancheria-windturbine-log-2009-2014.xlsx") lst = readworksheet(wb, sheet = getsheets(wb)) dat=data.frame() (l in 1:(length(lst)-4)){ s <- data.frame(lst[l]) names(s) <- c('time','data','by') dat <- merge(dat,s,all = true) }
Comments
Post a Comment