[R] Data.frame Question
Henrique Dallazuanna
wwwhsd at gmail.com
Thu Mar 11 15:55:26 CET 2010
Try this:
sweep(DF, 2, 1:2, '+')
On Thu, Mar 11, 2010 at 9:20 AM, GULATI, BRIJESH (Global Markets FF&O
NY) <brijesh.gulati at baml.com> wrote:
>
>
>> Hi:
>> I want to add a constant to an existing col of the
>> data.frame. I have the following dataset:
>>
>>
>> structure(list(x = c(1, 1, 1, 1, 1), y = c(1, 1, 1, 1, 1)),
>> .Names = c("x",
>> "y"), row.names = c(NA, 5L), class = "data.frame")
>>
>>
>> I want to add a constant to col 1 and col 2 to get the following
>> data.frame
>>
>> structure(list(x = c(2, 2, 2, 2, 2), y = c(3, 3, 3, 3, 3)),
>> .Names = c("x",
>> "y"), row.names = c(NA, 5L), class = "data.frame")
>>
>>
>> Thanks,
>> Brijesh
>
> --------------------------------------------------------------------------
> This message w/attachments (message) may be privileged, ...{{dropped:30}}
>
> ______________________________________________
> 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.
>
--
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O
More information about the R-help
mailing list