DS4PS / cpp-528-spr-2021

https://ds4ps.org/cpp-528-spr-2021/
0 stars 0 forks source link

Lab 03 - Data steps error #22

Open JasonSills opened 3 years ago

JasonSills commented 3 years ago

Hi,

I'm having difficulty getting the script in the data steps to work properly. When I run the project_data_steps file I receive this error:

[1] "Starting on 1970" Error in select(d1, -type) : could not find function "select"

What would cause this? In my data/rodeo folder I only have the LLTDB-META-DATA produced, not the other two. The only thing I changed was labs/utilities.R to labs/wk03/utilities.R. Is there another bug I should change to correct the above error?

cenuno commented 3 years ago

Looks like you don’t have dplyr loaded. Try explicitly referencing select via dplyr::select.

— Cristian E. Nuno


From: JasonSills @.> Sent: Monday, March 29, 2021 3:07:09 PM To: DS4PS/cpp-528-spr-2021 @.> Cc: Subscribed @.***> Subject: [DS4PS/cpp-528-spr-2021] Lab 03 - Data steps error (#22)

Hi,

I'm having difficulty getting the script in the data steps to work properly. When I run the project_data_steps file I receive this error:

[1] "Starting on 1970" Error in select(d1, -type) : could not find function "select"

What would cause this? In my data/rodeo folder I only have the LLTDB-META-DATA produced, not the other two. The only thing I changed was labs/utilities.R to labs/wk03/utilities.R. Is there another bug I should change to correct the above error?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/DS4PS/cpp-528-spr-2021/issues/22, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFZB2S5FSR44A2S36USIC2DTGD2Y3ANCNFSM42ARRJXQ.

JasonSills commented 3 years ago

Interesting... I had library(dplyr), but it wasn't running. After I read this comment I ran just the libraries in the utilities.R file and it worked. Very strange. I ran this many, many, many times and it didn't work until I did this. Didn't need the dplyr::select, just had to run the library (again).

cenuno commented 3 years ago

You usually avoid these types of errors by being explicit with the package name when calling a function because sometimes debugging in Rstudio is picky about whether you’re in an R file or RMD file. Glad it’s resolved!

— Cristian E. Nuno


From: JasonSills @.> Sent: Monday, March 29, 2021 4:02:16 PM To: DS4PS/cpp-528-spr-2021 @.> Cc: Cristian Ernesto Nuno @.>; Comment @.> Subject: Re: [DS4PS/cpp-528-spr-2021] Lab 03 - Data steps error (#22)

Interesting... I had library(dplyr), but it wasn't running. After I read this comment I ran just the libraries in the utilities.R file and it worked. Very strange. I ran this many, many, many times and it didn't work until I did this. Didn't need the dplyr::select, just had to run the library (again).

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/DS4PS/cpp-528-spr-2021/issues/22#issuecomment-809781542, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFZB2S6UAXTHIEJSBA3TFUDTGEBHRANCNFSM42ARRJXQ.

lecy commented 3 years ago

There are several functions in dplyr that have generic names shared with a bunch of packages. It’s one of the few packages that I regularly run into conflicts with.

The easiest fix is to use the dplyr::select() version of the function call, which is the explicit version that avoids any conflicts. It’s also the version you are supposed to use when creating custom functions in new R packages.

It’s also nice because you don’t even have to load libraries to call the function.

cenuno commented 3 years ago

@JasonSills this was my error based on the contents of labs/utilities.R. I should have added dplyr::select() in a few places. #24 now fixes this issue.