[R] small problem in coding

Nick Sabbe nick.sabbe at ugent.be
Fri Nov 26 10:14:03 CET 2010


Hello Mike.

I'm not clear on why you would want to "state your g parameter" (In fact, I
don't even know for sure what you mean by that) with
> lamda<-c(g=0.2)

If you want a variable (vector) g containing 0.2, why don't you simply do:
> g<-0.2
If you need that lamda thing for some reason later on, you can always do:
> lamda<-c(g=g)
Afterwards to get the same effect.

If you have some reason not to do this:
With your statement, you create a vector lamda, with one item in it, and
that first and only item is named "g".
So from your statement, you can access g by: 
lamda["g"]
as in:
> Q<-exp(lamda["g"])

It looks like you've got a misunderstanding of how R variables work, but
maybe I just misunderstood your question...

HTH,


Nick Sabbe
--
ping: nick.sabbe at ugent.be
link: http://biomath.ugent.be
wink: A1.056, Coupure Links 653, 9000 Gent
ring: 09/264.59.36

-- Do Not Disapprove


-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Mike Gibson
Sent: vrijdag 26 november 2010 9:13
To: r-help at r-project.org
Subject: [R] small problem in coding


I must be missing something.  
 
I first state my g parameter with:  
 
> lamda<-c(g=0.2)

However, when I do the next step R is telling me "object g not found"  Here
is my next step:  
 
> Q<-exp(g)
 
 
???  
 
Any help would be greatly appreciated.  
 
Mike 		 	   		  
	[[alternative HTML version deleted]]

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list