data-edu / dataedu

An R package associated with the Data Science in Education Using R book
https://data-edu.github.io/dataedu/
Creative Commons Attribution 4.0 International
74 stars 12 forks source link

errors on sample codes #97

Closed fornelas1 closed 6 months ago

fornelas1 commented 6 months ago

Code on page 50 for roster does not execute and sample codes on page 57 either. Error suggest group_by is not applicable to character var District Name. Frustrating when learning R. I thought you people have tested the sample codes. The whole idea of the book seems very practical.

ivelasq commented 6 months ago

Hi @fornelas1,

Thanks for reaching out to us! We truly appreciate the time you took to share your thoughts. It's a bit challenging for us to pinpoint the exact issues you're facing without seeing the code you're working on, but we're here to help!

Now, if you happened to stumble upon an error here:

    group_by(District Name) %>%  
    count()

Don't fret! We've cunningly forewarned about encountering an error in one of the code chunks in the paragraph above: "You will run into an error message in one of the code chunks, but just try to understand what it means and continue." Just take a deep breath, decipher that error message like a code-breaking detective, and boldly move ahead. It's all part of the plan to acquaint you with the Console and those cryptic error messages.

And if you were running into issues with the code:

roster <- roster_raw %>% 
    clean_names() %>% 
    remove_empty(c("rows", "cols")) %>% 
    mutate(hire_date = excel_numeric_to_date(hire_date),
           cert = coalesce(certification, certification_1)) %>% 
    select(-certification, -certification_1)

Relax! We explicitly mention that you're off the hook for fully grasping the intricacies of this particular code chunk: "You aren’t expected to know what the chunk of code that you’ve just read does, nor are you expected to run it."

Rest assured, we meticulously tested our code, and we've sprinkled ample context in the text around those code snippets to help readers like you. If anything's amiss, we're here to guide you. Happy coding!

fornelas1 commented 6 months ago

Hi Isabella:

Thank you for your reply.

I understand the use of the group_by statement in SQL and Python. Thus when executing the code I was expecting a count by each district. Instead the code gives the total which is not very helpful. I was expecting something like a frequency of districts. Expanding the book to include output from execution could enhance the value of the book. The following simpler statement gave me that

table(ma_data_init$'District Name', useNA='ifany')

[image: Rio Salado College Logo] [image: Rio Facebook] https://www.facebook.com/RioSaladoCollege [image: Rio Twitter] https://twitter.com/RioSaladoOnline [image: Rio YouTube] http://www.youtube.com/user/riosaladocollege [image: Rio Google+] https://plus.google.com/+riosalado/about Fermin Ornelas, Ph.D. Sr. Research Analyst / Institutional Research Tel: (480) 517-8256 <#SignatureSanitizerSafeHtmlFilter> https://secure.riosalado.edu/email-signature-generator/# | @riosalado.edu @.***> 2323 W. 14th Street Tempe, AZ 85281 | www.riosalado.edu

A Maricopa Community College

On Fri, Jan 5, 2024 at 9:37 AM Isabella Velásquez @.***> wrote:

Hi @fornelas1 https://github.com/fornelas1,

Thanks for reaching out to us! We truly appreciate the time you took to share your thoughts. It's a bit challenging for us to pinpoint the exact issues you're facing without seeing the code you're working on, but we're here to help!

Now, if you happened to stumble upon an error here:

group_by(District Name) %>%
count()

Don't fret! We've cunningly forewarned about encountering an error in one of the code chunks in the paragraph above: "You will run into an error message in one of the code chunks, but just try to understand what it means and continue." Just take a deep breath, decipher that error message like a code-breaking detective, and boldly move ahead. It's all part of the plan to acquaint you with the Console and those cryptic error messages.

And if you were running into issues with the code:

roster <- roster_raw %>% clean_names() %>% remove_empty(c("rows", "cols")) %>% mutate(hire_date = excel_numeric_to_date(hire_date), cert = coalesce(certification, certification_1)) %>% select(-certification, -certification_1)

