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

  • Thread starter Eclair_de_XII
  • Start date
  • Tags Tags
    Data Set
12 replies · 3K views · last reply
Eclair_de_XII
Messages
1,085
Reaction score
92

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:
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.
 
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".

Screenshot of RStudio console showing a failed data("juul") call and install.packages("HSAUR3") output, beside a Windows file search window listing juul results.


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

Screenshot of RStudio with the console showing an error for data("juul") and an Windows Explorer search window for "juul" showing one result, 00Index, 3.19 KB.


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

Screenshot of R's HTML help index for the ISwR package, version 2.0-7, open in a browser, with a Windows Explorer search window for "juul" behind it and an add-on prompt at the bottom.


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.

Screenshot of a browser page titled R Introductory Statistics with a list of dataset names and descriptions, including juul, Jul's IGF data, with Windows file search and R console windows open behind it.


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.

Screenshot of a Windows desktop: a browser window showing 'Can't reach this page' with a URL ending in juul.html, and an R console window below listing package messages.


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
  • Screenshot of RStudio console showing a failed data("juul") call and install.packages("HSAUR3") output, beside a Windows file search window listing juul results.
    ZUVpMf3.png
    64.3 KB · Views: 665
  • Screenshot of RStudio with the console showing an error for data("juul") and an Windows Explorer search window for "juul" showing one result, 00Index, 3.19 KB.
    AVW9O1l.png
    64.1 KB · Views: 706
  • Screenshot of R's HTML help index for the ISwR package, version 2.0-7, open in a browser, with a Windows Explorer search window for "juul" behind it and an add-on prompt at the bottom.
    e0731yo.png
    49.7 KB · Views: 613
  • Screenshot of a browser page titled R Introductory Statistics with a list of dataset names and descriptions, including juul, Jul's IGF data, with Windows file search and R console windows open behind it.
    jLjMu83.png
    50.7 KB · Views: 612
  • Screenshot of a Windows desktop: a browser window showing 'Can't reach this page' with a URL ending in juul.html, and an R console window below listing package messages.
    khdcKJU.png
    39.3 KB · Views: 633
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...

Screenshot of RStudio on Windows showing the console with plot(fgl~age, data=juv2) errors 'object juv2 not found', after an install.packages('ISwR') attempt, with the Help pane open to the Data Sets page.
 
Attachments
  • Screenshot of RStudio on Windows showing the console with plot(fgl~age, data=juv2) errors 'object juv2 not found', after an install.packages('ISwR') attempt, with the Help pane open to the Data Sets page.
    MrMrdTQ.png
    69.7 KB · Views: 656
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.
 
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.
 
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