Hey,
I'm fairly new to R and I'm practicing some assignments for my class and I'm struggling with importing and editing my CSV file. I should also note I have to do this without modifying the files outside of R.
I use the read.csv function and then remove the rows I don't need.
All my data including dates end up in 1 column with " , " as separator but I would like to split them into their own columns.
example of 2 rows in my column:" 192607, 1.0874, 0.9349, -0.0695, 5.7168, 1.9620, 1.4222 "
" 192608, 0.7030, 1.2300, 5.3842, 2.7154, 2.6930, 6.3154 "
Here the date comes first and is followed by the 6 pieces of data that are separated with ", " .
I want to have a column for each piece of data and the date. Any help is greatly appreciated!
I tried using the stringr package and the str_split_fixed function but I couldn't seem to get it to work.
My code:
import data from CSV file
data <- read.csv("./6_Portfolios_2x3.CSV", sep=" ; ")
remove excess rows
data <- data[-c(1152:8478),]