Hi R users, I have a question about manipulating the dataframe. I want to create a new dataframe, and to multiply rows with different seasons for different constants.
DF year month day product1 product2 product3 1981 1 1 18 56 20 1981 1 2 19 45 22 1981 1 3 16 48 28 1981 1 4 19 50 21 1981 2 1 17 49 25 1981 2 2 20 47 23 1981 2 3 21 52 27 For example, how to multiply product1 in month1 by 3.1, and to multiply product3 in month2 by 2.0? I wrote the code like this but does not work. Thanks for your help. DF['month'==1, ]$product1_1 = DF['month'==1, ]$product1 * 3.1; DF['month'==2, ]$product3_1 = DF['month'==1, ]$product3 * 2.0; [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.