[R] Object not Found Error on a .csv file

2014-01-16 Thread Valerie Shalin
Hello:

I am a new user, running the latest version of R on my Mac.  I have started by 
reading a file with the read.csv command:
task2analyses - read.csv(file=GroupsWithRTsEqualN.csv,head=TRUE,sep=,)

When I print it out in R, the file appears to be intact, with the proper 
headers.  Yet, when I run test commands like the following:
 cor(GfullUA,GFullUA) 

I get back a message Error in is.data.frame(y) : object 'GFullUA' not found

This is not the case for all of the variables in the file.  Some can be tested 
with is.numeric (or character). And some are read
properly when I test the summary command.  

I have looked on Google, and have been unsuccessful in searching documentation.

Thanks for any help,

Valerie Shalin
__
R-help@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.


Re: [R] Object not Found Error on a .csv file

2014-01-16 Thread Sarah Goslee
Hi Valerie,

Assuming GfullUA is a column of your data frame task2analyses, you
need to tell R where to look. It's trying to find an object called
GfullUA, and there isn't one.

Here are two ways:
with(task2analyses, cor(GfullUA, GFullUA))

cor(task2analyses$GfullUA, task2analyses$GFullUA)

You might want to read the Introduction to R that came with your
software installation.

Sarah

On Thu, Jan 16, 2014 at 1:32 PM, Valerie Shalin vale...@knoesis.org wrote:
 Hello:

 I am a new user, running the latest version of R on my Mac.  I have started 
 by reading a file with the read.csv command:
 task2analyses - read.csv(file=GroupsWithRTsEqualN.csv,head=TRUE,sep=,)

 When I print it out in R, the file appears to be intact, with the proper 
 headers.  Yet, when I run test commands like the following:
 cor(GfullUA,GFullUA)

 I get back a message Error in is.data.frame(y) : object 'GFullUA' not found

 This is not the case for all of the variables in the file.  Some can be 
 tested with is.numeric (or character). And some are read
 properly when I test the summary command.

 I have looked on Google, and have been unsuccessful in searching 
 documentation.

 Thanks for any help,

 Valerie Shalin

-- 
Sarah Goslee
http://www.functionaldiversity.org

__
R-help@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.


[R] object not found in a cca analysis with vegan package

