you probably need to type data(datasetname) with a lowercase "d" for data(). R is case sensitive. On Thu, Jun 27, 2013 at 4:02 PM, Yasmine Refai <y_refai@hotmail.com> wrote:> Hello, > > When i type in the below syntax: > Data (name of the data set) > > I get an error message specifying that the "data" package is not found. > > Please note that i installed all packages having the word "data" included > in them and loaded all these packages. > > Please advice. > > Regards! > ______________________________________________ > 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. >[[alternative HTML version deleted]]
You need to copy the lines you have typed in to R and send them exactly. The only way I get an error message like the one you indicate is with the following:> library(data)Error in library(data) : there is no package called 'data'>There is no Data function in R so if you typed that you would get> Data(Titanic)Error: could not find function "Data" So what did you really type? ------------------------------------- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77840-4352 -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Yasmine Refai Sent: Thursday, June 27, 2013 3:03 PM To: r-help at R-project.org Subject: [R] Data Package Query Hello, When i type in the below syntax: Data (name of the data set) I get an error message specifying that the "data" package is not found. Please note that i installed all packages having the word "data" included in them and loaded all these packages. Please advice. Regards! ______________________________________________ R-help at 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.
"data" is a base function (so you should not have to load any packages to use it), and it is not capitalized. Depending on the particular data set you want the data function to load, you may need to load the package that contains that data set. A common error by beginners (which may or may not be your problem in this case) is to create a variable called "data". Unfortunately this hides the function named "data" and from that time forward that R session doesn't work when you type example code that uses the data function. If this is your problem, the best solution is to restart R and do your analysis from the beginning using a different variable name than "data". (This is why keeping your working code in a separate text file is standard operating procedure.) Note that I am guessing here... the Posting Guide asks you to give a reproducible example so we don't have to guess what you have done. --------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --------------------------------------------------------------------------- Sent from my phone. Please excuse my brevity. Yasmine Refai <y_refai at hotmail.com> wrote:>Hello, > >When i type in the below syntax: >Data (name of the data set) > >I get an error message specifying that the "data" package is not found. > >Please note that i installed all packages having the word "data" >included in them and loaded all these packages. > >Please advice. > >Regards! >______________________________________________ >R-help at 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.
Hello, When i type in the below syntax: Data (name of the data set) I get an error message specifying that the "data" package is not found. Please note that i installed all packages having the word "data" included in them and loaded all these packages. Please advice. Regards!
Please reply to all so the thread stays on the mailing list for all to see (and correct if wrong information is given). Regarding your code below, either you are missing a library statement to load a package that contains this "trial" data, or you are intending to read in your own data set but are not yet aware of how that is done. I could find no package containing a data set named "trial" (but I might have missed one). If you have some data of your own, then the data function is almost certainly not the right tool for the job. A PDF document called "R Data Import/Export" is supplied with R that can get you started. There are also various intro books available. --------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --------------------------------------------------------------------------- Sent from my phone. Please excuse my brevity. Yasmine Refai <y_refai at hotmail.com> wrote:>Unfortunately, i have no variable called "data". The below is the >syntax i am running: >data(trial) >fit<-logistf(data=trial, y=x1+x2+x3) > >Sorry for the disturbance. > >Regards! > >On Jun 27, 2013, at 9:47 AM, "Jeff Newmiller" ><jdnewmil at dcn.davis.CA.us> wrote: > >> "data" is a base function (so you should not have to load any >packages to use it), and it is not capitalized. Depending on the >particular data set you want the data function to load, you may need to >load the package that contains that data set. >> >> A common error by beginners (which may or may not be your problem in >this case) is to create a variable called "data". Unfortunately this >hides the function named "data" and from that time forward that R >session doesn't work when you type example code that uses the data >function. If this is your problem, the best solution is to restart R >and do your analysis from the beginning using a different variable name >than "data". (This is why keeping your working code in a separate text >file is standard operating procedure.) >> >> Note that I am guessing here... the Posting Guide asks you to give a >reproducible example so we don't have to guess what you have done. >> >--------------------------------------------------------------------------- >> Jeff Newmiller The ..... ..... Go >Live... >> DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live >Go... >> Live: OO#.. Dead: OO#.. >Playing >> Research Engineer (Solar/Batteries O.O#. #.O#. with >> /Software/Embedded Controllers) .OO#. .OO#. >rocks...1k >> >--------------------------------------------------------------------------- > >> Sent from my phone. Please excuse my brevity. >> >> Yasmine Refai <y_refai at hotmail.com> wrote: >> >>> Hello, >>> >>> When i type in the below syntax: >>> Data (name of the data set) >>> >>> I get an error message specifying that the "data" package is not >found. >>> >>> Please note that i installed all packages having the word "data" >>> included in them and loaded all these packages. >>> >>> Please advice. >>> >>> Regards! >>> ______________________________________________ >>> R-help at 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. >>
I don't know what you think data(Trial) is doing but what it in fact is doing is trying to load a stored data set called Trial and it does not exist. Have a look at ?data to see what I mean. In your program data(Trial) is redundant, well actually closer to meaningless. Trial is already loaded since you created it in the read statement John Kane Kingston ON Canada> -----Original Message----- > From: y_refai at hotmail.com > Sent: Fri, 28 Jun 2013 12:31:11 +0000 > To: rolf.turner at xtra.co.nz, jdnewmil at dcn.davis.ca.us > Subject: Re: [R] Data Package Query > > hello, > > please advice what is wrong at the below syntax: > "Trial<-read.table("Trial.txt",header=TRUE) > Trial > save.image(file="Trial.RData") > data(Trial) > fit<-logistf(data=Trial, y~x1+x2) > " > > and here is the error I get: > "Warning message: > In data(Trial) : data set ?Trial? not found > " > > regards, > yasmine > > >> Date: Fri, 28 Jun 2013 10:29:21 +1200 >> From: rolf.turner at xtra.co.nz >> To: jdnewmil at dcn.davis.ca.us >> CC: y_refai at hotmail.com; r-help at r-project.org >> Subject: Re: [R] Data Package Query >> >> On 28/06/13 04:47, Jeff Newmiller wrote: >> >> <SNIP> >>> A common error by beginners (which may or may not be your problem in >>> this case) is to create a variable called "data". Unfortunately this >>> hides the function named "data" and from that time forward that R >>> session doesn't work when you type example code that uses the data >>> function. >> >> <SNIP> >> >> This is simply not true. I believe it *used* to be true, sometime >> waaaaayyyy back, >> but hasn't been true for years. The R language is much cleverer now. >> If there >> is a function "melvin()" somewhere on the search path and also a data >> object >> "melvin" (earlier on the search path) then doing >> >> melvin(<whatever>) >> >> will correctly call the function melvin() with no complaints. The R >> language >> "can tell" by the parentheses that you mean the *function* melvin and >> not the >> data object "melvin". >> >> E.g. >> >> data <- 42 >> require(akima) >> akima >> Error: object 'akima' not found >> data(akima) # No error message, nor nothin'! >> akima >> # The data set "akima" is displayed. >> >> All that being said it is ***BAD PRACTICE***, just in terms of >> comprehensibility >> and avoiding confusion, to give a data set set the same name as a >> function >> (either built in, or one of your own). >> >> fortune("dog") >> >> is relevant. >> >> cheers, >> >> Rolf Turner >> > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.____________________________________________________________ FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your desktop!