Relax! We explicitly mention that you're off the hook for fully grasping the intricacies of this particular code chunk: "You aren’t expected to know what the chunk of code that you’ve just read does, nor are you expected to run it."

Rest assured, we meticulously tested our code, and we've sprinkled ample context in the text around those code snippets to help readers like you. If anything's amiss, we're here to guide you. Happy coding!

— Reply to this email directly, view it on GitHub https://github.com/data-edu/dataedu/issues/97#issuecomment-1878954226, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHCFFI356KG76GRGFG462ADYNAT4TAVCNFSM6AAAAABBNR5HF2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZYHE2TIMRSGY . You are receiving this because you were mentioned.Message ID: @.***>

ivelasq commented 6 months ago

Hello again @fornelas1,

Thanks once more for sharing your insights! While I don't have the precise lines of code you're working with, if it's something along these lines:

ma_data_init <- dataedu::ma_data_init
ma_data_init %>% group_by(`District Name`) %>%  count() %>% head()

You should see a neat tabulation displaying the district-wise counts, similar to table(ma_data_init$'District Name', useNA='ifany'):

# A tibble: 6 × 2
# Groups:   District Name [6]
  `District Name`                                          n
  <chr>                                                <int>
1 Abby Kelley Foster Charter Public (District)             1
2 Abington                                                 5
3 Academy Of the Pacific Rim Charter Public (District)     1
4 Acton-Boxborough                                         9
5 Acushnet                                                 2
6 Adams-Cheshire                                           3

Chapter 6 lays the foundation of coding, offering essential skills for the chapters ahead, starting from Chapter 7. We intentionally kept the output under wraps in Chapter 6 because the walkthroughs are where we delve into the nitty-gritty of function usage and outputs, like this section: https://datascienceineducation.com/c07#process-data

fornelas1 commented 6 months ago

That is exactly what I was aiming at by running your syntax but for some reason it gave me a different result. just total count. That is why I used the other statement.

I think the relevance of your book is that it is close to what one deals with when extracting LMS data.

Thank you !!!

[image: Rio Salado College Logo] [image: Rio Facebook] https://www.facebook.com/RioSaladoCollege [image: Rio Twitter] https://twitter.com/RioSaladoOnline [image: Rio YouTube] http://www.youtube.com/user/riosaladocollege [image: Rio Google+] https://plus.google.com/+riosalado/about Fermin Ornelas, Ph.D. Sr. Research Analyst / Institutional Research Tel: (480) 517-8256 <#m_2149774610713709606_SignatureSanitizerSafeHtmlFilter> https://secure.riosalado.edu/email-signature-generator/# | @riosalado.edu @.***> 2323 W. 14th Street Tempe, AZ 85281 | www.riosalado.edu

A Maricopa Community College

On Fri, Jan 5, 2024 at 10:53 AM Isabella Velásquez @.***> wrote:

Hello again @fornelas1 https://github.com/fornelas1,

Thanks once more for sharing your insights! While I don't have the precise lines of code you're working with, if it's something along these lines:

ma_data_init <- dataedu::ma_data_init ma_data_init %>% group_by(District Name) %>% count() %>% head()

You should see a neat tabulation displaying the district-wise counts, similar to table(ma_data_init$'District Name', useNA='ifany'):

District Name n

1 Abby Kelley Foster Charter Public (District) 1 2 Abington 5 3 Academy Of the Pacific Rim Charter Public (District) 1 4 Acton-Boxborough 9 5 Acushnet 2 6 Adams-Cheshire 3 Chapter 6 lays the foundation of coding, offering essential skills for the chapters ahead, starting from Chapter 7. We intentionally kept the output under wraps in Chapter 6 because the walkthroughs are where we delve into the nitty-gritty of function usage and outputs, like this section: https://datascienceineducation.com/c07#process-data — Reply to this email directly, view it on GitHub , or unsubscribe . You are receiving this because you were mentioned.Message ID: ***@***.***>
fornelas1 commented 6 months ago

BTW I could not install the sjPlot package. Tried several times, have given up for now.

