kaitlyngaynor / gorongosa-mesocarnivores

2 stars 0 forks source link

what's the input? #80

Closed klg-2016 closed 4 years ago

klg-2016 commented 4 years ago

https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/blob/2336acd58af0118a01f8db2e98203f87ed8ae4a5/scripts/temporal-figure-functions.R#L4

OK I think I understand that this is creating a function to plot the daily activity patterns, but how do I tell what arguments it takes?

klg-2016 commented 4 years ago

OK I'm re-reading your email and trying to figure it out

kaitlyngaynor commented 4 years ago

The arguments are right there in the parentheses :)

A is the only required argument (you see it has no default value set) and this is should be the vector of sunTimes (so, dataframe$suntime if it's a column in a dataframe). The other arguments can be ignored - they just specify the size and the smoothing parameter, and polygoncol is the color of the polygon.

You can also look into the functions to see where each of these arguments (A, n.grid, kmax, polygoncol) pop up again.

kaitlyngaynor commented 4 years ago

Here's a good intro to function syntax just in case you are curious https://r4ds.had.co.nz/functions.html

klg-2016 commented 4 years ago

Thank you! That makes more sense.

I'm also running into issues using the functions from your script (temporal-figure-functions.R) in another script. I looked to see how to use functions you've created, and it said that you can either run the text in the console or use a line of code like this: source("scripts/temporal-figure-functions.R"). However, I can't get either of those to work. Can you think of something dumb I'm missing?

kaitlyngaynor commented 4 years ago

Hmm no, those should be the two approaches... just in case, you might load library(overlap) in case these functions somehow depend on it?

On Thu, Aug 27, 2020 at 7:28 AM klg-2016 notifications@github.com wrote:

Thank you! That makes more sense.

I'm also running into issues using the functions from your script (temporal-figure-functions.R) in another script. I looked to see how to use functions you've created, and it said that you can either run the text in the console or use a line of code like this: source("scripts/temporal-figure-functions.R"). However, I can't get either of those to work. Can you think of something dumb I'm missing?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/issues/80#issuecomment-681984784, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHA7WT5AYYICOURD34YO3D3SCZUSNANCNFSM4QNBL2QA .

klg-2016 commented 4 years ago

I just tried that, and restarted R. The functions are showing up in my environment, but not running when I try to use it. image

I also just copied and pasted the function code into the same script that I'm using to call it, and it's still throwing the same error >.<

kaitlyngaynor commented 4 years ago

I just tried to pull and run but it's not there - can you commit & push?

On Thu, Aug 27, 2020 at 7:37 AM klg-2016 notifications@github.com wrote:

I just tried that, and restarted R. The functions are showing up in my environment, but not running when I try to use it. [image: image] https://user-images.githubusercontent.com/66888714/91456242-06111800-e851-11ea-84f2-41033a53cf32.png

I also just copied and pasted the function code into the same script that I'm using to call it, and it's still throwing the same error >.<

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/issues/80#issuecomment-681989981, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHA7WT4SGLO4TL6D42MD37DSCZVSDANCNFSM4QNBL2QA .

-- Kaitlyn Gaynor Postdoctoral researcher National Center for Ecological Analysis and Synthesis University of California - Santa Barbara

klg-2016 commented 4 years ago

Just did! Sorry I restarted my computer real quick to see if that did anything

klg-2016 commented 4 years ago

(it didn't)

kaitlyngaynor commented 4 years ago

lol Katie it's cause you wrote timpeplot1 instead of timeplot1

klg-2016 commented 4 years ago

wooooooooooooooooooow

klg-2016 commented 4 years ago

I'm just sitting here laughing at myself. Thanks for helping me find a typo that I thought was a big error >.<

klg-2016 commented 4 years ago

eventually I would have noticed that? maybe?

kaitlyngaynor commented 4 years ago

haha no worries. will probably be less responsive throughout the day, so my new advice in the meantime is just 1) restart R and 2) double-check for typos hahah

klg-2016 commented 4 years ago

sounds good! will do. thanks for your help :)