Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package issues #3

Open
bweedop opened this issue Nov 18, 2016 · 4 comments
Open

Package issues #3

bweedop opened this issue Nov 18, 2016 · 4 comments
Assignees

Comments

@bweedop
Copy link
Member

bweedop commented Nov 18, 2016

I feel like this should be simple but I am missing something. My plants.r is calling for the 'terrain' matrix that originates from my terrain.r. When I do R CMD check, I get a note telling me that 'no visible binding for global variable: terrain'
How do I go about solving the problem of having an object on one .r and then using it on another .r without causing problems with the check?

@willpearse
Copy link
Member

  1. No variables in a package, only functions. It sounds like you are doing
    this.
  2. Make sure you have used @export on all your functions

Sorry to be brief it's 6pm I'm on the train
On Fri, 18 Nov 2016 at 17:17, bweedop notifications@github.com wrote:

Assigned #3 #3 to
@willpearse https://github.com/willpearse.


You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
#3 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABLcUtyjEWQSftZAiuoiC6zk8WJ0yOfJks5q_d2bgaJpZM4K2t5b
.

@bweedop
Copy link
Member Author

bweedop commented Nov 18, 2016

I don't think I have any variables in the package. The issue is that I have my run.eco function using the terrain matrix:
run.eco<-function(timesteps, ...){ plants <- array("", dim=c(dim(terra),timesteps+1)) for(i in seq_len(dim(plants)[3])) plants[,,i][is.na(terra)] <- NA for(k in (seq_len(dim(plants)[3]-1))) plants[,,k] <- plant.timestep(plants[,,k], info) k<-k+1 return(plants) }
and R CMD check checks my example:
plants<-run.eco(10)

The check gives me an error saying: object 'terra' not found

@willpearse
Copy link
Member

Right, I see. There is a bug in this function. You're using terra - is it
an argument to your function?
On Fri, 18 Nov 2016 at 18:14, bweedop notifications@github.com wrote:

I don't think I have any variables in the package. The issue is that I have
my run.eco function using the terrain matrix:
run.eco<-function(timesteps, ...){
plants <- array("", dim=c(dim(terra),timesteps+1))
for(i in seq_len(dim(plants)[3]))
plants[,,i][is.na(terra)] <- NA
for(k in (seq_len(dim(plants)[3]-1)))
plants[,,k] <- plant.timestep(plants[,,k], info)
k<-k+1
return(plants)
}
and R CMD check checks my example:
plants<-run.eco(10)

The check gives me an error saying: object 'terra' not found


You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
#3 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABLcUhD5bSHrlYjDs_0H1QgbTR0k9CDwks5q_er4gaJpZM4K2t5b
.

@bweedop
Copy link
Member Author

bweedop commented Nov 18, 2016

Right now it is not but I tried using it as an argument and it gave me the same error...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants