1
私は上の部分がいくつかのメタデータであり、下がデータフレームである以下のようなデータのcsvを持っています。奇妙なデータ構造を:@Sotosが言ったようにデータフレームに変数として開始行を追加します
> dput(sampledata2)
structure(list(X1 = c("Name", "ID1", "ID2", "Date", NA, "Var1",
"1", "2", "3"), X2 = c("some name", "1", "2", "24-02-2017", NA,
"Var2", "2", "3", "4"), X3 = c(NA, NA, NA, NA, NA, "Var3", "3",
"4", "5"), X4 = c(NA, NA, NA, NA, NA, "Var4", "4", "5", "6"),
X5 = c(NA, NA, NA, NA, NA, "Var5", "5", "6", "7")), class = c("tbl_df",
"tbl", "data.frame"), row.names = c(NA, -9L), .Names = c("X1",
"X2", "X3", "X4", "X5"), spec = structure(list(cols = structure(list(
X1 = structure(list(), class = c("collector_character", "collector"
)), X2 = structure(list(), class = c("collector_character",
"collector")), X3 = structure(list(), class = c("collector_character",
"collector")), X4 = structure(list(), class = c("collector_character",
"collector")), X5 = structure(list(), class = c("collector_character",
"collector"))), .Names = c("X1", "X2", "X3", "X4", "X5")),
default = structure(list(), class = c("collector_guess",
"collector"))), .Names = c("cols", "default"), class = "col_spec"))
は今、私は
> sampledata
# A tibble: 3 × 9
Var1 Var2 Var3 Var4 Var5 Name ID1 ID2 Date
<int> <int> <int> <int> <int> <chr> <int> <int> <chr>
1 1 2 3 4 5 some name 1 2 24-02-2017
2 2 3 4 5 6 some name 1 2 24-02-2017
3 3 4 5 6 7 some name 1 2 24-02-2017
を設定dput'ことができますか? 'dput(sampledata)'はそれを再現可能にします – Sotos
@Sotos Updated! –
うわー...非常に奇妙な構造。どうやってそれを手に入れましたか? – Sotos