Closed klg-2016 closed 4 years ago
Do you have the R Project open as a project?
This is a silly error ;) You shouldn't have the "gorongosa-mesocarnivores" in that file path
change to:
genet_dh <-read_csv("data/gorongosa-cameras/genet.csv")
Sorry I forgot I'd added the "gorongosa-mesocarnivores" in an attempt to get it to read--even without that there it gives the error. let me check to see if it's open as a project. Also, the y argument for the R function takes a list of matrices, so I'll have to convert these csvs to matrices when I get them in, right?
I also just reopened the project to ensure it was open and it's still giving the error. I'm going to try closing R completely and reopening
Weird. It's working for me.
You are also sure that the genet.csv is in that folder, right?
I AM getting other issues because it thinks that there are column names, and there aren't.
And yes, you can easily do that with the as.matrix() function. You can even pipe it into a matrix.
See here for all issues addressed:
genet_dh <-read_csv("data/gorongosa-cameras/genet.csv", col_names = FALSE) %>% as.matrix()
Also, you don't need to create a separate object called y... you could just do this in the function
unmarkedFrameOccuMulti(y = list(genet_dh, civet_dh, mongoose_dh), siteCovs = ... etc
I just double checked and "genet.csv" is indeed a file in the "gorongosa-cameras" folder of "data". I don't understand why my R is convinced I'm in the "scripts" folder as my working directory. I closed all my open scripts and RStudio and reopened and it's still cranky.
Also, you don't need to create a separate object called y... you could just do this in the function Got it, will do!
And the project is definitely open?
You see the little R studio badge and it says "gorongosa-mesocarnivores" in the top right?
this is my screen right now
I feel like I've spent the last few days trying to understand much higher level stuff and getting stumped by importing data feels rough haha
When I "go to working directory" it takes me to the project directory
Oh my gosh it's a dumb thing, I think it's because you are running the script within the Rmd file (you have "Chunk Output Inline" selected, I assume) rather than in your R environment. Click on the gear icon (to the right of the "Knit" button, left of the "Insert" button) and change to "Chunk Output in Console"
I always do this by default because I find it kind of annoying to have the output clogging up the Rmd script
YES that worked! I also was finding the ouput in the Rmd script annoying but I didn't even think to try to change it. Thank you!
https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/blob/e75f436b190ee23c46044308470ccbfac2bd106b/scripts/GNP-models.Rmd#L18
This is a super basic question that I'm very confused why it's not working--this line of code is returning the following error: Error: 'gorongosa-mesocarnivores/data/gorongosa-cameras/genet.csv' does not exist in current working directory ('C:/Users/kathr/OneDrive - Nexus365/BCM/Dissertation/Mesocarnivores/Modeling/gorongosa-mesocarnivores/scripts').
I thought the working directory was automatically set as 'gorongosa-mesocarnivores'? I tried to manually set the working directory to that, and it still gave an error.