The best advice that anyone could give:

See fortunes::fortune("Friends") .

cheers,

Rolf Turner

On 6/12/19 4:39 am, Thomas Subia wrote:
Colleagues,

I'm trying to extract a cell from all Excel files in a directory.

library(readxl)
files <- list.files(pattern="*.xls", full.names = FALSE)

date <- lapply(files, read_excel, sheet="Sheet1", range=("B5"))

date_df <- as.data.frame(date)
trans_date <-t(date_df)
mydates <- list(trans_date)
write.table(mydates,"mydates.txt",sep="\t")

Looking at mydates.txt shows:

""
"Saturday..June.09..2018"     
"Saturday..June.09..2018.1"   
"Saturday..June.09..2018.2"

But the original Excel contents are:

Saturday, June 09, 2018
Saturday, June 09, 2018
Saturday, June 09, 2018

I get a similar problem with my serial numbers

serial <-lapply(files, read_excel, sheet="Sheet1", range=("B9"))

serial_df <- as.data.frame(serial)
trans_serial <-t(serial_df)
myserials <- list(trans_serial)
write.table(myserials,"myserials.txt",sep="\t")

R Output

""
"X96739.0027.1"       
"X96739.0041.1"       
"X96739.0044.1"       

Original Excel Content
96739-0027/1
96739-0041/1
96739-0044/1

How can I amend my script so that the output matches the original Excel content?

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to