-1
Possessing this data set:
Índice Produto Classificação Comum Quilo
1 2 ABACAXI HAVAI A GRAUDO 3,32 2,2
2 3 ABACAXI HAVAI B MEDIO 2,81 1,8
3 4 ABACAXI HAVAI C MIUDO 2,21 1,4
4 5 BANANA MACA - 4,5 1
5 6 BANANA PRATA MG - 3,13 1
I want to multiply some values of the common column by a constant, for example, the 3 values of pineapple I want to multiply by 100, thus staying:
Índice Produto Classificação Comum Quilo
1 2 ABACAXI HAVAI A GRAUDO 332 2,2
2 3 ABACAXI HAVAI B MEDIO 281 1,8
3 4 ABACAXI HAVAI C MIUDO 221 1,4
4 5 BANANA MACA - 4,5 1
5 6 BANANA PRATA MG - 3,13 1
How can I do it for R?
If I want to add other products in multiplication just put one &? Ex: df[df$Product="PINEAPPLE HAWAII" & "BANANA MACA", "Comun"]*100
– Danilo Imbimbo
Marcus, another point, I want this new value after multiplication to replace the old value
– Danilo Imbimbo
The answer to the first question is no. You need to ask
|
(or) to choose lines with two or more products. The answer to the second question isdf[df$Produto=="ABACAXI HAVAI", "Comun"]
 <- df[df$Produto=="ABACAXI HAVAI", "Comun"]*100
.– Marcus Nunes