Re: [R] Adding a numeric to all values in the dataframe

From: Jorge Ivan Velez <jorgeivanvelez_at_gmail.com>
Date: Fri, 20 May 2011 00:18:19 -0400

Hi,

Does the following work for you?

set.seed(123)
d <- data.frame(x = rpois(10, 4), y = rnorm(10)) d
d + 2

See ?within for one more option.

HTH,
Jorge

On Thu, May 19, 2011 at 11:54 PM, Ramya <> wrote:

> Hi there
>
> I just want to add 2 to all the values in dataframe.
>
> I tried using sapply but it seem to die all the time.
>
> Any help would be appreciated.
>
> Thanks
> Ramya
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Adding-a-numeric-to-all-values-in-the-dataframe-tp3537594p3537594.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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. Received on Fri 20 May 2011 - 04:21:01 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 20 May 2011 - 04:30:08 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive