dear all

i'm struggling with naming in an array

diag.data is one of a series of 2x2 diagnostic testing arrays, with
'Outcome' columns (true/false) and 'Test' rows (High-risk, Low-risk),
drawn from a larger list object of 'results'

i can hard-code the names of the array using dimnames;

diag.data<-array(c(19,2,125,50),c(2,2)) #example to run - actually comes
out with rownames/colnames already attached

dimnames(diag.data)<-list(Rule=c("LR","HR"),Outcome=c("FALSE","TRUE"))

but i would really love to be able to soft-code it, using the different
'rule' names and slightly different 'outcomes' as extracted from the
main list of results, rather than just 'rule' and 'outcome' e.g.

dimnames(diag.data)<-list(names(result[1])=rownames(diag.data),names(result[[1]][2])=colnames(diag.data))

this doesn't work

i understand that the dimnames command is NOT executing the function
'names' and giving me the result of this, and have struggled and failed
to use the 'eval' expression with alternative environments (which i
don't understand ...)

can anyone assist?

cheers - bob


-- 


Dr Bob Phillips
MRC Research Training Fellow
CRD
University of York
York
YO10 5DD
t:  +44 (0)1904 321099
f:  +44 (0)1904 321041
e:  bob.phill...@york.ac.uk
www.york.ac.uk/inst/crd
www.crd.york.ac.uk/prospero

CRD is part of the National Institute for Health Research and is a
department of the University of York.

EMAIL DISCLAIMER: http://www.york.ac.uk/docs/disclaimer/email.htm

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to