r - Keeping the main name of column using dcast -


i have rows same name , want convert them columns keeping main name of column , add 1 or 2 etc. according how many columns exist.

i use make it:

setdt(df)[, n:= 1:.n, maincol] df <- dcast(df, url~n, value.var=c("stock")) 

what expect have names stock_1, stock_2 etc. every column has number 1,2 etc. how can modify it?


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -