

Hi all

A couple of questions about string processing from someone who has only scratched the surface so far.

1) I am wanting to send some strings into a function to allow flexibility inside.  My first idea has been e.g.

auto_io <- function( var_string, factors ) {
#  e.g. var_string sent as "test_file.txt"  factors sent as "x1 + x2 + x3"

# input
	data_name 				<- get( var_string )
	
#	term_list 				<- get( factors )
	
	resp_data 				<- read.table( data_name, header = TRUE )
		
# fit
	temp_model 			<-  lm( y ~ factors, data = resp_data )

	etc...

Neither the read.table() nor the lm() are working because in each case the string is not converted or understood properly.  I'm sure this is possible (and in fact probably easy) but haven't yet seen the light.  Could someone illuminate me here?

2) I will be wanting to process strings as lists of strings.  For instance, I might instead want to send factors above as "x1  x2  x3" and add the "+" when I need them, or perhaps "*" instead, and also look at sub-models by removing parts of the string etc.  What functions should I be looking at here and are there any examples available?

Thanks in advance.  Feel free to CC me on your reply.


Michael Hopkins
Algorithm and Statistical Modelling Expert
 
Upstream
23 Old Bond Street
London
W1S 4PZ

Mob +44 0782 578 7220
DL   +44 0207 290 1326
Fax  +44 0207 290 1321

hopkins@upstreamsystems.com
www.upstreamsystems.com
 
IMPORTANT NOTICE
The information in this e-mail and any attached files is...{{dropped:22}}

