ranking

20 views
Skip to first unread message

zozo

unread,
May 20, 2020, 4:42:54 PM5/20/20
to netlogo-devel
Hello everyone,
I have a file of type csv
It contains a set of values, and I try to rank you for these values
, as in Excel(
  • Set ranking[0] to 1.
  • For each index i in the score-list
    • If score[i] equals score[i-1] they should have same ranknig:
      • ranking[i] = ranknig[i-1]
    • else the ranking should equal the current index:
      • ranking[i] = i + 1
        (+ 1 due to 0-based indecies and 1-based ranking)
and I tried some code
extensions [csv]
globals [data variable]
turtles-own [var ]

to setup
file-close-all
file-open "test1.csv"
;; read the data all at once by using csv:from-file
set data csv:from-file "test1.csv"
reset-ticks
end

to ranking
if file-at-end? [stop]
;; extract value from the list, using item 0 to remove the list, and just keep the value
set variable item 0 item ticks data


if ticks = length data [stop]

let rank-list sort-on [variable] turtles
let ranks n-values length rank-list [  ]
    (foreach rank-list ranks [ask ?1 [set variable 2] ] )
  tick

;show variable
end

, but I did not succeed with  netlogo(6.1)
any help plez
test1.csv
rank.nlogo

Aaron Andre Brandes

unread,
Jun 2, 2020, 12:12:00 PM6/2/20
to zozo, netlogo-devel

Hi Thanks for contacting us.

 

You should send your email to the netlogo-users group:  netlog...@googlegroups.com

That group is a forum for  users, netlogo-devel is for people working on building and extending the NetLogo platform.

 

More details from the netlogo-users group

 

This is a forum for discussion about NetLogo, the agent-based modeling environment from the Center for Connected Learning and Computer-Based Modeling at Northwestern University. Students, teachers, researchers, and independent learners are all welcome.

 

This is a great place to post about how you're using NetLogo, or questions about how to create models using the NetLogo language and software.

 

If you have a programming question, Stack Overflow is another possible place to get help under the NetLogo tag.

 

For questions about creating software using the NetLogo API's, improving the NetLogo application, and creating new extensions for NetLogo, visit the netlogo-devel Google Group.

 

Best,

Aaron

-- 

Aaron Brandes, Software Developer

Center for Connected Learning and Computer-Based Modeling

--
You received this message because you are subscribed to the Google Groups "netlogo-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netlogo-deve...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/netlogo-devel/f57ce446-8b18-4dc6-9029-49a4862d8498%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages