Skip to content
Prev 385430 / 398506 Next

readxl question

Hi


Are you sure that your command read values from respective cells?

I tried it and got empty data frame with names
[1] ano                 TP303               X96                
[4] X0                  X3.7519999999999998 X26.7              
<0 rows> (or 0-length row.names)

To get data, col_names argument should be set to FALSE
WO <- lapply(files, read_excel, sheet=1, range=("B3"), col_names=FALSE)
WO2 <- lapply(files, read_excel, sheet=1, range=("B5"), col_names=FALSE)

After that unlist and one rbind together with t should be enough to give you
one table
WO <- unlist(WO)
WO2 <- unlist(WO2)
result <- t(rbind(WO, WO2))
result
     WO      WO2       
...1 "ano"   "ano"     
...1 "TP303" "261119/2"
...1 "96"    "288"     
...1 "0"     "192"     
...1 "3.752" "25.92094"
...1 "26.7"  "38.6"
And instead txt document you could do

write.table(result, "result.xls", sep = "\t", row.names = F)

And now "result.xls" is directly readable with Excel

Cheers
Petr
layout.
form. I've
create text
each
small.