Hello,

>
> Suppose I have a data frame with mixed content (name age and address).
>
> a<-"Name: John Smith Age: 35 Address: 32, street, sub, something"
> b<-data.frame(a)
>
> Since it is dataframe,  assumption is you stored data in the columns as
Name, Age, Address, sub etc.

> 1. The question is I want to extract the name age and
> address separately from this data frame (containing potentially more
> people).
>
a$Name will extract all data in the column "Name" similarly for other
information. Which you can assign to other variable.


>
> 2. Also just incase I have to deal with it how would the syntax change if I
> had "Name" as opposed to "Name:" (without the colon).
>
One can handle slightly different words with agrep command.
How ever, your situation can be different.  May be this is what you can use
to proceed further.

You can use agrep command with option max.distance to extract or handle

>
>

agrep("name",f,max.distance=0.1)

or

  "Name|Name:" may work in your situation.

-- 
Manjusha S. Joshi

blog:http://manjushajoshi.wordpress.com/

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to