Re: [R] Alternative to loops

2019-04-07 Thread Ek Esawi
Thank you Bert. It did indeed work and i put it in one line as well. The match(TRUE..) through me off a little on the beginning, but i realized why it's there. Thanks for your continuous comments on mine and many other posts. EK On Sat, Apr 6, 2019 at 5:07 PM Bert Gunter wrote: > > I skipped pre

Re: [R] Unable to read csv files with comma in values

2019-04-07 Thread Bert Gunter
... 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,

Re: [R] Unable to read csv files with comma in values

2019-04-07 Thread Bert Gunter
... 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

Re: [R] Unable to read csv files with comma in values

2019-04-07 Thread Bert Gunter
(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

Re: [R] Unable to read csv files with comma in values

2019-04-07 Thread Duncan Murdoch
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

[R] Unable to read csv files with comma in values

2019-04-07 Thread Amit Govil
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

Re: [R] Help with use RMarkdown and knitr in an rdm output to word.doc

2019-04-07 Thread Bill Poling
Hi Jeff, yes guilty as charged, I do depend on copying snippets too much, then look for the documentation when it blows up. I will heed your advice and review further the help page for the rmarkdown::word_document and the other resources as well. Thanks again for taking the time Jeff I really h

Re: [R] Help with use RMarkdown and knitr in an rdm output to word.doc

2019-04-07 Thread Jeff Newmiller
The kable_styling function in your code does not appear in the example docx howto, so no, they are not the same. Bill, at some point you have to stop depending on copying snippets from blogs and read the function documentation, especially the arguments and values sections. The docs for the kabl

Re: [R] Help with use RMarkdown and knitr in an rdm output to word.doc

2019-04-07 Thread Bill Poling
Thanks Jeff, yes well I have followed the Harrison tutorial and my chunks are the same as his examples which appear to work fine for him? I am stymied. #https://www.datasurg.net/2018/05/22/finalfit-knitr-and-r-markdown-for-quick-results/ I will keep working on it though, many thanks. WHP Fr