title: ggplot not adopting aes - linetype
body: <p>I am seeing some strange behavior in r, trying to use ggplot. </p>
  
  <p>I cannot recreate the problem with a sample dataset as i can't work out what the problem is with the dataset i am using. Essentially i have two variables from the same dataset and the aes is being applied to one but not the other. </p>
  
  <p>This is the dataframe: temp</p>
  
  <pre><code>temp
  # A tibble: 504 x 5
  # Groups:   continent [6]
     continent  year urban.pop predicted.estimated.pop       pop
     &lt;chr&gt;     &lt;int&gt;     &lt;dbl&gt; &lt;chr&gt;                       &lt;dbl&gt;
   1 Africa     1950  32658962 estimated.pop            32658962
   2 Africa     1955  41419217 estimated.pop            41419217
   3 Africa     1960  53008425 estimated.pop            53008425
   4 Africa     1965  66348577 estimated.pop            66348577
   5 Africa     1970  82637370 estimated.pop            82637370
   6 Africa     1975 103198989 estimated.pop           103198989
   7 Africa     1980 128615954 estimated.pop           128615954
   8 Africa     1985 160721947 estimated.pop           160721947
   9 Africa     1990 200111296 estimated.pop           200111296
  10 Africa     1995 241824184 estimated.pop           241824184
  </code></pre>
  
  <p>I want to plot this dataframe to look as follows:</p>
  
  <pre><code>ggplot(temp, aes(x = year, y = pop, col = continent, linetype = predicted.estimated.pop)) +
    geom_line()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Sb5Rk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Sb5Rk.png" alt="enter image description here"></a></p>
  
  <p>This looks right, but when i change y axis to plot <code>urban.pop</code> i get the following, where the linetype aes has not been applied:</p>
  
  <pre><code>ggplot(temp, aes(x = year, y = urban.pop, col = continent, linetype = predicted.estimated.pop)) +
    geom_line()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/g3ZGr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/g3ZGr.png" alt="enter image description here"></a></p>
  
  <p>As can be seen above, both pop and urban.pop are class: dbl. They are also identical:</p>
  
  <pre><code>sum(temp$pop - temp$urban.pop, na.rm = T)
  [1] 0
  </code></pre>
  
  <p>The only thing i can note is that <code>temp</code> is a grouped df:</p>
  
  <pre><code>str(temp)
  Classes ‘grouped_df’, ‘tbl_df’, ‘tbl’ and 'data.frame': 504 obs. of  5 variables:
   $ continent              : chr  "Africa" "Africa" "Africa" "Africa" ...
   $ year                   : int  1950 1955 1960 1965 1970 1975 1980 1985 1990 1995 ...
   $ urban.pop              : num  32658962 41419217 53008425 66348577 82637370 ...
   $ predicted.estimated.pop: chr  "estimated.pop" "estimated.pop" "estimated.pop" "estimated.pop" ...
   $ pop                    : num  32658962 41419217 53008425 66348577 82637370 ...
   - attr(*, "vars")= chr "continent"
   - attr(*, "drop")= logi TRUE
   - attr(*, "indices")=List of 6
    ..$ : int  0 1 2 3 4 5 6 7 8 9 ...
    ..$ : int  21 22 23 24 25 26 27 28 29 30 ...
    ..$ : int  42 43 44 45 46 47 48 49 50 51 ...
    ..$ : int  63 64 65 66 67 68 69 70 71 72 ...
    ..$ : int  84 85 86 87 88 89 90 91 92 93 ...
    ..$ : int  105 106 107 108 109 110 111 112 113 114 ...
   - attr(*, "group_sizes")= int  84 84 84 84 84 84
   - attr(*, "biggest_group_size")= int 84
   - attr(*, "labels")='data.frame':  6 obs. of  1 variable:
    ..$ continent: chr  "Africa" "Asia" "Europe" "LAC" ...
    ..- attr(*, "vars")= chr "continent"
    ..- attr(*, "drop")= logi TRUE
  </code></pre>
  
  <p>I can't work out why these two variables drive different results for the linetype aes. The reason I need to fix this is i have another variable in the original data set that is behaving the same way as urban.pop. </p>
  
  <p>Can anyone explain this to me, or help resolve the problem?</p>