edquant / edh7916

Course materials and website for EDH7916: Contemporary Research in Higher Education
https://edquant.github.io/edh7916/
3 stars 1 forks source link

FYI, Error in read_csv() : could not find function "read_csv" #30

Closed nszekeres closed 4 years ago

nszekeres commented 4 years ago

Hello,

I encountered this error when trying to read NCES data: Error in read_csv() : could not find function "read_csv"

I found this response online:

"this means that the readr package has not been attached to the R session; remedy with library(readr)."

Am curious if this is the right answer or if anyone else has insight as to why I am hitting an error.

TY, Naomi

btskinner commented 4 years ago

Did you load the tidyverse library first via library(tidyverse)?

nszekeres commented 4 years ago

yes, I had loaded it. I also tried reloading it, restarting, etc. Eventually, using the above worked for me, but I had to manually do it for every function... still figuring this out.

I've been having a lot of issues with my installs; I wonder if it is some fundamental compatibility issue.

btskinner commented 4 years ago

That's odd. You might try reinstalling tidyverse (just use install.packages("tidyverse") again). If that doesn't work, you might want a reinstall of everything. But before that, we should set a meeting so I can see the problem in real time.

ckedroski commented 4 years ago

Can I ask how you were able to fix this? I'm having the same issue with a file that worked perfectly fine on Sunday.

btskinner commented 4 years ago

@nszekeres, I can't remember what you did to get it working. Was it just shutting down RStudio and then making sure you ran the file from the top? Did you need an update?

ckedroski commented 4 years ago

@btskinner - I continue to try to troubleshoot this issue. I figured out that even though my working directory is set to the scripts folder, the code is defaulting to the assignments folder. An error is shown at the bottom of the attached jpeg.

Capture

btskinner commented 4 years ago

Is your assignment in the scripts directory or in the assignments directory? If in the assignments directory, is that directory at the same level as the data directory, like this:

EDH7916_Research
|
|__/data
|__/scripts
|__/assignments

If so, the code should still work for you. But I think you might be down one more directory than that, in assignments/assignment6. If that's true, then you could try to add another set of dots to the file path:

dat_dir <- file.path("..", "..", "data")

Another possibility: Did you download and place hsls_small.dta in your data directory?

ckedroski commented 4 years ago

I'm not sure if you can read the screen shot with my notes attached. My assignment is located inside EDH7916<assignments<assignment6, so I tried adding another set of dots (as you note above) and that still did not work. I have not had this issue on any other assignment (while maintaining the same file directory), nor am I having trouble accessing the data my final project initial analysis.

It is letting me import my data using the following code:

df <- read_dta(choose())

Using this code, I was able to respond to all the questions on assignment 6, however, it is kicking out an error when I try to use "knit" so I am unable to generate the pdf without addressing the data file issue. If you have any other ideas, I certainly welcome them. I'm sure it's some mistake on my part.

Kedroski_capture

ckedroski commented 4 years ago

Figured it out! I was missing the haven library and had to add the second set of dots for the file path. Thank you!!!

btskinner commented 4 years ago

@ckedroski, those are the hardest errors: when there's more than one issue at the same time. But I'm glad you got it working. I'll close this issue for now.