I have 12 CVS files of 3 different subjects' activity as (subj1_act1...subj3_act4). I am loading a CSV file and it has data and markers(column names). Trying to find a solution to first find markers and with those indexes and only save the data into a different data frame between those markers. I have a data frame with column names repeating randomly and I need data between column names.
sample human activity
data frame as follow
view (df)
576 -2404 6556 12512 30.74 3788 -2249
577 -1428 10020 13024 30.69 2308 -1852
Sample aX aY az Temp gX gY gz
554 375 2648 7412 13612 30.18 -286 -288
Sample aX aY az Temp gX gY gz
1 -1844 10224 11768 30.69 -332 -387 -62
2 -1876 10192 11708 30.65 -297 -435 -21
3 -1804 10332 11692 30.74 -355 -265 -78
Sample aX aY az Temp gX gY gz
1068 375 2648 7412 13612 30.18 -286 -288
1069 376 2760
Markers into separate data frame or in a single df with heading
Sample aX aY az Temp gX gY gz
1 -1844 10224 11768 30.69 -332 -387 -62
2 -1876 10192 11708 30.65 -297 -435 -21
3 -1804 10332 11692 30.74 -355 -265 -78
Tried the
df = readLines("file.csv")
colname_rows = df[grepl("^[a-z]", df)]
colname_values = unique(df[colname_rows,])
df = df[!colname_rows, ]
df = read.table(text = df, sep = ",")
But getting unable to handle or resolve the dimension issues.
Procedure/Algorithm clarification maybe help full. I want to obtain the indexes for the start and end markers and use the markers obtained and get the data between the markers only. Store data into data frames and identified the data markers, name each of the variables.
How to achieve any guidance/direction or kindly refer be to any material which will be helpful/beneficial or help me out to complete the task.
Again thanks
PS: I don't have any expertise in R language