[image: Rio Salado College Logo] [image: Rio Facebook] https://www.facebook.com/RioSaladoCollege [image: Rio Twitter] https://twitter.com/RioSaladoOnline [image: Rio YouTube] http://www.youtube.com/user/riosaladocollege [image: Rio Google+] https://plus.google.com/+riosalado/about Fermin Ornelas, Ph.D. Sr. Research Analyst / Institutional Research Tel: (480) 517-8256 <#SignatureSanitizerSafeHtmlFilter> https://secure.riosalado.edu/email-signature-generator/# | @riosalado.edu @.***> 2323 W. 14th Street Tempe, AZ 85281 | www.riosalado.edu

A Maricopa Community College

On Fri, Jan 5, 2024 at 11:38 AM Fermin Ornelas @.***> wrote:

That is exactly what I was aiming at by running your syntax but for some reason it gave me a different result. just total count. That is why I used the other statement.

I think the relevance of your book is that it is close to what one deals with when extracting LMS data.

Thank you !!!

[image: Rio Salado College Logo] [image: Rio Facebook] https://www.facebook.com/RioSaladoCollege [image: Rio Twitter] https://twitter.com/RioSaladoOnline [image: Rio YouTube] http://www.youtube.com/user/riosaladocollege [image: Rio Google+] https://plus.google.com/+riosalado/about Fermin Ornelas, Ph.D. Sr. Research Analyst / Institutional Research Tel: (480) 517-8256 <#m_3538042573083911746_m_2149774610713709606_SignatureSanitizerSafeHtmlFilter> https://secure.riosalado.edu/email-signature-generator/# | @riosalado.edu @.***> 2323 W. 14th Street Tempe, AZ 85281 | www.riosalado.edu

A Maricopa Community College

On Fri, Jan 5, 2024 at 10:53 AM Isabella Velásquez < @.***> wrote:

Hello again @fornelas1 https://github.com/fornelas1,

Thanks once more for sharing your insights! While I don't have the precise lines of code you're working with, if it's something along these lines:

ma_data_init <- dataedu::ma_data_init ma_data_init %>% group_by(District Name) %>% count() %>% head()

You should see a neat tabulation displaying the district-wise counts, similar to table(ma_data_init$'District Name', useNA='ifany'):

District Name n

1 Abby Kelley Foster Charter Public (District) 1 2 Abington 5 3 Academy Of the Pacific Rim Charter Public (District) 1 4 Acton-Boxborough 9 5 Acushnet 2 6 Adams-Cheshire 3 Chapter 6 lays the foundation of coding, offering essential skills for the chapters ahead, starting from Chapter 7. We intentionally kept the output under wraps in Chapter 6 because the walkthroughs are where we delve into the nitty-gritty of function usage and outputs, like this section: https://datascienceineducation.com/c07#process-data — Reply to this email directly, view it on GitHub , or unsubscribe . You are receiving this because you were mentioned.Message ID: ***@***.***>
ivelasq commented 6 months ago

What error are you getting?

fornelas1 commented 6 months ago

There are issues with emmeans, it seems.

installing the source packages ‘sjstats’, ‘sjPlot’ trying URL 'https://cran.rstudio.com/src/contrib/sjstats_0.18.2.tar.gz'Content type 'application/x-gzip' length 144953 bytes (141 KB)downloaded 141 KB trying URL 'https://cran.rstudio.com/src/contrib/sjPlot_2.8.15.tar.gz'Content type 'application/x-gzip' length 934269 bytes (912 KB)downloaded 912 KB ERROR: dependency 'emmeans' is not available for package 'sjstats'

[image: Rio Salado College Logo] [image: Rio Facebook] https://www.facebook.com/RioSaladoCollege [image: Rio Twitter] https://twitter.com/RioSaladoOnline [image: Rio YouTube] http://www.youtube.com/user/riosaladocollege [image: Rio Google+] https://plus.google.com/+riosalado/about Fermin Ornelas, Ph.D. Sr. Research Analyst / Institutional Research Tel: (480) 517-8256 <#SignatureSanitizerSafeHtmlFilter> https://secure.riosalado.edu/email-signature-generator/# | @riosalado.edu @.***> 2323 W. 14th Street Tempe, AZ 85281 | www.riosalado.edu

