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
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
12 replies · 3K views
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:
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.
 
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".
 
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: 640
  • AVW9O1l.png
    AVW9O1l.png
    64.1 KB · Views: 675
  • e0731yo.png
    e0731yo.png
    49.7 KB · Views: 590
  • jLjMu83.png
    jLjMu83.png
    50.7 KB · Views: 586
  • khdcKJU.png
    khdcKJU.png
    39.3 KB · Views: 605
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: 630
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