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
The discussion revolves around difficulties in accessing the "juul" dataset from the textbook "Introductory Statistics with R" by Dalgaard. The user has installed the necessary package "ISwR" but is unable to retrieve the dataset using the data() function, receiving error messages indicating that the dataset is not found. Suggestions include checking for potential typos in the dataset name and ensuring the package is correctly loaded with the library() function. There is also speculation that the dataset may have been removed or replaced, with alternatives like "juul2" being mentioned. The user expresses frustration with the process and considers switching to a different textbook for easier access to datasets.
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: 603
  • AVW9O1l.png
    AVW9O1l.png
    64.1 KB · Views: 628
  • e0731yo.png
    e0731yo.png
    49.7 KB · Views: 556
  • jLjMu83.png
    jLjMu83.png
    50.7 KB · Views: 556
  • khdcKJU.png
    khdcKJU.png
    39.3 KB · Views: 577
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: 598
  • #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 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
4K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
9K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
4K