user25749499
user25749499

Reputation: 1

R language, count analytic not sure what can I use, pivot or cycle or something else

i need ideas) So i have a big dataframe

columns-id of the person, id of the subdepartments, and questions id.

I have a company, it's workers answered 60 questions. They have 3 options: neg-1, net-2, pos-3. They also segmented on departments (like this 1-2-gg-4. 1-all company.1-1 or 1-2 - two main divisions, then all divisions have departments (gg, km, etc) and all departments has sub-departments). I need to count what percent of workers answer positive, negative or neutral. And I need this information

  1. for all company 1
  2. for each division (2) 1-1 and 1-2
  3. for each department 1-1-gg etc
  4. for each sub-department 1-2-km-3 etc (not all departments have sub-departments).

So in the end i need a dataframe with rows made from 60 questions, columns: id of the subdepartments, pos percent, neg perc, neu perc. And some results for each level of company structure

I was trying to make it with cycle for questions and length(which) function for counting of different answers, but because of levels of the company cycle became bigger and bigger, and Im not sure how to make the dataframe from cycle results in this situation. I read all I can find for pivot functions but didnt find any usefull information. Im a beginner in analytics, so maybe I just don't know necessary tools

Upvotes: 0

Views: 27

Answers (0)

Related Questions