[R] Basic question -loading data

R. Michael Weylandt michael.weylandt at gmail.com
Thu Aug 16 05:56:01 CEST 2012


On Wed, Aug 15, 2012 at 3:59 AM, 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)

Error message suggests you are trying to predict a probability of
112.5% with your model, but it's hard to say why exactly you're
getting this message without a reproducible example:

http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

Note also that this is a pretty different question than how this
thread started, so follow up should begin a new thread.

Michael

>
> 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 at 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 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.
>>
>>
>>
>
>         [[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.



More information about the R-help mailing list