Christoph Scherber <Christoph.Scherber <at> agr.uni-goettingen.de> writes:

> 
> Dear R users,
> 
> I have a correlation matrix for a dataframe called "synth", for which I 
> now want to select only those cells that have correlations larger than 
> +/-0.6:
> 
> synth=data.frame(x=rnorm(10,1),y=rnorm(10,2),z=rnorm(10,0.5))
> 
> w=cor(synth,use="pairwise.complete.obs")
> w=as.data.frame(w)
> w[,sapply(w,abs(w),">",0.6)]
 

Dear Christoph,

just change the last command to

w[abs(w)>0.6]


Best wishes
Ingo

______________________________________________
[email protected] 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