データフレームをExcelファイルに保存し、そのデータフレームをExcelファイルからロードする方法は次のとおりです。 readWorksheet`は `rownames`引数を持つ`よう
library(lubridate)
library(stringr)
library(xlsx)
#Creating time and date data
t1 <- ymd_hms("2011-06-04 12:00:00")
t2 <- ymd_hms("2011-06-05 11:00:00")
t3 <- ymd_hms("2011-06-06 10:00:00")
#Storing the time and date data in a data frame
#Storing t1
df <- data.frame(NULL)
df <- rbind(df, data.frame(t(strsplit(as.character(t1), " ")), stringsAsFactors = F))
colnames(df) <- c("V1")
df <- str_split_fixed(df$V1, " ", 2)
df <- gsub("[^0-9.:-]","",df)
colnames(df) <- c("Date", "Time")
#Storing t2
tmp <- data.frame(t(strsplit(as.character(t2), " ")), stringsAsFactors = F)
colnames(tmp) <- c("V1")
tmp <- str_split_fixed(tmp$V1, " ", 2)
tmp <- gsub("[^0-9.:-]","", tmp)
df <- rbind(df, tmp)
#Storing t3
tmp <- data.frame(t(strsplit(as.character(t3), " ")), stringsAsFactors = F)
colnames(tmp) <- c("V1")
tmp <- str_split_fixed(tmp$V1, " ", 2)
tmp <- gsub("[^0-9.:-]","", tmp)
df <- rbind(df, tmp)
#Writing the data frame to an Excel file
write.xlsx(x = df, file = "df.xlsx", sheetName = "Sheet1", row.names = FALSE)
#reading the data from the Excel file
readDF <- read.xlsx("df.xlsx", sheetName="Sheet1")
私はあなたが 'ライブラリ(readxl)' – akrun
から 'read_excel'を使用することができると思うが見えます。あなたはそれを使ってみましたか? [the docs](https://cran.r-project.org/web/packages/XLConnect/XLConnect.pdf)によると、 'rownames = NULL'は動作します。 –
答えを組み込むためにあなたの質問を編集するのではなく、*答*(あなたが許可されるまで少し待たなければならないかもしれません)であなたの質問に答える方が良いです... –