[R] Removing description from lm()
billy am
wickedpuppy at gmail.com
Sun Oct 5 17:00:03 CEST 2014
Thats it! Most splendid! Thanks! The final result, just the value alone ,
for future reference.
> x <- c(1,5,3,1)> y <- c(5,8,2,3)> lm(x~y)$coefficient[1](Intercept)
0.5714286 > cat(lm(x~y)$coefficient[1])0.5714286
>
Thanks everyone!
Regards
Billy
On Sun, Oct 5, 2014 at 10:37 PM, peter dalgaard <pdalgd at gmail.com> wrote:
>
> On 05 Oct 2014, at 16:06 , billy am <wickedpuppy at gmail.com> wrote:
>
> > Thank you both very much. It is the unname that is what I am looking for.
> > Thanks!
> >
> > Btw , must the [1] be there? I am writing a Shiny web app hence I would
> > like to display the value alone.
> >
>
> It's part of standard printing of unnamed vectors. For nonstandard
> printing tasks, use cat() as in
>
> > x <-c(a=2)
> > x
> a
> 2
> > cat(x,"\n")
> 2
>
> (which incidentally also gets rid of the name).
>
> --
> Peter Dalgaard, Professor,
> Center for Statistics, Copenhagen Business School
> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
> Phone: (+45)38153501
> Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
>
>
>
>
>
>
>
>
>
[[alternative HTML version deleted]]
More information about the R-help
mailing list