Skip to content

how to transform string to variable name in a fuction?

4 messages · jingjiangyan, Wensui Liu, Gabor Grothendieck +1 more

#
try ?assign
On 12/26/06, jingjiangyan <jingjiangyan at gmail.com> wrote:

  
    
#
In the following the components of ss are the data frames in question:

ss <- split(df, df$aa)
On 12/26/06, jingjiangyan <jingjiangyan at gmail.com> wrote:
#
I believe the "split" function should work in this case.
 From the help file:

split(x, f, drop = FALSE, ...)
split(x, f, drop = FALSE, ...) <- value
unsplit(value, f, drop = FALSE)


      Arguments

|x| 	vector or data frame containing values to be divided into groups.
|f| 	a ?factor? in the sense that |as.factor <factor.html>(f)| defines 
the grouping, or a list of such factors in which case their interaction 
is used for the grouping.
|drop| 	logical indicating if levels that do not occur should be dropped 
(if |f| is a |factor| or a list).
|value| 	a list of vectors or data frames compatible with a splitting of 
|x|. Recycling applies if the lengths do not match.
|...| 	further potential arguments passed to methods.



Abhijit Dasgupta, Ph.D.

Assistant Professor | Division of Biostatistics
Department of Pharmacology and Experimental Therapeutics | Thomas 
Jefferson University
1015 Chestnut St | Suite M100 | Philadelphia, PA 19107
Ph: (215) 503-9201 | Fax: (215) 503-3804
jingjiangyan wrote: