[R] Data Frame Manipulation using function

Erik Iverson eriki at ccbr.umn.edu
Fri Jul 9 04:33:14 CEST 2010


> I have a data frame:
> 
>       id     url                                                         
> urlType
> 1     1      www.yahoo.com <http://www.yahoo.com>                       
>              1
> 2     2      www.google.com/?search= <http://www.google.com/?search=>   
>                   2
> 3     3      www.google.com <http://www.google.com>                     
>               1
> 4     4      www.yahoo.com/?query= <http://www.yahoo.com/?query=>       
>                 2
> 5     5      www.gmail.com <http://www.gmail.com>                       
>               1
> 

This is not output from ?dput, which means more work to read it in.

<snip>

> Here is the definition for WHITELIST:-
> 
> WHITELIST = "[?]query=, [?]search="
> WHITELIST <- unlist(trim(strsplit(trim(WHITELIST), ",")))

What is the 'trim' function?  I do not have that defined.

Perhaps David's answer will work for you...



More information about the R-help mailing list