Hi all, New user here - I include the following command in the prompt read.csv("document.csv", header = TRUE ) and the output shows up. But when I include the following command summary(data) I get the following message "Error in object[[i]] : object of type 'closure' is not subsettable" Can someone please advise why R is not reading my data? Thanks [[alternative HTML version deleted]]
"data" is the name of a base function in R. Functions are objects of type "closure". You can find out more about this function by reading the help. If you create your own object named "data" then your object will "hide" the base function and you won't be able to use it when you want to. Type ?data You used the read.csv function alright, but you did not assign the function return value to a variable, so it just printed it and threw it away. Try dta <- read.csv("document.csv", header = TRUE ) str(dta) summary(dta) If you don't know whether some variable name you want to use is already "taken", you can just type the name alone at the R prompt: data if it gives a not-found error then you should be safe to use it. A couple of tempting names you should also avoid are c (commonly used function for making vectors. Tempting because it comes after "a" and "b") t (the transpose function for matrices. Tempting for naming time variables.) df (density of the f distribution. Tempting because data frames are very often used object classes.) --------------------------------------------------------------------------- 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. Dinuk Jayasuriya <Dinuk.Jayasuriya at anu.edu.au> wrote:>Hi all, > >New user here - I include the following command in the prompt > >read.csv("document.csv", header = TRUE ) > >and the output shows up. > >But when I include the following command > >summary(data) > >I get the following message "Error in object[[i]] : object of type >'closure' is not subsettable" > >Can someone please advise why R is not reading my data? > >Thanks > > [[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.
Hi Jeff, Thank you - your comment was much appreciated. I'm now running an ordered probit regression and get the following error: Error in family$linkfun(mustart) : Value 1.125 out of range (0, 1) I can't decipher (after looking at other posts on google!) why this error occurs - is it something wrong with my dataset? If anyone can advise that would be very helpful. Thanks, Dinuk On 08/15/12, Jeff Newmiller <jdnewmil@dcn.davis.CA.us> wrote:> "data" is the name of a base function in R. Functions are objects of type "closure". You can find out more about this function by reading the help. If you create your own object named "data" then your object will "hide" the base function and you won't be able to use it when you want to. Type > > ?data > > You used the read.csv function alright, but you did not assign the function return value to a variable, so it just printed it and threw it away. > > Try > > dta <- read.csv("document.csv", header = TRUE ) > str(dta) > summary(dta) > > If you don't know whether some variable name you want to use is already "taken", you can just type the name alone at the R prompt: > > data > > if it gives a not-found error then you should be safe to use it. A couple of tempting names you should also avoid are > > c (commonly used function for making vectors. Tempting because it comes after "a" and "b") > t (the transpose function for matrices. Tempting for naming time variables.) > df (density of the f distribution. Tempting because data frames are very often used object classes.) > --------------------------------------------------------------------------- > Jeff Newmiller The ..... ..... Go Live... > DCN:<jdnewmil@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. > > Dinuk Jayasuriya <Dinuk.Jayasuriya@anu.edu.au> wrote: > > >Hi all, > > > >New user here - I include the following command in the prompt > > > >read.csv("document.csv", header = TRUE ) > > > >and the output shows up. > > > >But when I include the following command > > > >summary(data) > > > >I get the following message "Error in object[[i]] : object of type > >'closure' is not subsettable" > > > >Can someone please advise why R is not reading my data? > > > >Thanks > > > > [[alternative HTML version deleted]] > > > >______________________________________________ > >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]]
Dinuk Jayasuriya
2012-Aug-16 07:03 UTC
[R] Error in family$linkfun(mustart) : Value 1.125 out of range (0, 1)
John/Michael, thanks for your comments. I get the following error when I run my code (the code is attached as is a section of the data set): Error in family$linkfun(mustart) : Value 1.125 out of range (0, 1) If anyone can please provide assistance that would be much appreciated - I'm not sure if it's something wrong with my dataset or a bug in the program "list" Many thanks, Dinuk On 08/16/12, John <jwd at surewest.net> wrote:> On Wed, 15 Aug 2012 17:59:53 +1000 > Dinuk Jayasuriya <Dinuk.Jayasuriya at anu.edu.au> wrote: > > > Hi Jeff, > > > > Thank you - your comment was much appreciated. > > > > I'm now running an ordered probit regression and get the following > > error: > > > > Error in family$linkfun(mustart) : Value 1.125 out of range (0, 1) > > > > I can't decipher (after looking at other posts on google!) why this > > error occurs - is it something wrong with my dataset? > > > > If anyone can advise that would be very helpful. > > > > Thanks, > > Dinuk > > You need to supply considerably more information before you can expect > much help. A subset of the data would help, since otherwise people are > guessing. Also, if you look at the example here: > > http://www.ats.ucla.edu/stat/R/dae/probit.htm > > you may find some useful pointers. > > JWDougherty > > ______________________________________________ > 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. > >