[Qgis-user] How to shorten this in Field Calculator
Wouter Impens
wouter.impens at gmail.com
Thu Aug 29 00:11:17 PDT 2019
Hi Willem,
You could calculate this using a python script.
If you like, I could send you some code examples how to make a new field,
use expressions, etc. in python.
Greetings
Wouter Impens
Op wo 28 aug. 2019 om 13:58 schreef Willem Korevaar <wereldvak at gmail.com>:
> I would like to shorten the following proces (= workaround) of
> calculating a simple Rs (Spearman Rank correlation) in the Field
> Calculator .
>
> https://drive.google.com/file/d/1vuW50nm1h4LduaAO01ThO6Nv-VXUGBo9/view?usp=sharing
>
> [image: image.png]
> and as an example:
>
> [image: image.png]
>
> 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 %).
> 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.
> My workaround is in 2.18.9 :
>
>
> 1. using the plugin Sort and number and ranking both columns. So two
> more fields : r_014 and r_nw (rang x and y)
> 2. make kolom 6 ((x-y)2) using Field Calculator:
> ( "r_0-14" - "r_nw_ll" ) ^ 2
> 3. create new field in FC named RS:
> 1- ( ( 6 * ( sum( "kolom6" ) ) / ( ( (count( "BU_NAAM" ) ^ 2) * (
> count( "BU_NAAM" ) ) ) - count( "BU_NAAM" ) ) ) )
> 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.
> New fieldname = RS and with 'Real' and precision 5
> 4. in this case Rs = 0,488 which means a little correlation
> (I know that there should be no ties in the values, but that would
> make the proces more complicated in case of
>
> Is there a way in the FC I can do it in less steps?
> This is the link to the table used in QGIS and the Rs formula in the
> example:
>
> https://drive.google.com/file/d/1vuW50nm1h4LduaAO01ThO6Nv-VXUGBo9/view?usp=sharing
> I hope this all wil make sense :-)
>
>
> Gr
> Willem Korevaar
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20190829/f434665c/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 20802 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20190829/f434665c/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 3215 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20190829/f434665c/attachment-0003.png>
More information about the Qgis-user
mailing list