I have a .txt file in following way
Date/Time Temp [C] Pressure [P]
2006-01-01T00:00:00 25 1018
2006-01-01T00:01:00 25 1018
.
.
While reading it in R, the header and data appears as follows:
Date.Time Temp..C. Pressur..P. [I dont know why [] have converted to.. It would be help if somebody can explain me this too]
2006-01-01T00:00:00 25 1018
2006-01-01T00:01:00 25 1018
.
.
As data in Date.Time column is stored in one column seperated by T, I want to divide this column into two columns Date and Time. To achieve this, I tried following code in R:
library(stringr)
df[c('Date', 'Time')] <- str_split_fixed(df$Date.Time, 'T', 2)
After running the code, I am able to obtain Date and Column as spearate columns but at the end of the table and the original Date.Time column is intact (shown below). Whereas I want Date.Time column to be removed and seperate Date and Time columns in the start of the table. How can I do it? Could someone please help. (I can fix it manually too but because I have thousands of .txt file, I am looking for a code solution.)
Date.Time Temp..C. Pressur..P. Date Time
2006-01-01T00:00:00 25 1018 2006-01-01 00:00:00
2006-01-01T00:01:00 25 1018 2006-01-01 00:01:00
.
.