A Maricopa Community College

On Fri, Jan 5, 2024 at 1:21 PM Isabella Velásquez @.***> wrote:

What error are you getting?

— Reply to this email directly, view it on GitHub https://github.com/data-edu/dataedu/issues/97#issuecomment-1879215278, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHCFFI27NUIMMEYFPCUYKI3YNBOFZAVCNFSM6AAAAABBNR5HF2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZZGIYTKMRXHA . You are receiving this because you were mentioned.Message ID: @.***>

fornelas1 commented 6 months ago

Hi Isabella:

Just wanted to let you know I am getting the hang of it. Your book has some interesting data manipulations that strengthen the learning curve in R.

Best,

F Ornelas [image: Rio Salado College Logo] [image: Rio Facebook] https://www.facebook.com/RioSaladoCollege [image: Rio Twitter] https://twitter.com/RioSaladoOnline [image: Rio YouTube] http://www.youtube.com/user/riosaladocollege [image: Rio Google+] https://plus.google.com/+riosalado/about Fermin Ornelas, Ph.D. Sr. Research Analyst / Institutional Research Tel: (480) 517-8256 <#SignatureSanitizerSafeHtmlFilter> https://secure.riosalado.edu/email-signature-generator/# | @riosalado.edu @.***> 2323 W. 14th Street Tempe, AZ 85281 | www.riosalado.edu

A Maricopa Community College

On Fri, Jan 5, 2024 at 2:46 PM Fermin Ornelas @.***> wrote:

There are issues with emmeans, it seems.

installing the source packages ‘sjstats’, ‘sjPlot’ trying URL 'https://cran.rstudio.com/src/contrib/sjstats_0.18.2.tar.gz'Content type 'application/x-gzip' length 144953 bytes (141 KB)downloaded 141 KB trying URL 'https://cran.rstudio.com/src/contrib/sjPlot_2.8.15.tar.gz'Content type 'application/x-gzip' length 934269 bytes (912 KB)downloaded 912 KB ERROR: dependency 'emmeans' is not available for package 'sjstats'

  • removing 'C:/Users/fermin.ornelas/Documents/R/win-library/4.0/sjstats' Warning in install.packages : installation of package ‘sjstats’ had non-zero exit status ERROR: dependency 'sjstats' is not available for package 'sjPlot'
  • removing 'C:/Users/fermin.ornelas/Documents/R/win-library/4.0/sjPlot' Warning in install.packages : installation of package ‘sjPlot’ had non-zero exit status

[image: Rio Salado College Logo] [image: Rio Facebook] https://www.facebook.com/RioSaladoCollege [image: Rio Twitter] https://twitter.com/RioSaladoOnline [image: Rio YouTube] http://www.youtube.com/user/riosaladocollege [image: Rio Google+] https://plus.google.com/+riosalado/about Fermin Ornelas, Ph.D. Sr. Research Analyst / Institutional Research Tel: (480) 517-8256 <#m_-7593512725404012408_SignatureSanitizerSafeHtmlFilter> https://secure.riosalado.edu/email-signature-generator/# | @riosalado.edu @.***> 2323 W. 14th Street Tempe, AZ 85281 | www.riosalado.edu

A Maricopa Community College

On Fri, Jan 5, 2024 at 1:21 PM Isabella Velásquez < @.***> wrote:

What error are you getting?

— Reply to this email directly, view it on GitHub https://github.com/data-edu/dataedu/issues/97#issuecomment-1879215278, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHCFFI27NUIMMEYFPCUYKI3YNBOFZAVCNFSM6AAAAABBNR5HF2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZZGIYTKMRXHA . You are receiving this because you were mentioned.Message ID: @.***>

ivelasq commented 6 months ago

Hi @fornelas1 ,

We're happy to know the book is helpful for you!

You can try installing emmeans and sjPlot separately to see if it works. Hope that helps!

fornelas1 commented 6 months ago

