I want to import a .txt file in R dataframe using "readr" library functions such as read.delim
, read.table
, read.csv
. The .txt file has only one single row which contains all data.
This one row should be split into different rows during import and the delimiter for this is one whitespace. The values in one row are defined with TAB delimiter. Whatever I try, I was not able to split this one row into many rows with the defined whitespace delimiter. The file is always imported as one row. Is there a way to import in this specific way in R?
My trials only resulted in dataframes with a single row displaying all data in columns.
A, B, and C are column names. 3, 2, and 1 should be the first row and 4, 5, and 6 should be the second.
Example Data: "A" "B" "C" "3" "2" "1" "4" "5" "6"