Sorry for reverting back late (as I had some issues with my laptop) and
thank you Bert and Duncan for your suggestions and approach. I'll try the
solutions proposed and get back to you.
Thanks
Amit
On Mon, Apr 8, 2019 at 3:30 AM Bert Gunter wrote:
> ... and if anyone cares, here's a way to do i
... and if anyone cares, here's a way to do it using vectorization (no
loops) by working only on the subvector containing bracketed text and
using the brackets to break up the strings into 3 separate pieces,
replacing the commas in the middle piece with dashes, and then
reassembling. Quite clumsy,
... and here's another perhaps simpler, perhaps more efficient (??) way of
doing it using strsplit().Note that it uses the fixed field position, 2, of
the bracketed roles. Adjust as needed.
A better solution would be a regex that avoids the loops (here, the sapply)
altogether, but I don't know how
(Note: This follows an earlier mistaken reply just to Duncan)
Multiple "amens!" to Duncan's comments...
However:
Here is a start at my interpretation of how to do what you want. Note first
that your "example" listed 4 fields in the line, but you showed only 3. I
modified your example for 3 text
On 06/04/2019 10:03 a.m., Amit Govil wrote:
Hi,
I have a bunch of csv files to read in R. I'm unable to read them correctly
because in some of the files, there is a column ("Role") which has comma in
the values.
Sample data:
User, Role, Rule, GAPId
Sam, [HadoopAnalyst, DBA, Developer], R46443
Hi,
I have a bunch of csv files to read in R. I'm unable to read them correctly
because in some of the files, there is a column ("Role") which has comma in
the values.
Sample data:
User, Role, Rule, GAPId
Sam, [HadoopAnalyst, DBA, Developer], R46443
I'm trying to play with the below code but it
6 matches
Mail list logo