r - Split line into 5 columns -
2016-11-02 09:38:53, 22822, 33067, 6.79, abc, cedfgh pqrst 12abc
i want read above-given data 5 columns of data frame. last column i.e column 5 can have delimiter character should ignored , consider 1 whole string in r.
hence put in r terms:
data.frame(var1 = "2016-11-02 09:38:53", var2 = "22822", var3 = "33067", var4 = "6.79", var5 = "abc, cedfgh pqrst 12abc")
just read 6 columns , do:
df$var5 <- paste(df$var5, ",", "df$var6")
you'll data.frame
you've shown in expected output.
Comments
Post a Comment