Answers for "pivot table R"

R
0

Pivot Table

SELECT * FROM   
(
    SELECT 
        category_name, 
        product_id
    FROM 
        production.products p
        INNER JOIN production.categories c 
            ON c.category_id = p.category_id
) t 
PIVOT(
    COUNT(product_id) 
    FOR category_name IN (
        [Children Bicycles], 
        [Comfort Bicycles], 
        [Cruisers Bicycles], 
        [Cyclocross Bicycles], 
        [Electric Bikes], 
        [Mountain Bikes], 
        [Road Bikes])
) AS pivot_table;
Code language: SQL (Structured Query Language) (sql)
Posted by: Guest on October-21-2021
0

pivot table in r dplyr

## make a table with our new variable
siteyear_summary %>%
  kable()
Posted by: Guest on August-07-2020

Browse Popular Code Answers by Language