<div dir="ltr">Hi Willem, <div><br></div><div>You could calculate this using a python script.</div><div><br></div><div>If you like, I could send you some code examples how to make a new field, use expressions, etc. in python.</div><div><br></div><div><br></div><div>Greetings</div><div>Wouter Impens</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Op wo 28 aug. 2019 om 13:58 schreef Willem Korevaar <<a href="mailto:wereldvak@gmail.com">wereldvak@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I would like to shorten the following proces (= workaround)  of calculating a simple  Rs (Spearman Rank correlation) in the <span style="color:rgb(51,51,51);font-family:sans-serif;font-size:14px">Field Calculator</span> .<div><a href="https://drive.google.com/file/d/1vuW50nm1h4LduaAO01ThO6Nv-VXUGBo9/view?usp=sharing" target="_blank">https://drive.google.com/file/d/1vuW50nm1h4LduaAO01ThO6Nv-VXUGBo9/view?usp=sharing</a>  <br><div><div><img src="cid:ii_jzv5ce932" alt="image.png" width="264" height="65"><br></div></div><div>and as an example:</div><div><br></div><div><div><img src="cid:ii_jzv5a5uy1" alt="image.png" width="214" height="196"><br></div></div><div><br></div><div>Its about two columnsin the table  (X-Y in the example )  : P_00_14_JR (age 0-14 in %) and  P-N_W_AL (people from outside W-Europe in %). <br>I know that it can be done with an R- script, but as I m working with students and I want to show them how the formula works and R is not working anymore on the schoolsystem I tried a workaround. It works, but there are too many steps.<div>My workaround is in 2.18.9 :<div><br></div><div><ol><li>using the plugin Sort and number and ranking both columns. So two more fields : r_014 and r_nw (rang x and y)</li><li>make kolom 6 ((x-y)2) using Field Calculator:<br><span id="gmail-m_-5361861523940293868gmail-docs-internal-guid-f09c13eb-7fff-a41d-817b-9d6b38e16ef0"><span style="font-size:10pt;font-family:Arial;color:rgb(0,0,0);background-color:rgb(204,204,204);font-variant-numeric:normal;font-variant-east-asian:normal;vertical-align:baseline;white-space:pre-wrap">(  "r_0-14"   -   "r_nw_ll"   )  ^ 2</span></span> </li><li>create new field in FC named RS:<br><span id="gmail-m_-5361861523940293868gmail-docs-internal-guid-21617c82-7fff-bb0b-1c31-0a13e680d725"><span style="font-size:10pt;font-family:Arial;color:rgb(0,0,0);background-color:rgb(204,204,204);font-variant-numeric:normal;font-variant-east-asian:normal;vertical-align:baseline;white-space:pre-wrap">1- (  ( 6 *  (  sum(  "kolom6"  )  )  /  (  (  (count(  "BU_NAAM"  )  ^ 2) *  (  count(  "BU_NAAM"  )  )  )  -  count(  "BU_NAAM"  )  )  )  ) </span></span>  <br>In which 'BU_NAAM' = n (number of objects in this case names of neighbourhoods in Den Haag) but this one can be any other fieldname.<br>New fieldname = RS and with 'Real' and precision 5</li><li>in this case Rs = 0,488 which means a little correlation<br>(I know that there should be no ties in the values, but that would make the proces more complicated in case of </li></ol><div>Is there a way in the FC I can do it in less steps?<br>This is the link to the table used in QGIS and the Rs formula in the example:</div><div><a href="https://drive.google.com/file/d/1vuW50nm1h4LduaAO01ThO6Nv-VXUGBo9/view?usp=sharing" target="_blank">https://drive.google.com/file/d/1vuW50nm1h4LduaAO01ThO6Nv-VXUGBo9/view?usp=sharing</a><br></div><div>I hope this all wil make sense :-)</div><div><br></div><br><div dir="ltr" class="gmail-m_-5361861523940293868gmail_signature">Gr<br>Willem Korevaar</div></div></div></div></div></div>
_______________________________________________<br>
Qgis-user mailing list<br>
<a href="mailto:Qgis-user@lists.osgeo.org" target="_blank">Qgis-user@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a></blockquote></div>