ES
Size: a a a
ES
ВК
ЕТ
ЕТ
ЕТ
А
ЕТ
А
А
А
ЕТ
ЕТ
А
A
E
library (data.table)При запуске без функции все работает. Обернув в функцию не работает.
sample.purchases <- data.table(price = c(100, 300, 50, 700, 30),
ordernumber = c(1,1,1,2,3),
quantity = c(1,1,2,1,-1),
product_id = 1:5)
mark.position.portion <- function(purchases) {
table1<-purchases[quantity>0][, price.portion:=format((price*quantity)/sum(price*quantity), nsmall = 2), by=ordernumber]
return (table1)
}
mark.position.portion(sample.purchases)
А
library (data.table)При запуске без функции все работает. Обернув в функцию не работает.
sample.purchases <- data.table(price = c(100, 300, 50, 700, 30),
ordernumber = c(1,1,1,2,3),
quantity = c(1,1,2,1,-1),
product_id = 1:5)
mark.position.portion <- function(purchases) {
table1<-purchases[quantity>0][, price.portion:=format((price*quantity)/sum(price*quantity), nsmall = 2), by=ordernumber]
return (table1)
}
mark.position.portion(sample.purchases)
ВК
ВК
A
A