Re: [R] Remove highly correlated variables from a data frame or matrix

2019-11-15 Thread Peter Langfelder
Try hclust(as.dist(1-calc.rho), method = "average"). Peter On Fri, Nov 15, 2019 at 10:02 AM Ana Marija wrote: > > HI Peter, > > Thank you for getting back to me and shedding light on this. I see > your point, doing Jim's method: > > > keeprows<-apply(calc.rho,1,function(x) return(sum(x>0.8)<3))

[R] Labeling Stacked Bar Plots Representing Percentages with Count Data

2019-11-15 Thread Josh B
Hello, I am trying to include the count labels on stacked bar plots which represent percentages. I want to show x-amount of individuals make up the graphed percentages. However, when I include the count labels my y-axis gets blown out of proportion because it changes to match the count data, not

Re: [R] Glmnet survival cox predict

2019-11-15 Thread David Winsemius
On 11/15/19 10:49 AM, Amir Hadanny wrote: Hi all, i'm trying to get the prediction probabilities for a survival elastic net. When i use try to predict using the train model on the test set, it creates an object with the number rows of the train data (6400 rows) instead of the test data (2400

[R] Glmnet survival cox predict

2019-11-15 Thread Amir Hadanny
Hi all, i'm trying to get the prediction probabilities for a survival elastic net. When i use try to predict using the train model on the test set, it creates an object with the number rows of the train data (6400 rows) instead of the test data (2400 rows). I really don't understand why, and that

Re: [R] Remove highly correlated variables from a data frame or matrix

2019-11-15 Thread Jim Lemon
While the remedy for your dissatisfaction with my previous solution should be obvious, I will make it explicit. # that is rows containing at most one value > 0.8 # ignoring the diagonal keeprows<-apply(ro246,1,function(x) return(sum(x>0.8)<2)) ro246.lt.8<-ro246[keeprows,keeprows] Jim

Re: [R] Remove highly correlated variables from a data frame or matrix

2019-11-15 Thread Ana Marija
if it is of any help my correlation matrix (calc.rho) was done here, under LDmatrix tab https://ldlink.nci.nih.gov/?tab=ldmatrix and dataset of 246 is bellow rs56192520 rs3764410 rs145984817 rs1807401 rs1807402 rs35350506 rs2089177 rs12325677 rs62064624 rs62064631 rs2349295 rs2174369 rs7218554

Re: [R] Remove highly correlated variables from a data frame or matrix

2019-11-15 Thread Ana Marija
HI Peter, Thank you for getting back to me and shedding light on this. I see your point, doing Jim's method: > keeprows<-apply(calc.rho,1,function(x) return(sum(x>0.8)<3)) > ro246.lt.8<-calc.rho[keeprows,keeprows] > ro246.lt.8[ro246.lt.8 == 1] <- NA > (mmax <- max(abs(ro246.lt.8), na.rm=TRUE))