Note that there are some explanatory texts on larger screens.

plurals
  1. POSize of dataset causing calculation errors
    primarykey
    data
    text
    <p>I have modified this code below from a <a href="https://stackoverflow.com/questions/14631548/efficiency-of-transforming-counts-to-percentages-and-index-scores">previous question I asked</a>:</p> <pre><code>Input_Data &lt;- read.csv("http://dl.dropbox.com/u/58164604/Input_Data.csv", row.names=1, stringsAsFactors = FALSE) TPop&lt;-Input_Data[1] TPopCount &lt;- TPop[, 1] TPopSum &lt;- sum(TPopCount) OACRaw&lt;-Input_Data[,4:ncol(Input_Data)] OACRawCount &lt;-ncol(OACRaw) OA_Percentage &lt;- TPopCount/TPopSum * 100 Data_Per_Row &lt;- OACRaw/matrix(rep(TPopCount, each=OACRawCount), ncol=OACRawCount, byrow=T)*100 Data_Index_Row &lt;- Data_Per_Row/OA_Percentage * 100 names(Data_Per_Row) &lt;- names(Data_Index_Row) &lt;- names(OACRaw) </code></pre> <p>However, when I try and get it to work for a larger dataset (186 columns and over 180,000 rows) it gives the following error:</p> <pre><code>Error in FUN(left, right) : non-numeric argument to binary operator </code></pre> <p>However when the same code is run a smaller dataset (46 columns and 180,00 rows) it works fine:</p> <pre><code>Input_Data &lt;- read.csv("http://dl.dropbox.com/u/58164604/Input_Data.csv", row.names=1, stringsAsFactors = FALSE) TPop&lt;-Input_Data[1] TPopCount &lt;- TPop[, 1] TPopSum &lt;- sum(TPopCount) OACRaw&lt;-Input_Data[,4:50] OACRawCount &lt;-ncol(OACRaw) OA_Percentage &lt;- TPopCount/TPopSum * 100 Data_Per_Row &lt;- OACRaw/matrix(rep(TPopCount, each=OACRawCount), ncol=OACRawCount, byrow=T)*100 Data_Index_Row &lt;- Data_Per_Row/OA_Percentage * 100 names(Data_Per_Row) &lt;- names(Data_Index_Row) &lt;- names(OACRaw) </code></pre> <p>Can anyone explain why this is and how I can get this code to work on a larger dataset? Thanks</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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