The result is different with your code. My result is :
pose16 <- structure(list(DESCRIPTION = structure(c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 12L), .Label = c("COPPER May/10", "COTTON NO.2 Jul/10", "CRUDE OIL miNY May/10", "GOLD Jun/10", "ROBUSTA COFFEE (10) Jul/10", "SOYBEANS Jul/10", "SUGAR NO.11 Jul/10", "SUGAR NO.11 May/10", "WHEAT Jul/10", "PRIMARY NICKEL USD", "PRM HGH GD ALUMINIUM USD", "SPCL HIGH GRADE ZINC USD", "STANDARD LEAD USD"), class = "factor"), POSITION = c(2, -3, -2, -2, -18, -3, -5, 1, -5, 1), prix = c(702.9, -244.77, -166.48, -2273.8, -24876, -2985, -80.9, 15.95, -2512.5, 2423)), .Names = c("DESCRIPTION", "POSITION", "prix"), row.names = c("1", "2", "3", "4", "5", "6", "7", "8", "9", "51"), class = "data.frame") Your result is : pose16 <- structure(list(DESCRIPTION = structure(c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 12L), .Label = c("COPPER May/10", "COTTON NO.2 Jul/10", "CRUDE OIL miNY May/10", "GOLD Jun/10", "ROBUSTA COFFEE (10) Jul/10", "SOYBEANS Jul/10", "SUGAR NO.11 Jul/10", "SUGAR NO.11 May/10", "WHEAT Jul/10", "PRIMARY NICKEL USD", "PRM HGH GD ALUMINIUM USD", "SPCL HIGH GRADE ZINC USD", "STANDARD LEAD USD"), class = "factor"), POSITION = c(2, -3, -2, -2, -18, -3, -5, 1, -5, 1), prix = c(-702.9, 244.77, 166.48, 2273.8, 24876, 2985, 80.9, -15.95, 2512.5, -2423)), .Names = c("DESCRIPTION", "POSITION", "prix"), row.names = c("1", "2", "3", "4", "5", "6", "7", "8", "9", "51"), class = "data.frame") From: Henrique Dallazuanna [mailto:www...@gmail.com] Sent: Wednesday, May 12, 2010 3:32 PM To: arnaud Gaboury Cc: r-help@r-project.org Subject: Re: [R] data frame subscription Try this: transform(pose16, prix = POSITION * SETTLEMENT, SETTLEMENT = NULL, POSITION = POSITION * -1) On Wed, May 12, 2010 at 9:50 AM, arnaud Gaboury <arnaud.gabo...@gmail.com> wrote: Dear group, Here is my df : pose16 <- structure(list(DESCRIPTION = structure(c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 12L), .Label = c("COPPER May/10", "COTTON NO.2 Jul/10", "CRUDE OIL miNY May/10", "GOLD Jun/10", "ROBUSTA COFFEE (10) Jul/10", "SOYBEANS Jul/10", "SUGAR NO.11 Jul/10", "SUGAR NO.11 May/10", "WHEAT Jul/10", "PRIMARY NICKEL USD", "PRM HGH GD ALUMINIUM USD", "SPCL HIGH GRADE ZINC USD", "STANDARD LEAD USD"), class = "factor"), POSITION = c(-2, 3, 2, 2, 18, 3, 5, -1, 5, -1), SETTLEMENT = c(351.45, 81.59, 83.24, 1136.9, 1382, 995, 16.18, 15.95, 502.5, 2423 )), .Names = c("DESCRIPTION", "POSITION", "SETTLEMENT"), row.names = c("1", "2", "3", "4", "5", "6", "7", "8", "9", "51"), class = "data.frame") Here is my code : >pose16$prix<-pose16[,2]*pose16[,3] >pose16<-pose16[,-3] >pose16[,-1]<- -pose16[,-1] It works fine, as the resulting df is what I want. I am just wandering if these 3 command lines can be writen in only 1 or 2 lines?? TY for the help. ______________________________________________ R-help@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 ______________________________________________ R-help@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.