2013-09-24 Thread Pierre Paradis
I'm a beginner, trying to do a canonical correspondance analysis with the vegan 
package, but I come up with that :  library(vegan)  abondance.txt - 
read.table(C:/Users/abondance.txt,header=T,sep=\t)  abondance - 
cca(abondance[,-c(1,2)]~altitude, data=abondance, nhea) Error in 
model.frame(data = abondance, na.action = function (object,  :   object 
'abondance' not found any ideas ? thanks !  

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] object not found in a cca analysis with vegan package

2013-09-24 Thread Pascal Oettli
Hello,

It is kindly requested to post in plain text. HTML is prohibited.

Your data are stored in abondance.txt, not in abondance.

Hope this helps,
Pascal



2013/9/25 Pierre Paradis exod...@hotmail.com

 I'm a beginner, trying to do a canonical correspondance analysis with the
 vegan package, but I come up with that :  library(vegan)  abondance.txt
 - read.table(C:/Users/abondance.txt,header=T,sep=\t)  abondance -
 cca(abondance[,-c(1,2)]~altitude, data=abondance, nhea) Error in
 model.frame(data = abondance, na.action = function (object,  :   object
 'abondance' not found any ideas ? thanks !
 [[alternative HTML version deleted]]

 __
 R-help@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.




-- 
Pascal Oettli
Project Scientist
JAMSTEC
Yokohama, Japan

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] object not found

2013-06-02 Thread Jannetta Steyn
Hi Jim

It is defined and initialised:
line 69 in the differential equation: dmCaT_soma_AB - (mCaTx(v_soma) -
mCaT_soma_AB)/taumCaT(v_soma)
 and initialised in line 83
dmCaT_soma_AB=0

However, l just noticed the mistake. It needs to be initialised without the
d, i.e. mCaT_soma_AB=0 and not dmCaT_soma_AB

Regards
Jannetta

Regards
Jannetta




On 2 June 2013 02:14, jim holtman jholt...@gmail.com wrote:

 I just did a search through the source and never did find a place that
 'mCaT_soma_AB'  was defined.  How can you expect to use it if it has not
 been defined.


 On Sat, Jun 1, 2013 at 8:50 PM, Jannetta Steyn janne...@henning.orgwrote:

 Hi All

 I am trying to implement a neural model in R from a paper but I have run
 into a bit of a problem. The model is getting so complex that I can't
 really test it in bits any more. At the moment I get this error:
 Error in eval(expr, envir, enclos) : object 'mCaT_soma_AB' not found

 I think I have been staring at it too long because I can't see what I have
 done wrong. Can anyone perhaps spot the error I have made. The full code
 is
 posted below.

 Many thanks
 Jannetta

 # TODO: Add comment
 #
 # Author: a9912577

 ###


 library(deSolve)

 ST -  function(time, init, parms) {
 with(as.list(c(init, parms)),{
  #functions to calculate activation m and inactivation h of the currents
 mNax - function(v) 1/(1+exp(-(v+24.7)/5.29));
 taumNa - function(v) 1.32 - (1.26/(1+exp(-v+120)/25));
 hNax - function(v) 1/(1+exp((v+48.9)/5.18));
 tauhNa - function(v) (0.67/(1+exp(-(v+62.9)/10))) *
 (1.5+1/(1+exp(v+34.9)/3.6));
 mCaTx - function(v) 1/(1+exp(-(v+25)/7.2))
 taumCaT - function(v) 55-(49.5/(1+exp(-(v+58)/17)))
 hCaTx - function(v) 1/(1+exp((v+36)/7))
 tauhCaT_AB -function(v) 87.5-(75/(1+exp(-(v+50)/16.9)))
 tauhCaT_PD -function(v) 350-(76/(1+exp(-(v+50)/16.9)))
 mCaSx - function(v) 1/(1+exp(-(v+22)/8.5))
 taumCaS - function(v) 16-(13.1/(1+exp(-(v+25.1)/26.5)))
 mNapx - function(v) 1 / (1+exp(-(v+26.8)/8.2))
 taumNap - function(v) 19.8-(10.7/(1+exp(-(v+26.5)/86.)))
 hNapx - function(v) 1/1+exp((v+48.5)/4.8)
 tauhNap - function(v) 666-(379/(1+exp(-(v+33.6)/11.7)))
 mhx -function(v) 1/(1+exp((v+70)/6))
 taumh - function(v) 272+(1499/(1+exp(-(v+42.2)/8.73)))
 mKx - function(v) 1/(1+exp(-(v+14.2)/11.8));
 taumK - function(v) 7.2-(6.4/(1+exp(-(v+28.3)/19.2)))
  # AB soma
 iCaT_soma_AB - gCaT_soma_AB * mCaT_soma_AB ^ 3 * hCaT_soma_AB * (v_soma -
 ECaT_soma_AB)
 iCaS_soma_AB - gCaS_soma_AB * mCaS_soma_AB ^ 3 * (v_soma - ECaS_soma_AB)
 iNap_soma_AB - gNap_soma_AB * mNap_soma_AB ^ 3 * hNap_soma_AB * (v_soma -
 ENap_soma_AB)
 ih_soma_AB - gh_soma_AB * mh_soma_AB ^ 3 * hh_soma_AB * (v_soma -
 Eh_soma_AB)
 iK_soma_AB - gK_soma_AB * mK_soma_AB ^ 4 * mK_soma_AB * (v_soma -
 EK_soma_AB)
 iKCa_soma_AB - gKCa_soma_AB * mKCa_soma_AB ^ 4 * (v_soma - EKCa_soma_AB)
 # Total current for Calcium
 totalICa - iCaT_soma_AB + iCaS_soma_AB
 # Differential equations
 dCaConc_soma - (-F_AB * totalICa - CaConc_soma + C0_AB)/tauCa_AB
  mKCax_AB - function(v, CaConc_soma)
 (CaConc_soma/(CaConc_soma+30))*(1/(1+exp(-(v+51)/4)))
 mKCax_PD - function(v, CaConc_soma)
 (CaConc_soma/(CaConc_soma+30))*(1/(1+epx(-(v+51)/8)))
 taumKCa -function(v) 90.3 - (75.09 / (1+exp(-(v+46)/22.7)))
 mAx - function(v) 1/(1+exp(-(v+27)/8.7))
 taumA - function(v) 11.6-(10.4/(1+exp(-(v+32.9)/15.2)))
 hAx - function(v) 1 / (1+exp((v+46.9)/4.9))
 tauhA - function(v) 38.6 - (29.2/(1+exp(-(v+38.9)/26.5)))
 mProcx - function(v) 1 / (1+exp(-(v+12)/3.05))
 taumProc - 0.5
  # Currents as product of maximal conducatance(g), activation(m) and
 inactivation(h)
 # Driving force (v-E) where E is the reversal potential of the particular
 ion
  # AB axon
 iNa_axon_AB - gNa_axon_AB * mNa_axon ^ 3 * hNa_axon * (v - ENa_axon_AB)
 iK_axon_AB - gK_axon_AB * mK_axon ^ 4 * (v - EK_axon_AB)
 iLeak_axon_AB - gLeak_axon_AB * (v - ELeak_axon_AB)
  dv - (0 - iNa_axon_AB - iK_axon_AB - iLeak_axon_AB) / C_axon_AB
 dmNa_axon_AB - (mNax(v) - mNa_axon_AB)/taumNa(v)
 dhNa_axon_AB - (hNax(v) - hNa_axon_AB)/tauhNa(v)
 dmK_axon_AB - (mKx(v) - mK_axon_AB)/taumK(v)
  dv_soma - (I - iCaT_soma_AB - iCaS_soma_AB - iNap_soma_AB - ih_soma_AB -
 iK_soma_AB - iKCa_soma_AB)
 dmCaT_soma_AB - (mCaTx(v_soma) - mCaT_soma_AB)/taumCaT(v_soma)
 dhCaT_soma_AB - (hCaTx(v_soma) - hCaT_soma_AB)/tauhCaT_AB(v_soma)
 dmCaS_soma_AB - (mCaSx(v_soma) - mCaS_soma_AB)/taumCaS(v_soma)
 dmNap_soma_AB - (mNapx(v_soma) - mNap_soma_AB)/taumNap(v_soma)
 dhNap_soma_AB - (hNapx(v_soma) - hNap_soma_AB)/tauhNap(v_soma)
 dmh_soma_AB - (mhx(v_soma) - mh_soma_AB)/taumh(v_soma)
 dmK_soma_AB - (mKx(v_soma) - mK_soma_AB)/taumK(v_soma)
 dmKCa_soma_AB - (mKCax_AB(v_soma,CaConc_soma) -
 mKCa_soma_AB)/taumKCa(v_soma)
  list(c(dv,dv_soma,dmNa_axon_AB, dhNa_axon_AB, dmK_axon_AB, dmCaT_soma_AB,
 dhCaT_soma_AB, dmCaS_soma_AB, dmNap_soma_AB, dhNap_soma_AB, dmh_soma_AB,
 dmK_soma_AB, dmKCa_soma_AB,dCaConc_soma))
  })}
 ## Set initial state
 

Re: [R] object not found

2013-06-02 Thread Jim Holtman
but that is not the variable that is not found. mCaT_soma_AB

Sent from my iPad

On Jun 2, 2013, at 4:12, Jannetta Steyn janne...@henning.org wrote:

 mCaT_soma_AB

__
R-help@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.


[R] object not found

2013-06-01 Thread Jannetta Steyn
Hi All

I am trying to implement a neural model in R from a paper but I have run
into a bit of a problem. The model is getting so complex that I can't
really test it in bits any more. At the moment I get this error:
Error in eval(expr, envir, enclos) : object 'mCaT_soma_AB' not found

I think I have been staring at it too long because I can't see what I have
done wrong. Can anyone perhaps spot the error I have made. The full code is
posted below.

Many thanks
Jannetta

# TODO: Add comment
#
# Author: a9912577
###


library(deSolve)

ST -  function(time, init, parms) {
with(as.list(c(init, parms)),{
 #functions to calculate activation m and inactivation h of the currents
mNax - function(v) 1/(1+exp(-(v+24.7)/5.29));
taumNa - function(v) 1.32 - (1.26/(1+exp(-v+120)/25));
hNax - function(v) 1/(1+exp((v+48.9)/5.18));
tauhNa - function(v) (0.67/(1+exp(-(v+62.9)/10))) *
(1.5+1/(1+exp(v+34.9)/3.6));
mCaTx - function(v) 1/(1+exp(-(v+25)/7.2))
taumCaT - function(v) 55-(49.5/(1+exp(-(v+58)/17)))
hCaTx - function(v) 1/(1+exp((v+36)/7))
tauhCaT_AB -function(v) 87.5-(75/(1+exp(-(v+50)/16.9)))
tauhCaT_PD -function(v) 350-(76/(1+exp(-(v+50)/16.9)))
mCaSx - function(v) 1/(1+exp(-(v+22)/8.5))
taumCaS - function(v) 16-(13.1/(1+exp(-(v+25.1)/26.5)))
mNapx - function(v) 1 / (1+exp(-(v+26.8)/8.2))
taumNap - function(v) 19.8-(10.7/(1+exp(-(v+26.5)/86.)))
hNapx - function(v) 1/1+exp((v+48.5)/4.8)
tauhNap - function(v) 666-(379/(1+exp(-(v+33.6)/11.7)))
mhx -function(v) 1/(1+exp((v+70)/6))
taumh - function(v) 272+(1499/(1+exp(-(v+42.2)/8.73)))
mKx - function(v) 1/(1+exp(-(v+14.2)/11.8));
taumK - function(v) 7.2-(6.4/(1+exp(-(v+28.3)/19.2)))
 # AB soma
iCaT_soma_AB - gCaT_soma_AB * mCaT_soma_AB ^ 3 * hCaT_soma_AB * (v_soma -
ECaT_soma_AB)
iCaS_soma_AB - gCaS_soma_AB * mCaS_soma_AB ^ 3 * (v_soma - ECaS_soma_AB)
iNap_soma_AB - gNap_soma_AB * mNap_soma_AB ^ 3 * hNap_soma_AB * (v_soma -
ENap_soma_AB)
ih_soma_AB - gh_soma_AB * mh_soma_AB ^ 3 * hh_soma_AB * (v_soma -
Eh_soma_AB)
iK_soma_AB - gK_soma_AB * mK_soma_AB ^ 4 * mK_soma_AB * (v_soma -
EK_soma_AB)
iKCa_soma_AB - gKCa_soma_AB * mKCa_soma_AB ^ 4 * (v_soma - EKCa_soma_AB)
# Total current for Calcium
totalICa - iCaT_soma_AB + iCaS_soma_AB
# Differential equations
dCaConc_soma - (-F_AB * totalICa - CaConc_soma + C0_AB)/tauCa_AB
 mKCax_AB - function(v, CaConc_soma)
(CaConc_soma/(CaConc_soma+30))*(1/(1+exp(-(v+51)/4)))
mKCax_PD - function(v, CaConc_soma)
(CaConc_soma/(CaConc_soma+30))*(1/(1+epx(-(v+51)/8)))
taumKCa -function(v) 90.3 - (75.09 / (1+exp(-(v+46)/22.7)))
mAx - function(v) 1/(1+exp(-(v+27)/8.7))
taumA - function(v) 11.6-(10.4/(1+exp(-(v+32.9)/15.2)))
hAx - function(v) 1 / (1+exp((v+46.9)/4.9))
tauhA - function(v) 38.6 - (29.2/(1+exp(-(v+38.9)/26.5)))
mProcx - function(v) 1 / (1+exp(-(v+12)/3.05))
taumProc - 0.5
 # Currents as product of maximal conducatance(g), activation(m) and
inactivation(h)
# Driving force (v-E) where E is the reversal potential of the particular
ion
 # AB axon
iNa_axon_AB - gNa_axon_AB * mNa_axon ^ 3 * hNa_axon * (v - ENa_axon_AB)
iK_axon_AB - gK_axon_AB * mK_axon ^ 4 * (v - EK_axon_AB)
iLeak_axon_AB - gLeak_axon_AB * (v - ELeak_axon_AB)
 dv - (0 - iNa_axon_AB - iK_axon_AB - iLeak_axon_AB) / C_axon_AB
dmNa_axon_AB - (mNax(v) - mNa_axon_AB)/taumNa(v)
dhNa_axon_AB - (hNax(v) - hNa_axon_AB)/tauhNa(v)
dmK_axon_AB - (mKx(v) - mK_axon_AB)/taumK(v)
 dv_soma - (I - iCaT_soma_AB - iCaS_soma_AB - iNap_soma_AB - ih_soma_AB -
iK_soma_AB - iKCa_soma_AB)
dmCaT_soma_AB - (mCaTx(v_soma) - mCaT_soma_AB)/taumCaT(v_soma)
dhCaT_soma_AB - (hCaTx(v_soma) - hCaT_soma_AB)/tauhCaT_AB(v_soma)
dmCaS_soma_AB - (mCaSx(v_soma) - mCaS_soma_AB)/taumCaS(v_soma)
dmNap_soma_AB - (mNapx(v_soma) - mNap_soma_AB)/taumNap(v_soma)
dhNap_soma_AB - (hNapx(v_soma) - hNap_soma_AB)/tauhNap(v_soma)
dmh_soma_AB - (mhx(v_soma) - mh_soma_AB)/taumh(v_soma)
dmK_soma_AB - (mKx(v_soma) - mK_soma_AB)/taumK(v_soma)
dmKCa_soma_AB - (mKCax_AB(v_soma,CaConc_soma) -
mKCa_soma_AB)/taumKCa(v_soma)
 list(c(dv,dv_soma,dmNa_axon_AB, dhNa_axon_AB, dmK_axon_AB, dmCaT_soma_AB,
dhCaT_soma_AB, dmCaS_soma_AB, dmNap_soma_AB, dhNap_soma_AB, dmh_soma_AB,
dmK_soma_AB, dmKCa_soma_AB,dCaConc_soma))
 })}
## Set initial state
init = c(dv=-55,dv_soma=-55,dmNa_axon_AB=0, dhNa_axon_AB=0, dmK_axon_AB=0,
dmCaT_soma_AB=0, dhCaT_soma_AB=0, dmCaS_soma_AB=0, dmNap_soma_AB=0,
dhNap_soma_AB=0, dmh_soma_AB=0, dmK_soma_AB=0,
dmKCa_soma_AB=0,dCaConc_soma=0)
## Set parameters
F_AB=0.418
C0_AB=0.5
tauCa_AB=303

ENa_axon_AB=50
EK_axon_AB=-80
ELeak_axon_AB=-60

gNa_axon_AB=0.300
gK_axon_AB=0.0525
gLeak_axon_AB=20

C_axon_AB=0.0015

ECaT_soma_AB=55.2e-3
ECaS_soma_AB=9e-3
ENap_soma_AB=50
Eh_soma_AB=-20
EK_soma_AB=-80
EKCa_soma_AB=-80
EA_soma_AB=-8
EP_soma_AB=0
ELeak_soma_AB=-50

gCaT_soma_AB=55.2e-3
gCaS_soma_AB=9e-3
gNap_soma_AB=2.7e-3
gh_soma_AB=0.00054
gK_soma_AB=0.0525
gKCa_soma_AB=0.600
gA_soma_AB=0.0216
gP_soma_AB=0.570
gLeak_soma_AB=0.45
gAxial_soma_AB=0.003

Re: [R] object not found

2013-06-01 Thread jim holtman
I just did a search through the source and never did find a place that
'mCaT_soma_AB'  was defined.  How can you expect to use it if it has not
been defined.


On Sat, Jun 1, 2013 at 8:50 PM, Jannetta Steyn janne...@henning.org wrote:

 Hi All

 I am trying to implement a neural model in R from a paper but I have run
 into a bit of a problem. The model is getting so complex that I can't
 really test it in bits any more. At the moment I get this error:
 Error in eval(expr, envir, enclos) : object 'mCaT_soma_AB' not found

 I think I have been staring at it too long because I can't see what I have
 done wrong. Can anyone perhaps spot the error I have made. The full code is
 posted below.

 Many thanks
 Jannetta

 # TODO: Add comment
 #
 # Author: a9912577

 ###


 library(deSolve)

 ST -  function(time, init, parms) {
 with(as.list(c(init, parms)),{
  #functions to calculate activation m and inactivation h of the currents
 mNax - function(v) 1/(1+exp(-(v+24.7)/5.29));
 taumNa - function(v) 1.32 - (1.26/(1+exp(-v+120)/25));
 hNax - function(v) 1/(1+exp((v+48.9)/5.18));
 tauhNa - function(v) (0.67/(1+exp(-(v+62.9)/10))) *
 (1.5+1/(1+exp(v+34.9)/3.6));
 mCaTx - function(v) 1/(1+exp(-(v+25)/7.2))
 taumCaT - function(v) 55-(49.5/(1+exp(-(v+58)/17)))
 hCaTx - function(v) 1/(1+exp((v+36)/7))
 tauhCaT_AB -function(v) 87.5-(75/(1+exp(-(v+50)/16.9)))
 tauhCaT_PD -function(v) 350-(76/(1+exp(-(v+50)/16.9)))
 mCaSx - function(v) 1/(1+exp(-(v+22)/8.5))
 taumCaS - function(v) 16-(13.1/(1+exp(-(v+25.1)/26.5)))
 mNapx - function(v) 1 / (1+exp(-(v+26.8)/8.2))
 taumNap - function(v) 19.8-(10.7/(1+exp(-(v+26.5)/86.)))
 hNapx - function(v) 1/1+exp((v+48.5)/4.8)
 tauhNap - function(v) 666-(379/(1+exp(-(v+33.6)/11.7)))
 mhx -function(v) 1/(1+exp((v+70)/6))
 taumh - function(v) 272+(1499/(1+exp(-(v+42.2)/8.73)))
 mKx - function(v) 1/(1+exp(-(v+14.2)/11.8));
 taumK - function(v) 7.2-(6.4/(1+exp(-(v+28.3)/19.2)))
  # AB soma
 iCaT_soma_AB - gCaT_soma_AB * mCaT_soma_AB ^ 3 * hCaT_soma_AB * (v_soma -
 ECaT_soma_AB)
 iCaS_soma_AB - gCaS_soma_AB * mCaS_soma_AB ^ 3 * (v_soma - ECaS_soma_AB)
 iNap_soma_AB - gNap_soma_AB * mNap_soma_AB ^ 3 * hNap_soma_AB * (v_soma -
 ENap_soma_AB)
 ih_soma_AB - gh_soma_AB * mh_soma_AB ^ 3 * hh_soma_AB * (v_soma -
 Eh_soma_AB)
 iK_soma_AB - gK_soma_AB * mK_soma_AB ^ 4 * mK_soma_AB * (v_soma -
 EK_soma_AB)
 iKCa_soma_AB - gKCa_soma_AB * mKCa_soma_AB ^ 4 * (v_soma - EKCa_soma_AB)
 # Total current for Calcium
 totalICa - iCaT_soma_AB + iCaS_soma_AB
 # Differential equations
 dCaConc_soma - (-F_AB * totalICa - CaConc_soma + C0_AB)/tauCa_AB
  mKCax_AB - function(v, CaConc_soma)
 (CaConc_soma/(CaConc_soma+30))*(1/(1+exp(-(v+51)/4)))
 mKCax_PD - function(v, CaConc_soma)
 (CaConc_soma/(CaConc_soma+30))*(1/(1+epx(-(v+51)/8)))
 taumKCa -function(v) 90.3 - (75.09 / (1+exp(-(v+46)/22.7)))
 mAx - function(v) 1/(1+exp(-(v+27)/8.7))
 taumA - function(v) 11.6-(10.4/(1+exp(-(v+32.9)/15.2)))
 hAx - function(v) 1 / (1+exp((v+46.9)/4.9))
 tauhA - function(v) 38.6 - (29.2/(1+exp(-(v+38.9)/26.5)))
 mProcx - function(v) 1 / (1+exp(-(v+12)/3.05))
 taumProc - 0.5
  # Currents as product of maximal conducatance(g), activation(m) and
 inactivation(h)
 # Driving force (v-E) where E is the reversal potential of the particular
 ion
  # AB axon
 iNa_axon_AB - gNa_axon_AB * mNa_axon ^ 3 * hNa_axon * (v - ENa_axon_AB)
 iK_axon_AB - gK_axon_AB * mK_axon ^ 4 * (v - EK_axon_AB)
 iLeak_axon_AB - gLeak_axon_AB * (v - ELeak_axon_AB)
  dv - (0 - iNa_axon_AB - iK_axon_AB - iLeak_axon_AB) / C_axon_AB
 dmNa_axon_AB - (mNax(v) - mNa_axon_AB)/taumNa(v)
 dhNa_axon_AB - (hNax(v) - hNa_axon_AB)/tauhNa(v)
 dmK_axon_AB - (mKx(v) - mK_axon_AB)/taumK(v)
  dv_soma - (I - iCaT_soma_AB - iCaS_soma_AB - iNap_soma_AB - ih_soma_AB -
 iK_soma_AB - iKCa_soma_AB)
 dmCaT_soma_AB - (mCaTx(v_soma) - mCaT_soma_AB)/taumCaT(v_soma)
 dhCaT_soma_AB - (hCaTx(v_soma) - hCaT_soma_AB)/tauhCaT_AB(v_soma)
 dmCaS_soma_AB - (mCaSx(v_soma) - mCaS_soma_AB)/taumCaS(v_soma)
 dmNap_soma_AB - (mNapx(v_soma) - mNap_soma_AB)/taumNap(v_soma)
 dhNap_soma_AB - (hNapx(v_soma) - hNap_soma_AB)/tauhNap(v_soma)
 dmh_soma_AB - (mhx(v_soma) - mh_soma_AB)/taumh(v_soma)
 dmK_soma_AB - (mKx(v_soma) - mK_soma_AB)/taumK(v_soma)
 dmKCa_soma_AB - (mKCax_AB(v_soma,CaConc_soma) -
 mKCa_soma_AB)/taumKCa(v_soma)
  list(c(dv,dv_soma,dmNa_axon_AB, dhNa_axon_AB, dmK_axon_AB, dmCaT_soma_AB,
 dhCaT_soma_AB, dmCaS_soma_AB, dmNap_soma_AB, dhNap_soma_AB, dmh_soma_AB,
 dmK_soma_AB, dmKCa_soma_AB,dCaConc_soma))
  })}
 ## Set initial state
 init = c(dv=-55,dv_soma=-55,dmNa_axon_AB=0, dhNa_axon_AB=0, dmK_axon_AB=0,
 dmCaT_soma_AB=0, dhCaT_soma_AB=0, dmCaS_soma_AB=0, dmNap_soma_AB=0,
 dhNap_soma_AB=0, dmh_soma_AB=0, dmK_soma_AB=0,
 dmKCa_soma_AB=0,dCaConc_soma=0)
 ## Set parameters
 F_AB=0.418
 C0_AB=0.5
 tauCa_AB=303

 ENa_axon_AB=50
 EK_axon_AB=-80
 ELeak_axon_AB=-60

 gNa_axon_AB=0.300
 gK_axon_AB=0.0525
 gLeak_axon_AB=20

 C_axon_AB=0.0015

 

[R] object '---' not found

2012-04-10 Thread MLE
Hi, 
I am very new to R and the stats world. I have enjoyed working with R so far
but I have come across an error message in a very simple command that I am
unable to resolve. 

I bring data in through excel .csv files and check them to be sure R reads
them correctly and has everything assigned as it is in the excel file. It
looks good. But simple computations are not working

 sd(VIQ)
Error in sd(VIQ) : object 'VIQ' not found

I copied the object out of the R table of the data, I know it is correct. 

Thank you in advance and for understanding my greenness.

Emily

--
View this message in context: 
http://r.789695.n4.nabble.com/object-not-found-tp4546367p4546367.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] object '---' not found

2012-04-10 Thread jim holtman
If you brought the data in from Excel, it is probably a dataframe.
You probably need to read the Intro to R on how to access
information in a dataframe.

You should at least show what you did.  most likely VIQ is a column in
your Excel file and depending on how you read it in, you would
probably access via

dataframe$VIQ

On Tue, Apr 10, 2012 at 1:26 PM, MLE emily.ha...@gmail.com wrote:
 Hi,
 I am very new to R and the stats world. I have enjoyed working with R so far
 but I have come across an error message in a very simple command that I am
 unable to resolve.

 I bring data in through excel .csv files and check them to be sure R reads
 them correctly and has everything assigned as it is in the excel file. It
 looks good. But simple computations are not working

 sd(VIQ)
 Error in sd(VIQ) : object 'VIQ' not found

 I copied the object out of the R table of the data, I know it is correct.

 Thank you in advance and for understanding my greenness.

 Emily

 --
 View this message in context: 
 http://r.789695.n4.nabble.com/object-not-found-tp4546367p4546367.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@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.



-- 
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.

__
R-help@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.


Re: [R] object not found - Can not figure out why I get this error: Error in NROW(yCoordinatesOfLines) : object 'low' not found

2012-02-12 Thread ilai
Ah, scoping rules...
Consider:
f - function(x,...) plot(x,xlim=c(low,high),...)
f(1:10,low=2,high=9)  # Error ...  object 'low' not found 

But:

f - function(x,low,high,...) plot(x,xlim=c(low,high),...)
f(1:10,2,9,col=2)  # beautiful red points [low,high]

Sorry I can't be more specific but never heard of quantmod.
Hope this helps anyway.


On Sat, Feb 11, 2012 at 7:43 AM, Samo Pahor samo.pa...@gmail.com wrote:
 Hi,

 I have been using R for over a year now. I am a very happy user. Thank you
 for making this happen.

 This is my first question to this list.

 I trying to add some functions to quantmod that would enable me to draw
 arbitrary lines and text and make sure they are redrawn. I have created
 following function:

 require(quantmod)

 # Add horizontal line to graph produced by quantmod::chart_Series()
 add_HorizontalLine-function(yCoordinatesOfLines, on=1, ...) {
    lenv - new.env()
    lenv$add_horizontalline - function(x, yCoordinatesOfLines, ...) {
        xdata - x$Env$xdata
        xsubset - x$Env$xsubset

        x0coords - rep(1, NROW(yCoordinatesOfLines))
        x1coords - rep(NROW(xdata[xsubset]), NROW(yCoordinatesOfLines))

        if ((NROW(x0coords)  0)  (NROW(x1coords)  0)) {
            segments(x0coords,
                     yCoordinatesOfLines,
                     x1coords,
                     yCoordinatesOfLines, ...)
 #            abline(h=yCoordinatesOfLines, ...)
        }
    }
    mapply(function(name, value) {assign(name,value,envir=lenv)},
 names(list(yCoordinatesOfLines=yCoordinatesOfLines,...)),
 list(yCoordinatesOfLines=yCoordinatesOfLines,...))
    exp - parse(text=gsub(list,add_horizontalline,
 as.expression(substitute(list(x=current.chob(),

 yCoordinatesOfLines=yCoordinatesOfLines, ..., srcfile=NULL)
    plot_object - current.chob()
    lenv$xdata - plot_object$Env$xdata
 #    plot_object$set_frame(sign(on)*abs(on)+1L)
    plot_object$set_frame(2*on)
    plot_object$add(exp,env=c(lenv, plot_object$Env),expr=TRUE)
    plot_object
 }

 # Short test function that uses add_HorizontalLine
 test-function(series, low=20, high=80) {
    chart_Series(SPX, subset=2012)
    add_TA(RSI(Cl(SPX)))
    plot(add_HorizontalLine(c(low, high), on=2, col=c('green', 'red'),
 lwd=2))
 }

 # Actual test
 SPX - getSymbols(^GSPC, from=2000-01-01, auto.assign=FALSE)
 dev.new()
 test(SPX)

 This gives me the following error:
 test(SPX)
 Error in NROW(yCoordinatesOfLines) : object 'low' not found

 What am I doing wrong here? Any hints highly appreciated.

 The funniest thing is that this was working and somehow broke it...

 Best,
 Samo

        [[alternative HTML version deleted]]

 __
 R-help@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.

__
R-help@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.


[R] object not found - Can not figure out why I get this error: Error in NROW(yCoordinatesOfLines) : object 'low' not found

2012-02-11 Thread Samo Pahor
Hi,

I have been using R for over a year now. I am a very happy user. Thank you
for making this happen.

This is my first question to this list.

I trying to add some functions to quantmod that would enable me to draw
arbitrary lines and text and make sure they are redrawn. I have created
following function:

require(quantmod)

# Add horizontal line to graph produced by quantmod::chart_Series()
add_HorizontalLine-function(yCoordinatesOfLines, on=1, ...) {
lenv - new.env()
lenv$add_horizontalline - function(x, yCoordinatesOfLines, ...) {
xdata - x$Env$xdata
xsubset - x$Env$xsubset

x0coords - rep(1, NROW(yCoordinatesOfLines))
x1coords - rep(NROW(xdata[xsubset]), NROW(yCoordinatesOfLines))

if ((NROW(x0coords)  0)  (NROW(x1coords)  0)) {
segments(x0coords,
 yCoordinatesOfLines,
 x1coords,
 yCoordinatesOfLines, ...)
#abline(h=yCoordinatesOfLines, ...)
}
}
mapply(function(name, value) {assign(name,value,envir=lenv)},
names(list(yCoordinatesOfLines=yCoordinatesOfLines,...)),
list(yCoordinatesOfLines=yCoordinatesOfLines,...))
exp - parse(text=gsub(list,add_horizontalline,
as.expression(substitute(list(x=current.chob(),

yCoordinatesOfLines=yCoordinatesOfLines, ..., srcfile=NULL)
plot_object - current.chob()
lenv$xdata - plot_object$Env$xdata
#plot_object$set_frame(sign(on)*abs(on)+1L)
plot_object$set_frame(2*on)
plot_object$add(exp,env=c(lenv, plot_object$Env),expr=TRUE)
plot_object
}

# Short test function that uses add_HorizontalLine
test-function(series, low=20, high=80) {
chart_Series(SPX, subset=2012)
add_TA(RSI(Cl(SPX)))
plot(add_HorizontalLine(c(low, high), on=2, col=c('green', 'red'),
lwd=2))
}

# Actual test
SPX - getSymbols(^GSPC, from=2000-01-01, auto.assign=FALSE)
dev.new()
test(SPX)

This gives me the following error:
 test(SPX)
Error in NROW(yCoordinatesOfLines) : object 'low' not found

What am I doing wrong here? Any hints highly appreciated.

The funniest thing is that this was working and somehow broke it...

Best,
Samo

[[alternative HTML version deleted]]

__
R-help@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.


[R] Object not found using GAMs in MGCV Package

2012-01-16 Thread ruggeddon24
This is my first time running GAMs in R.
My csv file has these column headings:

X Y Sound Atlantic  Blacktip  Bonnet   
Bull  Finetooth Lemon Scalloped Sandbar   Spinner  
Abundance Diversity Depth Distance  Width System   
Channel   Profile  Bathy Slope Salinity
 X is longitude and Y is Latitude.

I typed in the code below and received the reply Error in eval(expr, envir,
enclos) : object 'Atlantic' not found.

 library(mgcv)
This is mgcv 1.7-6. For overview type 'help(mgcv-package)'.
 help(mgcv-package)
starting httpd help server ... done
 gam(Atlantic ~ s(depth, bs=sos, k=4) + s(distance, bs=sos, k=4))
Error in eval(expr, envir, enclos) : object 'Atlantic' not found

I do not have a clue how to fix this problem. Do I have too many variables
or do I need to remove my x and y from the file? This data is being used to
assess the spatial distribution of shark abundance in relation to
environmental variables. I really cannot remove the x and y anyway. Help
would be greatly appreciated.

--
View this message in context: 
http://r.789695.n4.nabble.com/Object-not-found-using-GAMs-in-MGCV-Package-tp4301836p4301836.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] Object not found using GAMs in MGCV Package

2012-01-16 Thread Sarah Goslee
See inline:

On Mon, Jan 16, 2012 at 6:29 PM, ruggeddon24 smithdon2...@gmail.com wrote:
 This is my first time running GAMs in R.
 My csv file has these column headings:

 X         Y         Sound     Atlantic  Blacktip  Bonnet
 Bull      Finetooth Lemon     Scalloped Sandbar   Spinner
 Abundance Diversity Depth     Distance  Width     System
 Channel   Profile  Bathy     Slope     Salinity
  X is longitude and Y is Latitude.

Your csv file? You read it into R with read.table() or read.csv(), right?

 I typed in the code below and received the reply Error in eval(expr, envir,
 enclos) : object 'Atlantic' not found.

 library(mgcv)
 This is mgcv 1.7-6. For overview type 'help(mgcv-package)'.
 help(mgcv-package)
 starting httpd help server ... done
 gam(Atlantic ~ s(depth, bs=sos, k=4) + s(distance, bs=sos, k=4))
 Error in eval(expr, envir, enclos) : object 'Atlantic' not found

You need the data=mydataframe argument to gam(), with whatever the name
of your data frame is. Otherwise R has no idea where to look for Atlantic,
so it just looks for an object with that name, which there isn't.

 I do not have a clue how to fix this problem. Do I have too many variables
 or do I need to remove my x and y from the file? This data is being used to
 assess the spatial distribution of shark abundance in relation to
 environmental variables. I really cannot remove the x and y anyway. Help
 would be greatly appreciated.

Sarah

-- 
Sarah Goslee
http://www.functionaldiversity.org

__
R-help@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.


Re: [R] Object not found using GAMs in MGCV Package

2012-01-16 Thread Jorge I Velez
Hi,

If x is your data, then

gam(Atlantic ~ s(depth, bs=sos, k=4) + s(distance, bs=sos, k=4), data =
x)

will do.  See examples in ?gam.

BTW, how did you read your data in R?  What's the output of ls()?

HTH,
Jorge
*

*

On Mon, Jan 16, 2012 at 6:29 PM, ruggeddon24  wrote:

 This is my first time running GAMs in R.
 My csv file has these column headings:

 X Y Sound Atlantic  Blacktip  Bonnet
 Bull  Finetooth Lemon Scalloped Sandbar   Spinner
 Abundance Diversity Depth Distance  Width System
 Channel   Profile  Bathy Slope Salinity
  X is longitude and Y is Latitude.

 I typed in the code below and received the reply Error in eval(expr,
 envir,
 enclos) : object 'Atlantic' not found.

  library(mgcv)
 This is mgcv 1.7-6. For overview type 'help(mgcv-package)'.
  help(mgcv-package)
 starting httpd help server ... done
  gam(Atlantic ~ s(depth, bs=sos, k=4) + s(distance, bs=sos, k=4))
 Error in eval(expr, envir, enclos) : object 'Atlantic' not found

 I do not have a clue how to fix this problem. Do I have too many variables
 or do I need to remove my x and y from the file? This data is being used to
 assess the spatial distribution of shark abundance in relation to
 environmental variables. I really cannot remove the x and y anyway. Help
 would be greatly appreciated.

 --
 View this message in context:
 http://r.789695.n4.nabble.com/Object-not-found-using-GAMs-in-MGCV-Package-tp4301836p4301836.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@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.


[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Object not found using GAMs in MGCV Package

2012-01-16 Thread Jorge I Velez
Hi Dontrece,

It looks like you do not have an object Final in your active session.
 Could you please show us how you read your data, e.g., what commands you
used and what's the result of ls()?

As Sarah Goslee mentioned in an earlier post, you probably used
read.table() or read.csv() but you haven't told us (yet).

Regards,
Jorge.-


On Mon, Jan 16, 2012 at 7:04 PM, Dontrece Smith  wrote:

 Now, it read this:

  library(mgcv)
 This is mgcv 1.7-6. For overview type 'help(mgcv-package)'.
  gam(Atlantic ~ s(depth, bs=sos, k=4) + s(distance, bs=sos, k=4),
 data = Final)
 Error in inherits(x, data.frame) : object 'Final' not found


 On 1/16/12, Jorge I Velez jorgeivanve...@gmail.com wrote:
  Hi,
 
  If x is your data, then
 
  gam(Atlantic ~ s(depth, bs=sos, k=4) + s(distance, bs=sos, k=4),
 data =
  x)
 
  will do.  See examples in ?gam.
 
  BTW, how did you read your data in R?  What's the output of ls()?
 
  HTH,
  Jorge
  *
 
  *
 
  On Mon, Jan 16, 2012 at 6:29 PM, ruggeddon24  wrote:
 
  This is my first time running GAMs in R.
  My csv file has these column headings:
 
  X Y Sound Atlantic  Blacktip  Bonnet
  Bull  Finetooth Lemon Scalloped Sandbar   Spinner
  Abundance Diversity Depth Distance  Width System
  Channel   Profile  Bathy Slope Salinity
   X is longitude and Y is Latitude.
 
  I typed in the code below and received the reply Error in eval(expr,
  envir,
  enclos) : object 'Atlantic' not found.
 
   library(mgcv)
  This is mgcv 1.7-6. For overview type 'help(mgcv-package)'.
   help(mgcv-package)
  starting httpd help server ... done
   gam(Atlantic ~ s(depth, bs=sos, k=4) + s(distance, bs=sos, k=4))
  Error in eval(expr, envir, enclos) : object 'Atlantic' not found
 
  I do not have a clue how to fix this problem. Do I have too many
 variables
  or do I need to remove my x and y from the file? This data is being used
  to
  assess the spatial distribution of shark abundance in relation to
  environmental variables. I really cannot remove the x and y anyway. Help
  would be greatly appreciated.
 
  --
  View this message in context:
 
 http://r.789695.n4.nabble.com/Object-not-found-using-GAMs-in-MGCV-Package-tp4301836p4301836.html
  Sent from the R help mailing list archive at Nabble.com.
 
  __
  R-help@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.
 
 


 --
 Dontrece Smith
 Graduate Student
 Savannah State University
 4906 Taylor Road
 Savannah, GA 31404
 (770) 401-3371


[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Object not found using GAMs in MGCV Package

2012-01-16 Thread Dontrece Smith
Now, it read this:

 library(mgcv)
This is mgcv 1.7-6. For overview type 'help(mgcv-package)'.
 gam(Atlantic ~ s(depth, bs=sos, k=4) + s(distance, bs=sos, k=4), data = 
 Final)
Error in inherits(x, data.frame) : object 'Final' not found


On 1/16/12, Jorge I Velez jorgeivanve...@gmail.com wrote:
 Hi,

 If x is your data, then

 gam(Atlantic ~ s(depth, bs=sos, k=4) + s(distance, bs=sos, k=4), data =
 x)

 will do.  See examples in ?gam.

 BTW, how did you read your data in R?  What's the output of ls()?

 HTH,
 Jorge
 *

 *

 On Mon, Jan 16, 2012 at 6:29 PM, ruggeddon24  wrote:

 This is my first time running GAMs in R.
 My csv file has these column headings:

 X Y Sound Atlantic  Blacktip  Bonnet
 Bull  Finetooth Lemon Scalloped Sandbar   Spinner
 Abundance Diversity Depth Distance  Width System
 Channel   Profile  Bathy Slope Salinity
  X is longitude and Y is Latitude.

 I typed in the code below and received the reply Error in eval(expr,
 envir,
 enclos) : object 'Atlantic' not found.

  library(mgcv)
 This is mgcv 1.7-6. For overview type 'help(mgcv-package)'.
  help(mgcv-package)
 starting httpd help server ... done
  gam(Atlantic ~ s(depth, bs=sos, k=4) + s(distance, bs=sos, k=4))
 Error in eval(expr, envir, enclos) : object 'Atlantic' not found

 I do not have a clue how to fix this problem. Do I have too many variables
 or do I need to remove my x and y from the file? This data is being used
 to
 assess the spatial distribution of shark abundance in relation to
 environmental variables. I really cannot remove the x and y anyway. Help
 would be greatly appreciated.

 --
 View this message in context:
 http://r.789695.n4.nabble.com/Object-not-found-using-GAMs-in-MGCV-Package-tp4301836p4301836.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@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.




-- 
Dontrece Smith
Graduate Student
Savannah State University
4906 Taylor Road
Savannah, GA 31404
(770) 401-3371

__
R-help@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.


Re: [R] Object not found using GAMs in MGCV Package

2012-01-16 Thread Dontrece Smith
I used:

 Final - read.csv(Final.csv, header=TRUE)


On 1/16/12, Jorge I Velez jorgeivanve...@gmail.com wrote:
 Hi Dontrece,

 It looks like you do not have an object Final in your active session.
  Could you please show us how you read your data, e.g., what commands you
 used and what's the result of ls()?

 As Sarah Goslee mentioned in an earlier post, you probably used
 read.table() or read.csv() but you haven't told us (yet).

 Regards,
 Jorge.-


 On Mon, Jan 16, 2012 at 7:04 PM, Dontrece Smith  wrote:

 Now, it read this:

  library(mgcv)
 This is mgcv 1.7-6. For overview type 'help(mgcv-package)'.
  gam(Atlantic ~ s(depth, bs=sos, k=4) + s(distance, bs=sos, k=4),
 data = Final)
 Error in inherits(x, data.frame) : object 'Final' not found


 On 1/16/12, Jorge I Velez jorgeivanve...@gmail.com wrote:
  Hi,
 
  If x is your data, then
 
  gam(Atlantic ~ s(depth, bs=sos, k=4) + s(distance, bs=sos, k=4),
 data =
  x)
 
  will do.  See examples in ?gam.
 
  BTW, how did you read your data in R?  What's the output of ls()?
 
  HTH,
  Jorge
  *
 
  *
 
  On Mon, Jan 16, 2012 at 6:29 PM, ruggeddon24  wrote:
 
  This is my first time running GAMs in R.
  My csv file has these column headings:
 
  X Y Sound Atlantic  Blacktip  Bonnet
  Bull  Finetooth Lemon Scalloped Sandbar   Spinner
  Abundance Diversity Depth Distance  Width System
  Channel   Profile  Bathy Slope Salinity
   X is longitude and Y is Latitude.
 
  I typed in the code below and received the reply Error in eval(expr,
  envir,
  enclos) : object 'Atlantic' not found.
 
   library(mgcv)
  This is mgcv 1.7-6. For overview type 'help(mgcv-package)'.
   help(mgcv-package)
  starting httpd help server ... done
   gam(Atlantic ~ s(depth, bs=sos, k=4) + s(distance, bs=sos, k=4))
  Error in eval(expr, envir, enclos) : object 'Atlantic' not found
 
  I do not have a clue how to fix this problem. Do I have too many
 variables
  or do I need to remove my x and y from the file? This data is being
  used
  to
  assess the spatial distribution of shark abundance in relation to
  environmental variables. I really cannot remove the x and y anyway.
  Help
  would be greatly appreciated.
 
  --
  View this message in context:
 
 http://r.789695.n4.nabble.com/Object-not-found-using-GAMs-in-MGCV-Package-tp4301836p4301836.html
  Sent from the R help mailing list archive at Nabble.com.
 
  __
  R-help@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.
 
 


 --
 Dontrece Smith
 Graduate Student
 Savannah State University
 4906 Taylor Road
 Savannah, GA 31404
 (770) 401-3371




-- 
Dontrece Smith
Graduate Student
Savannah State University
4906 Taylor Road
Savannah, GA 31404
(770) 401-3371

__
R-help@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.


Re: [R] Object not found using GAMs in MGCV Package

2012-01-16 Thread R. Michael Weylandt michael.weyla...@gmail.com
That should work: you are using it before the call to gam?

Try this (verbatim)

library(mgcv)
Final - read.csv(Final.csv)

ls.str()
search()
sessionInfo()

gam(Atlantic ~ s(depth, bs=sos, k=4) + s(distance, bs=sos, k=4), data = 
Final)

and give the output. 

Michael 

On Jan 16, 2012, at 7:13 PM, Dontrece Smith smithdon2...@gmail.com wrote:

 I used:
 
 Final - read.csv(Final.csv, header=TRUE)
 
 
 On 1/16/12, Jorge I Velez jorgeivanve...@gmail.com wrote:
 Hi Dontrece,
 
 It looks like you do not have an object Final in your active session.
 Could you please show us how you read your data, e.g., what commands you
 used and what's the result of ls()?
 
 As Sarah Goslee mentioned in an earlier post, you probably used
 read.table() or read.csv() but you haven't told us (yet).
 
 Regards,
 Jorge.-
 
 
 On Mon, Jan 16, 2012 at 7:04 PM, Dontrece Smith  wrote:
 
 Now, it read this:
 
 library(mgcv)
 This is mgcv 1.7-6. For overview type 'help(mgcv-package)'.
 gam(Atlantic ~ s(depth, bs=sos, k=4) + s(distance, bs=sos, k=4),
 data = Final)
 Error in inherits(x, data.frame) : object 'Final' not found
 
 
 On 1/16/12, Jorge I Velez jorgeivanve...@gmail.com wrote:
 Hi,
 
 If x is your data, then
 
 gam(Atlantic ~ s(depth, bs=sos, k=4) + s(distance, bs=sos, k=4),
 data =
 x)
 
 will do.  See examples in ?gam.
 
 BTW, how did you read your data in R?  What's the output of ls()?
 
 HTH,
 Jorge
 *
 
 *
 
 On Mon, Jan 16, 2012 at 6:29 PM, ruggeddon24  wrote:
 
 This is my first time running GAMs in R.
 My csv file has these column headings:
 
 X Y Sound Atlantic  Blacktip  Bonnet
 Bull  Finetooth Lemon Scalloped Sandbar   Spinner
 Abundance Diversity Depth Distance  Width System
 Channel   Profile  Bathy Slope Salinity
 X is longitude and Y is Latitude.
 
 I typed in the code below and received the reply Error in eval(expr,
 envir,
 enclos) : object 'Atlantic' not found.
 
 library(mgcv)
 This is mgcv 1.7-6. For overview type 'help(mgcv-package)'.
 help(mgcv-package)
 starting httpd help server ... done
 gam(Atlantic ~ s(depth, bs=sos, k=4) + s(distance, bs=sos, k=4))
 Error in eval(expr, envir, enclos) : object 'Atlantic' not found
 
 I do not have a clue how to fix this problem. Do I have too many
 variables
 or do I need to remove my x and y from the file? This data is being
 used
 to
 assess the spatial distribution of shark abundance in relation to
 environmental variables. I really cannot remove the x and y anyway.
 Help
 would be greatly appreciated.
 
 --
 View this message in context:
 
 http://r.789695.n4.nabble.com/Object-not-found-using-GAMs-in-MGCV-Package-tp4301836p4301836.html
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@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.
 
 
 
 
 --
 Dontrece Smith
 Graduate Student
 Savannah State University
 4906 Taylor Road
 Savannah, GA 31404
 (770) 401-3371
 
 
 
 
 -- 
 Dontrece Smith
 Graduate Student
 Savannah State University
 4906 Taylor Road
 Savannah, GA 31404
 (770) 401-3371
 
 __
 R-help@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.


[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Object not found using GAMs in MGCV Package

2012-01-16 Thread Don McKenzie
And note how Michael has changed your code so that your data object  
is now named Final instead of Final.csv.


On 16-Jan-12, at 5:16 PM, R. Michael Weylandt  
michael.weyla...@gmail.com wrote:



That should work: you are using it before the call to gam?

Try this (verbatim)

library(mgcv)
Final - read.csv(Final.csv)

ls.str()
search()
sessionInfo()

gam(Atlantic ~ s(depth, bs=sos, k=4) + s(distance, bs=sos,  
k=4), data = Final)


and give the output.

Michael

On Jan 16, 2012, at 7:13 PM, Dontrece Smith  
smithdon2...@gmail.com wrote:



I used:


Final - read.csv(Final.csv, header=TRUE)



On 1/16/12, Jorge I Velez jorgeivanve...@gmail.com wrote:

Hi Dontrece,

It looks like you do not have an object Final in your active  
session.
Could you please show us how you read your data, e.g., what  
commands you

used and what's the result of ls()?

As Sarah Goslee mentioned in an earlier post, you probably used
read.table() or read.csv() but you haven't told us (yet).

Regards,
Jorge.-


On Mon, Jan 16, 2012 at 7:04 PM, Dontrece Smith  wrote:


Now, it read this:


library(mgcv)

This is mgcv 1.7-6. For overview type 'help(mgcv-package)'.
gam(Atlantic ~ s(depth, bs=sos, k=4) + s(distance, bs=sos,  
k=4),

data = Final)
Error in inherits(x, data.frame) : object 'Final' not found


On 1/16/12, Jorge I Velez jorgeivanve...@gmail.com wrote:

Hi,

If x is your data, then

gam(Atlantic ~ s(depth, bs=sos, k=4) + s(distance, bs=sos,  
k=4),

data =

x)

will do.  See examples in ?gam.

BTW, how did you read your data in R?  What's the output of ls()?

HTH,
Jorge
*

*

On Mon, Jan 16, 2012 at 6:29 PM, ruggeddon24  wrote:


This is my first time running GAMs in R.
My csv file has these column headings:

X Y Sound Atlantic  Blacktip   
Bonnet
Bull  Finetooth Lemon Scalloped Sandbar
Spinner
Abundance Diversity Depth Distance  Width  
System

Channel   Profile  Bathy Slope Salinity
X is longitude and Y is Latitude.

I typed in the code below and received the reply Error in eval 
(expr,

envir,
enclos) : object 'Atlantic' not found.


library(mgcv)

This is mgcv 1.7-6. For overview type 'help(mgcv-package)'.

help(mgcv-package)

starting httpd help server ... done
gam(Atlantic ~ s(depth, bs=sos, k=4) + s(distance,  
bs=sos, k=4))

Error in eval(expr, envir, enclos) : object 'Atlantic' not found

I do not have a clue how to fix this problem. Do I have too many

variables
or do I need to remove my x and y from the file? This data is  
being

used
to
assess the spatial distribution of shark abundance in relation to
environmental variables. I really cannot remove the x and y  
anyway.

Help
would be greatly appreciated.

--
View this message in context:

http://r.789695.n4.nabble.com/Object-not-found-using-GAMs-in- 
MGCV-Package-tp4301836p4301836.html

Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.







--
Dontrece Smith
Graduate Student
Savannah State University
4906 Taylor Road
Savannah, GA 31404
(770) 401-3371






--
Dontrece Smith
Graduate Student
Savannah State University
4906 Taylor Road
Savannah, GA 31404
(770) 401-3371

__
R-help@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.



[[alternative HTML version deleted]]

__
R-help@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.





Don McKenzie, Research Ecologist
Pacific Wildland Fire Sciences Lab
US Forest Service
phone: 206-732-7824

Affiliate Professor
School of Environmental and Forest Sciences
University of Washington

__
R-help@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.


[R] object not found with %dopar% when using foreach

2011-05-27 Thread Nicolas Berkowitsch

Dear R-List member,

 tried implement the foreach loop. It works fine, when I'm using %do%, 
but not when I'm using %dopar%.

I always receive one of the following error messages:

error in { : task 1 failed - Objekt 'S3' not found - could the 
.export  be an solution for this??

Any help is much appreciated!

The Code hast the following structure:
##
dft3 = function (...) {
...
}
optDFT = function (...)
...
for (sit in 1:n.sit){
S3 = ...
pDFT3 = ... dft3(..)
}
return(LL.DFT)
}
foreach(k=1:n.run)  %dopar% {
for (j in 1:n.subj) {
...
valuesDFT = nlminb(start=..., objective = optDFT)
}
}

--



lic. phil. Nicolas A. J. Berkowitsch
Universität Basel
Fakultät für Psychologie
Economic Psychology
Missionsstrasse 62a
CH-4055 Basel

Tel. +41 61 267 05 75
E-Mail   nicolas.berkowit...@unibas.ch
Web  
http://psycho.unibas.ch/abteilungen/abteilung-details/home/abteilung/economic-psychology/

__
R-help@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.


[R] object not found inside step() function

2009-11-16 Thread shuai yuan
Hi, there,

My appologize if someone ask the same question before. I searched the
mailing list and found one similar post, but not what i want.

The problem for me is, I use the step( glm()) to do naive forward
selection for logistic regression.  My code is functional
in the open environment. But if I wrap it up as a function, then R keeps
saying object 'a' not found. Actually,  data frame
a is inside the function.

I did some search online. i guess the reason may be R did not keep the data
in glm() output after building the model but not sure.
Can anyone please tell me how to work around this problem?

Thanks a lot in advance.

I am using R 2.9.0. Here is the sample code:

#
naivelr-function(x,y){
:
:
:

a-data.frame(x)

form-paste(y~1+,paste(grep(X.*,names(a),value=T),collapse=+),sep=)

if(is.null(force.in)!=T){
lowmo-paste(y~1+,paste(grep(X.*,names(a)[force.in],value=T),collapse=+),sep=)

} else
{lowmo-y~1}

lower1-glm(lowmo,family=binomial,data=data.frame(a,y))
upper1-glm(form,family=binomial,data=data.frame(a,y))


stepout-step(lower1,scope=list(lower=lower1,upper=upper1),direction=forward,k=0,trace=100)
# here is the error:Start:
#AIC=689.62
#y ~ 1
#Error in data.frame(a, y) : object 'a' not found---but a is there!
:
:
:
}




 Sincerely

samer yuan

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] object not found inside step() function

2009-11-16 Thread David Winsemius


On Nov 16, 2009, at 2:31 PM, shuai yuan wrote:


Hi, there,

My appologize if someone ask the same question before. I searched the
mailing list and found one similar post, but not what i want.

The problem for me is, I use the step( glm()) to do naive forward
selection for logistic regression.  My code is functional
in the open environment. But if I wrap it up as a function, then R  
keeps

saying object 'a' not found. Actually,  data frame
a is inside the function.

I did some search online. i guess the reason may be R did not keep  
the data

in glm() output after building the model but not sure.
Can anyone please tell me how to work around this problem?

Thanks a lot in advance.

I am using R 2.9.0. Here is the sample code:

#
naivelr-function(x,y){
:
:
:

a-data.frame(x)

form- 
paste(y~1+,paste(grep(X.*,names(a),value=T),collapse=+),sep=)


if(is.null(force.in)!=T){
lowmo-paste(y~1+,paste(grep(X.*,names(a) 
[force.in],value=T),collapse=+),sep=)


} else
{lowmo-y~1}

lower1-glm(lowmo,family=binomial,data=data.frame(a,y))
upper1-glm(form,family=binomial,data=data.frame(a,y))


You are sticking data.frame= a inside another data.frame 




stepout- 
step 
(lower1 
,scope 
=list(lower=lower1,upper=upper1),direction=forward,k=0,trace=100)


Thats not the way I remember step-ping. I thought you made a fit and  
then stepped the formulas (using the same data), rather putting the  
whole glm object into a lower and an upper. I could be wrong about  
that since I try to avoid using stepwise methods.



# here is the error:Start:
#AIC=689.62
#y ~ 1
#Error in data.frame(a, y) : object 'a' not found---but a is there!


But it's probably not in a form that can be interpreted. Consider  
adding y as a column in a.


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
R-help@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.


Re: [R] object not found inside step() function

2009-11-16 Thread shuai yuan
Thanks David.

My code is ok if I did not wrap it up. The problem poped up after i make it
as a function.
In my step() call, i just make it a little bit more general.

I do not like stepwise method too, but need it as a comparison.



samer



On Mon, Nov 16, 2009 at 3:03 PM, David Winsemius dwinsem...@comcast.netwrote:


 On Nov 16, 2009, at 2:31 PM, shuai yuan wrote:

 Hi, there,

 My appologize if someone ask the same question before. I searched the
 mailing list and found one similar post, but not what i want.

 The problem for me is, I use the step( glm()) to do naive forward
 selection for logistic regression.  My code is functional
 in the open environment. But if I wrap it up as a function, then R keeps
 saying object 'a' not found. Actually,  data frame
 a is inside the function.

 I did some search online. i guess the reason may be R did not keep the
 data
 in glm() output after building the model but not sure.
 Can anyone please tell me how to work around this problem?

 Thanks a lot in advance.

 I am using R 2.9.0. Here is the sample code:

 #
 naivelr-function(x,y){
 :
 :
 :

 a-data.frame(x)


 form-paste(y~1+,paste(grep(X.*,names(a),value=T),collapse=+),sep=)

 if(is.null(force.in)!=T){
 lowmo-paste(y~1+,paste(grep(X.*,names(a)[force.in
 ],value=T),collapse=+),sep=)

 } else
 {lowmo-y~1}

 lower1-glm(lowmo,family=binomial,data=data.frame(a,y))
 upper1-glm(form,family=binomial,data=data.frame(a,y))


 You are sticking data.frame= a inside another data.frame 





 stepout-step(lower1,scope=list(lower=lower1,upper=upper1),direction=forward,k=0,trace=100)


 Thats not the way I remember step-ping. I thought you made a fit and then
 stepped the formulas (using the same data), rather putting the whole glm
 object into a lower and an upper. I could be wrong about that since I
 try to avoid using stepwise methods.


 # here is the error:Start:
 #AIC=689.62
 #y ~ 1
 #Error in data.frame(a, y) : object 'a' not found---but a is there!


 But it's probably not in a form that can be interpreted. Consider adding y
 as a column in a.

 David Winsemius, MD
 Heritage Laboratories
 West Hartford, CT



[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] object not found within function

2009-11-03 Thread tlumley

On Mon, 2 Nov 2009, Thushyanthan Baskaran wrote:


Hi,

I am trying to write a function to compute many cross-tabulations with the 
-svytable- command. Here is a simplified example of the structure of my code 
(adapted from the -svytable- help file):


In the 'survey' package -- if you say what package you are using, people don't 
have to guess.



data(api)
func.example-function(variable){ dclus1-svydesign(id=~1, 
weights=~pw,data=apiclus1, fpc=~fpc)


svytable(~ variable, dclus1)

}
 When I call this function with:

func.example(api99)

I get the following error:


Error in eval(expr, envir, enclos) : object 'variable' not found.


Yes, that's because you don't have a variable called 'variable' in the design 
object.


(Everything works fine when I type svytable(~ api99, dclus1).)

I guess that the problem has something to do with function environments


Not really. It has to do with how formulas are evaluated.   To get substitution 
into a formula you need to use substitute() or bquote().  You also need to stop 
the argument being evaluated before it gets to the svytable() call, and this 
sort of non-standard evaluation is not recommended unless you really need it.


The easiest solution is to pass a formula, not a variable

f.example1 - function(formula){
   dclus1-svydesign(id=~1,  weights=~pw,data=apiclus1, fpc=~fpc)
   svytable(formula, dclus1)
}

f.example1(~comp.imp)

The next easiest way is to pass a character string

f.example2 - function(varname){
   dclus1-svydesign(id=~1,  weights=~pw,data=apiclus1, fpc=~fpc)
   formula-make.formula(varname)
   svytable(formula, dclus1)
}

f.example2(comp.imp)

The next easiest way is to pass a quoted symbol

f.example3 - function(variable){
   dclus1-svydesign(id=~1,  weights=~pw,data=apiclus1, fpc=~fpc)
   eval(bquote(svytable(~.(variable), dclus1)))
}

f.example3(quote(comp.imp))

and a really ugly solution is to use non-standard evaluation to avoid the 
quote()

f.example4 - function(variable){
   v-substitute(variable)
   dclus1-svydesign(id=~1,  weights=~pw,data=apiclus1, fpc=~fpc)
   eval(bquote(svytable(~.(v), dclus1)))
}

f.example4(comp.imp)


There's a good reason why the survey packages uses the first style, not the 
last one.  Occasionally, as with subset() or with(), you need to supply 
arbitrary expressions and evaluate them somewhere else than the default 
location, but this sort of thing really should be avoided if there is any 
alternative.  It's just too hard to extend and maintain.


  -thomas

Thomas Lumley   Assoc. Professor, Biostatistics
tlum...@u.washington.eduUniversity of Washington, Seattle

__
R-help@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.


Re: [R] object not found within function

2009-11-03 Thread Thushyanthan Baskaran


Hi Thomas,

sorry, I should have mentioned that I was using the survey package. But 
thank you very much for your quick response. Your first solution worked 
perfectly.


Best,

Thushyanthan



tlum...@u.washington.edu wrote:

On Mon, 2 Nov 2009, Thushyanthan Baskaran wrote:


Hi,

I am trying to write a function to compute many cross-tabulations 
with the -svytable- command. Here is a simplified example of the 
structure of my code (adapted from the -svytable- help file):


In the 'survey' package -- if you say what package you are using, 
people don't have to guess.




data(api)
func.example-function(variable){ dclus1-svydesign(id=~1, 
weights=~pw,data=apiclus1, fpc=~fpc)


svytable(~ variable, dclus1)

}
 When I call this function with:

func.example(api99)

I get the following error:


Error in eval(expr, envir, enclos) : object 'variable' not found.


Yes, that's because you don't have a variable called 'variable' in the 
design object.



(Everything works fine when I type svytable(~ api99, dclus1).)

I guess that the problem has something to do with function environments


Not really. It has to do with how formulas are evaluated.   To get 
substitution into a formula you need to use substitute() or bquote().  
You also need to stop the argument being evaluated before it gets to 
the svytable() call, and this sort of non-standard evaluation is not 
recommended unless you really need it.



The easiest solution is to pass a formula, not a variable

f.example1 - function(formula){
   dclus1-svydesign(id=~1,  weights=~pw,data=apiclus1, fpc=~fpc)
   svytable(formula, dclus1)
}

f.example1(~comp.imp)

The next easiest way is to pass a character string

f.example2 - function(varname){
   dclus1-svydesign(id=~1,  weights=~pw,data=apiclus1, fpc=~fpc)
   formula-make.formula(varname)
   svytable(formula, dclus1)
}

f.example2(comp.imp)

The next easiest way is to pass a quoted symbol

f.example3 - function(variable){
   dclus1-svydesign(id=~1,  weights=~pw,data=apiclus1, fpc=~fpc)
   eval(bquote(svytable(~.(variable), dclus1)))
}

f.example3(quote(comp.imp))

and a really ugly solution is to use non-standard evaluation to avoid 
the quote()


f.example4 - function(variable){
   v-substitute(variable)
   dclus1-svydesign(id=~1,  weights=~pw,data=apiclus1, fpc=~fpc)
   eval(bquote(svytable(~.(v), dclus1)))
}

f.example4(comp.imp)


There's a good reason why the survey packages uses the first style, 
not the last one.  Occasionally, as with subset() or with(), you need 
to supply arbitrary expressions and evaluate them somewhere else than 
the default location, but this sort of thing really should be avoided 
if there is any alternative.  It's just too hard to extend and maintain.



  -thomas

Thomas LumleyAssoc. Professor, Biostatistics
tlum...@u.washington.eduUniversity of Washington, Seattle




__
R-help@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.


Re: [R] object not found within function

2009-11-03 Thread Uwe Ligges



Thushyanthan Baskaran wrote:

Hi,

I am trying to write a function to compute many cross-tabulations with 
the -svytable- command. Here is a simplified example of the structure of 
my code (adapted from the -svytable- help file):




data(api)
func.example-function(variable){ dclus1-svydesign(id=~1, 
weights=~pw,data=apiclus1, fpc=~fpc)


svytable(~ variable, dclus1)

}
  When I call this function with:

func.example(api99)



What are api, api99, svytable, svydesign etc?


Uwe Ligges





I get the following error:


Error in eval(expr, envir, enclos) : object 'variable' not found.
(Everything works fine when I type svytable(~ api99, dclus1).)

I guess that the problem has something to do with function environments, 
but since I am new to R, I can't seem to figure out how to rectify the 
code.

I am running R version 2.10 on Windows Vista.
Thanks for the help!

Thushyanthan

__
R-help@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.


__
R-help@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.


[R] object not found within function

2009-11-02 Thread Thushyanthan Baskaran

Hi,

I am trying to write a function to compute many cross-tabulations with the 
-svytable- command. Here is a simplified example of the structure of my code 
(adapted from the -svytable- help file):



data(api)
func.example-function(variable){ 
dclus1-svydesign(id=~1, weights=~pw,data=apiclus1, fpc=~fpc)


svytable(~ variable, dclus1)

}
  
When I call this function with:


func.example(api99)

I get the following error:


Error in eval(expr, envir, enclos) : object 'variable' not found. 


(Everything works fine when I type svytable(~ api99, dclus1).)

I guess that the problem has something to do with function environments, but since I am new to R, I can't seem to figure out how to rectify the code. 

I am running R version 2.10 on Windows Vista. 


Thanks for the help!

Thushyanthan

__
R-help@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.


[R] Object not found

2009-05-22 Thread Gaertner, Stefanie
Hello,

I run into a problem:

 ftable(table(Fire, Standard, StoAll), col.vars=c(Fire,Standard))
Error in table(Fire, Standard, StoAll) : object 'Fire' not found

I do not understand that because when I read the table everything seems
correct.


Stocking_all-read.table(P://Benchmark//analysis//r//stocking_10//stock
ing_all.csv,header=TRUE,sep=,)
 names(Stocking_all)
 [1] ID_basic_tallesttree FID_plot Fire

 [4] Time_FireStandard Fire_Standard

 [7] ESR  Fire_Stand   StoARS2000

[10] StoWAS2008   StoAll 

And I also get a summary for the variables.  I have no clue and would
very much appreciate your help.
Stefanie



[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Object not found

2009-05-22 Thread jim holtman
You read them into a dataframe so you need to do

ftable(table(Stocking_all$Fire, Stocking_all$Standard, StoAll),
col.vars=c(Fire,Standard))


On Fri, May 22, 2009 at 2:33 PM, Gaertner, Stefanie 
stefanie.gaert...@ales.ualberta.ca wrote:

 Hello,

 I run into a problem:

  ftable(table(Fire, Standard, StoAll), col.vars=c(Fire,Standard))
 Error in table(Fire, Standard, StoAll) : object 'Fire' not found

 I do not understand that because when I read the table everything seems
 correct.

 
 Stocking_all-read.table(P://Benchmark//analysis//r//stocking_10//stock
 ing_all.csv,header=TRUE,sep=,)
  names(Stocking_all)
  [1] ID_basic_tallesttree FID_plot Fire

  [4] Time_FireStandard Fire_Standard

  [7] ESR  Fire_Stand   StoARS2000

 [10] StoWAS2008   StoAll

 And I also get a summary for the variables.  I have no clue and would
 very much appreciate your help.
 Stefanie



[[alternative HTML version deleted]]

 __
 R-help@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.htmlhttp://www.r-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

[[alternative HTML version deleted]]

__
R-help@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.