I have a huge dataframe of thousands of rows imported from the .csv file. Although the text inside is comma separated, R recognizes the imported dataframe as a single column (my guess is - due to its overcomplicated and irregular structure). I want to search every row for any string carrying @ symbol (like @marine, @tested etc.) and put all of them into another column. Unfortunately, the rows are of different length.
Here's what I have (2 rows example):
"254,""CC4qoAPgs0p"",""_ohc=l5OM-bXL0z4AX_eH6id&oh=246b0f63e5f90a14f28e0f9e40989372&oe=5F402F36"",""8"",""26793924834"",""How do you relax at night after a long day working? #doterra #doterraessentialoils @aromatherapy #essentialoils @terra #healthandwellness @terra @doterraoils2 #vegan #healthy #stressfree, 254a
"255,""DC4qDVhJRYH"",""_ohc=52ns_Li8iNQAX9wNlw6&oh=5c6b7f2193799aa6755b67ea6acec857&oe=5F41C4CA"",""12"",""37345461877""," "<U+0001F4F2> https://wa.me/60169573359 Anis Nadzirah Shaklee Independent Distributor Kuala @Berang @shaklee %shaklee%lover, 255a
I would like to have something like this:
number tags
254 @aromatherapy
@terra
@terra
@doterraoils2
255 @Berang
@shaklee
I tried to do this with data.table package
library(data.table)
section <- df[rownames(a) %like% "@", ]
but got rather strange results, out of 10K rows it created me only 27. Can somebody help me with this? thank you in advance.