What is the procedure for loading a data set from a textbook in R?

  • Thread starter Thread starter Eclair_de_XII
  • Start date Start date
  • Tags Tags
    Data Set
Click For Summary

Discussion Overview

The discussion revolves around the challenges faced by a participant in loading a specific data set called "juul" from the textbook "Introductory Statistics with R" by Dalgaard into R. The conversation includes troubleshooting steps, potential errors, and alternative suggestions for accessing the data set.

Discussion Character

  • Homework-related
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant reports difficulty in locating the "juul" data set using the data() function after installing the ISwR package.
  • Another participant suggests that there may be a function related to "juul" and provides a link to documentation.
  • A participant expresses confusion about whether "juul" might be a typo for "jul".
  • One participant shares an error message received when attempting to access the "juul" data set, indicating it was not found.
  • Another participant questions whether the data set might no longer exist online, citing their attempts to locate it.
  • One participant suggests trying the command after confirming the package installation and proposes "juul2" as a potential replacement for "juul".
  • A suggestion is made to download a CSV version of the data set from an external link.
  • One participant expresses frustration with the process and considers looking for a different textbook due to the hassle.
  • Another participant emphasizes the need to load the package into R after installation to access the data set.

Areas of Agreement / Disagreement

Participants express varying opinions on the accessibility of the "juul" data set, with some suggesting it may not exist while others propose alternative commands or sources. No consensus is reached regarding the existence or accessibility of the data set.

Contextual Notes

There are indications of potential issues with package installation and loading, as well as uncertainty about the existence of the "juul" data set. The discussion includes references to error messages and troubleshooting steps that remain unresolved.

Eclair_de_XII
Messages
1,082
Reaction score
91

Homework Statement


I'm using a textbook called "Introductory Statistics with R" by Dalgaard, and I am having trouble doing one of the problems. It asks me to isolate names from a data set called "juul". But the problem is that I am unable to locate said data set.

Homework Equations


Functions used:
data()
install.packages()

The Attempt at a Solution


The problem is that I am unable to bring it up using the data() function. I have already installed the package that complements the book by typing in "install.packages("ISwR")", but I am still unable to find the data set in question. Do I need to specify where to look for the data set in R, or something?
 
Last edited:
Physics news on Phys.org
I don't think it's a function. In the textbook I'm using, it specifically states that it is a data set, one that I am unable to retrieve.
 
Ok, I see now. now.
I think I got confused by the usage. If I come across something else, I will post it.
 
I don't suppose there's any chance that the name is a typo? It wouldn't be much of a stretch to see "jul" become "juul".
 
Have you tried the command that is in the link that @scottdave provided?

plot(igf1~age, data=juul)

If so, did it give an error message?

What specific data command did you try and what error messages did you get?
 
Last edited:
gneill said:
It wouldn't be much of a stretch to see "jul" become "juul".

The book specifically asks: "Write the logical expression to use to extract girls between 7 and 14 years of age in the juul data set".

FactChecker said:
If so, did it give an error message?

I tried the command and it returned this message:

"Error in eval(m$data, eframe) : object 'juul' not found"

I also tried typing in >data("juul") and it returned this message:

"Warning message:
In data("juul") : data set ‘juul’ not found"I'm sure I have already installed the data package that the book tells me to install. Is it possible that those data sets no longer exist on the internet? I'm led to believe this because of some things... First, I installed the package as indicated in the book in the opening post once more. Then I tried searching my entire computer for any instances of "juul".

ZUVpMf3.png


Then I clicked on the first result, and it takes me to this page:

AVW9O1l.png


It shows only a single hyperlink. I click on it, and I am taken to this website. I start scrolling around for "juul".

e0731yo.png


So I scroll down to find my database "juul". The databases in purple are likely links I've already visited and was unable to find the corresponding data set for.

jLjMu83.png


So I click on that link, and this is the error message that shows up, which leads me to believe that the database in question no longer exists.

khdcKJU.png


Thoughts? Sorry for all the picture-spam. Please let me know if it's disruptive, and I'll try to replace them with just links, or downsize them a bit.
 

Attachments

  • ZUVpMf3.png
    ZUVpMf3.png
    64.3 KB · Views: 625
  • AVW9O1l.png
    AVW9O1l.png
    64.1 KB · Views: 659
  • e0731yo.png
    e0731yo.png
    49.7 KB · Views: 579
  • jLjMu83.png
    jLjMu83.png
    50.7 KB · Views: 576
  • khdcKJU.png
    khdcKJU.png
    39.3 KB · Views: 593
In the first screen-shot, it looks like you tried to access the data before you installed the package. That is certain to fail. I'm not sure that I understand what happened after that. Did you try those plot and data commands after installing the package? If so, what happened?

PS. You might try juul2. That may be the replacement of juul, which may have been deleted.
 
Hm, it still doesn't work...

MrMrdTQ.png
 

Attachments

  • MrMrdTQ.png
    MrMrdTQ.png
    69.7 KB · Views: 616
  • #11
Thanks. But to be honest, it seems like too much work to copy all those text files, save them, and guess which directory I put them into for R to access.

I think I want to look for a different book, one whose exercises I can do without all this hassle.
 
  • #12
I think that the package has not been completely installed and loaded for use. That will be a problem no matter what book you use. See http://mazamascience.com/WorkingWithData/?p=728 and make sure that the data has been loaded for use. If you are not running as administrator, you may want to set up a personal library.
 
  • #13
From a quick glance at R Studio, the dataset "juul" is not currently loaded into the system. You've completed part of the step by typing

install.packages("ISwR")

All you've done here is install the R package. What you then need to do is to load the package into RStudio.

To do this, you need to run the following command:

library("ISwR")

This would actually load the library package. Once that's done, then the dataset should be there, and you could then go ahead and use the plot function.
 
  • Like
Likes   Reactions: scottdave and FactChecker

Similar threads

  • · Replies 14 ·
Replies
14
Views
9K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 6 ·
Replies
6
Views
5K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 4 ·
Replies
4
Views
9K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
4K