[R] Help with numeric and character separation

Sam Charya @@mch@ry@ @end|ng |rom y@hoo@com@@u
Tue Jun 18 06:18:24 CEST 2019

 Hi Bert and Jeff,
Thanks a lot for your response. I have been able to solve the problem with pointers added from people who responded. 
My original dataset was in the form of a vector, my desired goal is to convert it into a data.frame. which I have been able to do.
Thanks again for all your help. 'regexr' is still something I am digging into...
sam.  **********************************

    On Sunday, 16 June 2019, 10:28:17 pm GMT+5:30, Bert Gunter <bgunter.4567 using gmail.com> wrote:  
 1. Post in **plain text** not  html, please.
2. This looks like a vector, not a data frame. 

3. Use ?strsplit:
> ex <- "a.1"
> strsplit(ex,"\\.")
[1] "a" "1"
See ?regex  for info on regular expressions in R.If you are confused about the data structures of input or output, time to spend time with basic R tutorials.
-- Bert
Bert Gunter

"The trouble with having an open mind is that people keep coming along and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

On Sun, Jun 16, 2019 at 8:47 AM Sam Charya via R-help <r-help using r-project.org> wrote:

 Dear All,

I need help with splitting a string. My data frame is in the following format:
                      V11            DD Pack0.002   FTA English News0.003  FTA Complimentary0.004                 WB1.185               WION1.186         Al Jazeera0.007      Animal Planet2.368    Asianet Movies17.709      Calcutta News0.0010    Comedy Central5.90
I read the file from a csv and set header = False, hence the name: V1. 
The data consists of names of TV Channels and their prices. For example: Row 1: Name of the Channel is 'DD Pack' and the Price is 0.00.similarly for Row 5, the name of the Channel is 'WION' and the price is 1.18.
similarly for Row 8: The name of the Channel is 'Asianet Movies' and the price is 17.70. 

My question is: How would I separate the data into 2 columns: One for the Channel name and one for the Price. 
For example. The Heading should be for Col1: 'Channel Name' and for Col2: 'Price'The data under  'Channel Name' should be 'DD Pack' and for 'Price' should be 0.00 and so on and so forth. 
The letters and the numeric appears together and I am not being able to use a separator and I am not being able to figure this out. Kindly please help me with this. 
Many Thanks in advance for your help. This is my first  question ever to the community so apologies if I have made a mistake in sending it to the wrong groups - kindly direct if that is the case. 

        [[alternative HTML version deleted]]

R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

	[[alternative HTML version deleted]]

More information about the R-help mailing list