[R] using a package function inside another function

Andrew Miles rstuff.miles at gmail.com
Thu Oct 7 18:09:26 CEST 2010


Try adding a statement at the beginning of your function:

require(micEcon)

See if that helps.

Andrew Miles
Department of Sociology
Duke University

On Oct 7, 2010, at 11:47 AM, Alison Callahan wrote:

> Hello all,
>
> I am trying to use the micEcon 'insertRow' function inside a function
> I have written. For example:
>
> insert_row_test <- function(m){
>
>  insertRow(m,nrow(m)+1,v=0,rName="test")
>
> }
>
> However, when I try to call the 'insert_row_test' function (after
> loading the micEcon package), it does not insert a row into the matrix
> I pass in. When I call the insertRow function exactly as above in the
> R console, it works with no problem.
>
> Can anyone tell me why this is, and how to fix this problem?
>
> Thank you!
>
> Alison Callahan
> PhD candidate
> Department of Biology
> Carleton University
>
> ______________________________________________
> 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