I want to standardize the changesize
as the following code,and It seems to me there is no problem in my code. Why this gives me the error as
Error in summarise_impl(.data, dots) : expecting a single value
str(pricechange_0.5_2)
Classes ‘tbl_df’, ‘tbl’ and 'data.frame':1907600 obs. of 13 variables:
$ url : chr "http://item.yhd.com/item/1242267"
$ time : chr "2016-01-02" "2016-01-02" "2016-01-02" "2016-01-02" ...
$ changPrice : num 0.997 1 1 1 1 ...
$ classify : Factor w/ 251 levels "","Clothing"....
$ changesize : num -0.334 0 0 0 0 ...
$ abs_changesize: num 0.334 0 0 0 0 ...
library(dplyr)
by_url <- group_by(pricechange_0.5_2,url)
url_datad <- summarise(by_url,url_sd_chasize=(changesize -
mean(changesize))/sd(changesize))
Here is a sample of my data.
A tibble: 10 × 3
url hangesize abs_changesize
<chr> <dbl> <dbl>
http://item.yhd.com/item/1242267 -0.3343999 0.3343999
http://item.jd.com/418657.html 0.0000000 0.0000000
...
Any other way to standadrize the changesize
as url
?