On 13-May-10 23:43:58, yjmha69 wrote:
> Hi there,
> 
>>library(faraway)
>>pima
> 
>     pregnant glucose diastolic triceps insulin  bmi diabetes age test
> 1          6     148        72      35       0 33.6    0.627  50    1
> 2          1      85        66      29       0 26.6    0.351  31    0
> 
>>data(pima)
>>pima
> 
>     pregnant glucose diastolic triceps insulin  bmi diabetes age test
> 1          6     148        72      35       0 33.6    0.627  50    1
> 2          1      85        66      29       0 26.6    0.351  31    0
> 
> As you can see, I can already use pima without running data(pima),
> after running data(pima), it looks the same. So what's the reason to
> use data(pima) ?
> 
> Thanks
> YJM

The difference is that data(pima) will load the dataset pima
(which can be found in the package "faraway") without the use
of library(faraway). It won't load anything else from faraway.

When you use library(faraway) you will load everything in the
package faraway, including of course the dataset pima (which is
why you see no difference, since that dataset is the same whichever
way you load it).

So with data() you put less load on your system, and also avoid
possible conflicts between what you already have in your environment
and what would be brought in when you do library(faraway).

Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <ted.hard...@manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 14-May-10                                       Time: 10:35:15
------------------------------ XFMail ------------------------------

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to