Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>A column <em>must be all of one data type</em>; you can't mix logical and numeric. </p> <p>Not sure how you would even do "long" analysis on multiple different data types because usually those are the same variables with different groupings. If you need to, try converting your logical values to numeric first (with <code>as.numeric</code>).</p> <p>While you're not using the <code>reshape</code> package, Hadley made this point in his discussion of the <code>melt()</code> function, which is performing the same task (see <a href="http://www.jstatsoft.org/v21/i12/paper" rel="nofollow noreferrer">this paper, for instance</a>):</p> <blockquote> <p>In the current implementation [of melt], there is only one assumption that melt makes: all measured values must be of the same type, e.g., numeric, factor, date. We need this assumption because the molten data is stored in an R data frame, and <strong>the value column can be only one type</strong>. Most of the time this is not a problem as there are few cases where it makes sense to combine different types of variables in the cast output.</p> </blockquote> <p><em>Edit:</em></p> <p>I think you may be trying to do two things at once. Is this what you want?</p> <pre><code>a &lt;- reshape(example.data[,-c(36:39)], direction = 'long', varying = c(29:32), v.names = c("Math34"), times = 2006:2009, idvar = "schoolnum") b &lt;- reshape(example.data[,-c(29:32)], direction = 'long', varying = c(36:39)-4, v.names = c("TFCIn"), times = 2006:2009, idvar = "schoolnum") c &lt;- merge(a,b) </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload