[R] BEGINNER: please help me to write my VERY simple function

Jason Turner jasont at indigoindustrial.co.nz
Tue Oct 21 11:52:33 CEST 2003


Michele Grassi wrote:

> Hi.
> 1)I have two variables: call a<-c(e.g.0,3,6,7...)
>                            b<-c(e.g.6,8,3,4...)
> I want to create a third vector z wich contain the 
> pairs values z<-c(0,6,3,8,6,3,7,4....and so on for each 
> pairs (a,b)).
> There is a specific function?
> How can i write my own function?
> 

For that, you don't need to.

help(expand.grid)


> 2)When i try to write a function and then i save it 
> like "function.R" file, i try to retrieve it with 
> source comand. As result i obtain an error 
> message "error in parse: sintax error on line...". I 
> apply deparse() and i see an incorrect parsing: how 
> avoid unwanted parsing?

I'm really not sure what you're trying to do with deparse here, but I 
don't think it's supposed to do what you meant.  The error message is 
what should be attended to - fix that with your favorite text editor.

Cheers

Jason
-- 
Indigo Industrial Controls Ltd.
http://www.indigoindustrial.co.nz
64-21-343-545
jasont at indigoindustrial.co.nz




More information about the R-help mailing list