unique(property$Agent) unq_agent = unique(property$Agent) lix <- c() for (i in unq_agent) { j = sum(property$Sold[property$Agent==i])*0.02 x <- c(i = j) lix <- c(lix, x) } print(lix) i i i i i i i 347.62 25.60 338.60 13.50 14.80 84.82 92.40 i i i i i i i 27.50 218.82 19.10 79.26 95.40 35.60 101.22 i i i i 22.00 17.22 26.30 16.24 If I say x <- c(i) instead x <- c(i = j),
[1] "RayWhite" [2] "Belle" [3] "Raine&Horne" [4] "TraversGray" [5] "HarrisPartners" [6] "R&W" [7] "McGrath" [8] "BresicWhitney" [9] "Urbane" [10] "GreenSquareResidential" [11] "EeRealEstate" [12] "Viewey" [13] "GerberProperties" [14] "LJHooker" [15] "Martin" [16] "OneAgency" [17] "Iskandar" [18] "PlanetProperties" Can you give me solution, please?? I want that i can follow that for loop. So, RayWhite, Belle, Raine&Horne, ... instead i on my first result.
https://stackoverflow.com/questions/66773769/r-list-just-basic-list-with-for-loop March 24, 2021 at 10:05AM
没有评论:
发表评论