Skip to content
Back to formatted view

Raw Message

Message-ID: <CAEy8Jr1GuQFHqmVPRSoy1oq8NaSCRL-vvR9sPNuY9N8G4+webw@mail.gmail.com>
Date: 2013-02-01T11:54:12Z
From: Simone Gabbriellini
Subject: how to

Dear List,

I have a list of lists and on each list I want to apply a function
from the igraph package, graph.knn. I need to calculate graph.knn for
each list on a graph g, then retrieve one of the result called $knn
and calculate its mean. The non-R style code looks like this:

for(i in listOfLists){
	print(mean(graph.knn(g, i)$knn))
}

Is there any way to convert this in a one-liner? I have tried to
figure it out with lapply() or mapply() but with no success.

Thank you in advance for your help.

Simone

-- 
Simone Gabbriellini, PhD

PostDoc at DISI, University of Bologna
mobile: +39 340 39 75 626
email: simone.gabbriellini at unibo.it
home: www.digitaldust.it

DigitalBrains srl
Amministratore
mobile: +39 340 39 75 626
email: simone.gabbriellini at digitalbrains.it
home: www.digitalbrains.it