title: Using R to manipulate dataframe: each row of a column to separate columns
body: <p>I have a longer dataframe with student name, subjects, question names and their marks. A short version of this dataframe looks like the below:</p>
  
  <pre><code>c1 c2 c3 c4 
  A  1  a   1
  A  1  b   0.5
  A  1  c   1
  A  2  a   2
  A  2  b   1.5
  A  2  c   3
  A  2  d   3
  B  1  a   0
  B  1  b   1.5
  B  1  c   2
  B  2  a   2
  B  2  b   2.5
  B  2  c   4
  B  2  d   5
  </code></pre>
  
  <p>Here A, B are students, 1,2 are subjects, a, b,c are question names and the last column is marks obtained by each student, in each subject and in each question.</p>
  
  <p>I would like to consolidate part of dataframe with question name column becoming heading for several columns with corresponding marks like below:</p>
  
  <pre><code>Student         Sub:1         Sub:2
  Name       a    b     c     a   b  c  d
  A          1   0.5    1     2  1.5 3  3
  B          0   1.5    2     2  2.5 4  5
  </code></pre>
  
  <p>I can use transpose function (<code>t(dataframe)</code>) to switch column to rows but I don't know how to do partly retaining details of students and marks.
  Can some one guide how can I achieve this?</p>