erasing "[1]"

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

erasing "[1]"

mrzung
hi,
is there any way to erase the term "[1]"?

for example,

> a<-3+2
> a
[1]  5

the term [1] in front of number 5.

is there any way?
Reply | Threaded
Open this post in threaded view
|

Re: erasing "[1]"

Michael Weylandt
You can write your own print method or do it using cat:

cat(a, "\n")

Michael

On Mon, Mar 12, 2012 at 6:49 PM, mrzung <[hidden email]> wrote:

> hi,
> is there any way to erase the term "[1]"?
>
> for example,
>
>> a<-3+2
>> a
> *[1]*  5
>
> the term [1] in front of number 5.
>
> is there any way?
>
> --
> View this message in context: http://r.789695.n4.nabble.com/erasing-1-tp4467628p4467628.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: erasing "[1]"

jholtman
In reply to this post by mrzung
Will this work for you:

> a <- 3 + 2
> print(a)
[1] 5
> cat(a, '\n')
5


On Mon, Mar 12, 2012 at 6:49 PM, mrzung <[hidden email]> wrote:

> hi,
> is there any way to erase the term "[1]"?
>
> for example,
>
>> a<-3+2
>> a
> *[1]*  5
>
> the term [1] in front of number 5.
>
> is there any way?
>
> --
> View this message in context: http://r.789695.n4.nabble.com/erasing-1-tp4467628p4467628.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] 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.



--
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.

______________________________________________
[hidden email] 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.