I think the solution may be to remove and reinstall R. I have done that for anaconda/python before. I am in the pages (87) where the sjPlot is called. Also another package is missing MBESS related to apa tables. Thanks again

[image: Rio Salado College Logo] [image: Rio Facebook] https://www.facebook.com/RioSaladoCollege [image: Rio Twitter] https://twitter.com/RioSaladoOnline [image: Rio YouTube] http://www.youtube.com/user/riosaladocollege [image: Rio Google+] https://plus.google.com/+riosalado/about Fermin Ornelas, Ph.D. Sr. Research Analyst / Institutional Research Tel: (480) 517-8256 <#SignatureSanitizerSafeHtmlFilter> https://secure.riosalado.edu/email-signature-generator/# | @riosalado.edu @.***> 2323 W. 14th Street Tempe, AZ 85281 | www.riosalado.edu

A Maricopa Community College

On Mon, Jan 8, 2024 at 8:06 AM Isabella Velásquez @.***> wrote:

Hi @fornelas1 https://github.com/fornelas1 ,

We're happy to know the book is helpful for you!

You can try installing emmeans and sjPlot separately to see if it works. Hope that helps!

— Reply to this email directly, view it on GitHub https://github.com/data-edu/dataedu/issues/97#issuecomment-1881189378, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHCFFIYGH7DHQR46ZBF2O2LYNQDP5AVCNFSM6AAAAABBNR5HF2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBRGE4DSMZXHA . You are receiving this because you were mentioned.Message ID: @.***>

fornelas1 commented 6 months ago

I removed version 4.0.3 and installed version 4.3.2. After that installed sjPlot no issues.

Best,

Ornelas [image: Rio Salado College Logo] [image: Rio Facebook] https://www.facebook.com/RioSaladoCollege [image: Rio Twitter] https://twitter.com/RioSaladoOnline [image: Rio YouTube] http://www.youtube.com/user/riosaladocollege [image: Rio Google+] https://plus.google.com/+riosalado/about Fermin Ornelas, Ph.D. Sr. Research Analyst / Institutional Research Tel: (480) 517-8256 <#SignatureSanitizerSafeHtmlFilter> https://secure.riosalado.edu/email-signature-generator/# | @riosalado.edu @.***> 2323 W. 14th Street Tempe, AZ 85281 | www.riosalado.edu

A Maricopa Community College

On Tue, Jan 9, 2024 at 4:18 PM Fermin Ornelas @.***> wrote:

I think the solution may be to remove and reinstall R. I have done that for anaconda/python before. I am in the pages (87) where the sjPlot is called. Also another package is missing MBESS related to apa tables. Thanks again

[image: Rio Salado College Logo] [image: Rio Facebook] https://www.facebook.com/RioSaladoCollege [image: Rio Twitter] https://twitter.com/RioSaladoOnline [image: Rio YouTube] http://www.youtube.com/user/riosaladocollege [image: Rio Google+] https://plus.google.com/+riosalado/about Fermin Ornelas, Ph.D. Sr. Research Analyst / Institutional Research Tel: (480) 517-8256 <#m_5453382292988364546_SignatureSanitizerSafeHtmlFilter> https://secure.riosalado.edu/email-signature-generator/# | @riosalado.edu @.***> 2323 W. 14th Street Tempe, AZ 85281 | www.riosalado.edu

A Maricopa Community College

On Mon, Jan 8, 2024 at 8:06 AM Isabella Velásquez < @.***> wrote:

Hi @fornelas1 https://github.com/fornelas1 ,

We're happy to know the book is helpful for you!

You can try installing emmeans and sjPlot separately to see if it works. Hope that helps!

— Reply to this email directly, view it on GitHub https://github.com/data-edu/dataedu/issues/97#issuecomment-1881189378, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHCFFIYGH7DHQR46ZBF2O2LYNQDP5AVCNFSM6AAAAABBNR5HF2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBRGE4DSMZXHA . You are receiving this because you were mentioned.Message ID: @.***>

ivelasq commented 6 months ago

Always great to have the latest version!

I'll mark this issue as resolved, but feel free to ask if you have any more questions.