Re: [R] Some questions about string processing

2010-09-27 Thread Michael Hopkins
Thanks Phil, very helpful and works as advertised. Any thoughts on the second question? (P.S. for anyone digging this up in the future, there's a comma missing after the formula in lm()) On 24 Sep 2010, at 18:16, Phil Spector wrote: Michael - You're doing too much work half the time,

[R] Some questions about string processing

2010-09-24 Thread Michael Hopkins
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

Re: [R] Some questions about string processing

2010-09-24 Thread Phil Spector
Michael - You're doing too much work half the time, and not enough the other half :-). Try this (untested): auto_io = function(data_name,factors){ resp_data = read.table(data_name, header = TRUE ) temp_model = lm(formula(paste('y',factors,sep='~')) data = resp_data ) .