[R] horizontal grouped stacked plots and removing space between bars

2023-06-28 Thread Ana Marija
I have code like this: data <- read.csv("test1.csv", stringsAsFactors=FALSE, header=TRUE) # Graph myplot=ggplot(data, aes(fill=condition, y=value, x=condition)) + geom_bar(position="dodge", stat="identity", width=0.5) + scale_fill_manual(values=c("#7b3294", "#c2a5cf", "#a6dba0",

[R] Issue with crammed Y axis

2023-06-16 Thread Ana Marija
Hi, I have a data frame like this: > dput(df) structure(list(ID = 1:8, Type = c("gmx mdrun -ntmpi 8 -ntomp 1 -s benchPEP.tpr -nsteps 1 -resethway", "gmx mdrun -ntmpi 8 -ntomp 1 -s benchPEP.tpr -nsteps 1 -resethway", "gmx mdrun -ntmpi 8 -s benchPEP.tpr -nsteps 4000 -resetstep 3000", "gmx

Re: [R] log transform a data frame

2023-06-13 Thread Ana Marija
orical data, but not continuous, numeric data which are better > handled with box plots or strip charts. > > Do not use printouts of your data since it hides important information. > Use str(a11) and dput(a11) or dput(head(a11)) to provide useful information > about your data. > >

[R] log transform a data frame

2023-06-13 Thread Ana Marija
Hello, I have a data frame like this: d11=suppressWarnings(read.csv("/Users/anamaria/Downloads/B1.csv", stringsAsFactors=FALSE, header=TRUE)) > d11 X Domain.decomp. DD.com..load Neighbor.search Launch.PP.GPU.ops. Comm..coord. 1 SYCL 2. 10 3.7

Re: [R] how to do inverse log of every value in every column in data frame

2021-10-14 Thread Ana Marija
trouble with having an open mind is that people keep coming along and > sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > > On Thu, Oct 14, 2021 at 10:10 AM Ana Marija > wrote: > >> Hi All, >> >> I hav

[R] how to do inverse log of every value in every column in data frame

2021-10-14 Thread Ana Marija
Hi All, I have a data frame like this: > head(b) LRET02LRET04LRET06LRET08LRET10LRET12LRET14 1 0 0.6931472 . 1.0986123 1.0986123 1.0986123 0.6931472 2 2.1972246 2.4849066 2.4849066 . 2.5649494 2.6390573 2.6390573 3 1.6094379 1.7917595 1.6094379

Re: [R] calculate power-linear mixed effect model

2021-09-17 Thread Ana Marija
gt; -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > On Fri, Sep 17, 2021 at 12:22 PM Ana Marija > wrote: > > > > Hi All, > > > > I plan to identify metabolite levels that differ between individuals > > with various retinopa

[R] calculate power-linear mixed effect model

2021-09-17 Thread Ana Marija
Hi All, I plan to identify metabolite levels that differ between individuals with various retinopathy outcomes (DR or noDR). I plan to model metabolite levels using linear mixed models ref as implemented in lmm2met software. The model covariates will include: age, sex, SV1, SV, and

Re: [R] unable to remove NAs from a data frame

2021-09-16 Thread Ana Marija
) > #[1] 145092258 > > df[14509227,] # beyond nrow(df) by 2 > > > Hope this helps, > > Rui Barradas > > > Às 15:12 de 16/09/21, Ana Marija escreveu: > > Hi All, > > > > I have lines in file that look like this: > > > >> df[14

[R] unable to remove NAs from a data frame

2021-09-16 Thread Ana Marija
Hi All, I have lines in file that look like this: > df[14509227,] SNP A1 A2 freq b se p N 1: NA NA NA NA NA data looks like this: > head(df) SNP A1 A2 freq b se p N 1: rs74337086 G A 0.0024460 0.1627 0.1231 0.1865 218792 2: rs76388980 G

[R] Error in n * rvec : non-numeric argument to binary operator

2021-04-19 Thread Ana Marija
Hello, I have this code, and when I run it: > kbpowerf() Error in n * rvec : non-numeric argument to binary operator this is the code: function (){ #USER SPECIFICATION PORTION alpha=0.05 #DESIGNATED ALPHA g=3 #NUMBER OF GROUPS nvec=c(25,10,15) #GROUP SIZES

[R] how to quantify outliers on multi-dimensional scaling plot?

2021-03-31 Thread Ana Marija
Hello, I am in process of writing a grant where I am explaining my planned methylation analysis using R software "minfi". In the text of the grant I am mentioning looking for samples containing outliers in the multi-dimensional scaling (MDS) plot https://rdrr.io/bioc/minfi/man/mdsPlot.html . My

Re: [R] making code (loop) more efficient

2020-12-16 Thread Ana Marija
rsplit(names, ":")[-2]] out <- data[, .(rsid, ref_allele, eff_allele)][, WGT := files[i]][] } return(out) rm(data) gc() } parallel::stopCluster(cl) big_data <- rbindlist(lst_out, fill = TRUE) On Wed, Dec 16, 2020 at 9:31 AM Ana Marija wrote: >

Re: [R] making code (loop) more efficient

2020-12-16 Thread Ana Marija
that the filename > # is stored in files[i] > files<-"retina.ENSG0135776.wgt.RDat" > i<-1 > WGT<-rep(files[i],length(rsid)) > data<-data.frame(rsid=rsid,weight=a$top1, > ref_allele=ref_allele,eff_allele,WGT=WGT) > data > > Note that the output is

Re: [R] making code (loop) more efficient

2020-12-15 Thread Ana Marija
and see if it contains a > column named "blup" or just the values that were extracted from > a$blup. Also, I assume that weight=blup looks for an object named > "blup", which may not be there. > > Jim > > On Wed, Dec 16, 2020 at 1:20 PM Ana Marija > wro

Re: [R] making code (loop) more efficient

2020-12-15 Thread Ana Marija
much experience with data tables I may be > wrong, but I suspect that the column name "blup" may not be visible or > even present in "data". I don't see it in "dd" above this code > fragment. > > Jim > > On Wed, Dec 16, 2020 at 11:12 AM Ana Marija > wrot

[R] making code (loop) more efficient

2020-12-15 Thread Ana Marija
Hello, I made a terribly inefficient code which runs forever but it does run. library(dplyr) library(splitstackshape) datalist = list() files <- list.files("/WEIGHTS1/Retina", pattern=".RDat", ignore.case=T) for(i in files) { a<-get(load(i)) names <- rownames(a) data <-

Re: [R] how to order variables on correlation plot

2020-11-06 Thread Ana Marija
lp page, ?corrplot . > > -- > > David. > > On 11/6/20 6:08 AM, Ana Marija wrote: > > sorry forgot to attach the plot. > > On Fri, Nov 6, 2020 at 8:07 AM Ana Marija wrote: > > Hello > > I have data like this: > > head(my_data) > > subjects DIABDUR HB

Re: [R] how to order variables on correlation plot

2020-11-06 Thread Ana Marija
sorry forgot to attach the plot. On Fri, Nov 6, 2020 at 8:07 AM Ana Marija wrote: > > Hello > > I have data like this: > > > head(my_data) > subjects DIABDUR HBA1C ESRD SEX AGE PHENO C1 C2 > 1 fam0110_G110 38 9.41 2 51 2 -

[R] how to order variables on correlation plot

2020-11-06 Thread Ana Marija
Hello I have data like this: > head(my_data) subjects DIABDUR HBA1C ESRD SEX AGE PHENO C1 C2 1 fam0110_G110 38 9.41 2 51 2 -0.01144980 0.002661140 2 fam0113_G113 30 12.51 2 40 2 -0.00502052 -0.000929061 3 fam0114_G114 23 8.4

Re: [R] how do I remove entries in data frame from a vector

2020-10-21 Thread Ana Marija
Makes sense, thank you! On Wed, 21 Oct 2020 at 17:46, Rolf Turner wrote: > > On Wed, 21 Oct 2020 16:15:22 -0500 > Ana Marija wrote: > > > Hello, > > > > I have a data frame with one column: > > > > > remove > > > >

Re: [R] how do I remove entries in data frame from a vector

2020-10-21 Thread Ana Marija
e %in% as.character(remove$V1)] > > > > > > Hope this helps, > > > > Rui Barradas > > > > Às 22:15 de 21/10/20, Ana Marija escreveu: > >> Hello, > >> > >> I have a data frame with one column: > >> &g

[R] how do I remove entries in data frame from a vector

2020-10-21 Thread Ana Marija
Hello, I have a data frame with one column: > remove V1 1 ABAFT_g_4RWG569_BI_SNP_A10_35096 2 ABAFT_g_4RWG569_BI_SNP_B12_35130 3 ABAFT_g_4RWG569_BI_SNP_E09_35088 4 ABAFT_g_4RWG569_BI_SNP_E12_35136 5 ABAFT_g_4RWG569_BI_SNP_F11_35122 6

Re: [R] 2 D density plot interpretation and manipulating the data

2020-10-09 Thread Ana Marija
. > And if it's a good idea, then how much to trim. > > > On Sat, Oct 10, 2020 at 5:47 AM Ana Marija > wrote: > > > > Hi Bert, > > > > Another confrontational response from you... > > > > You might have noticed that I use the word "outl

Re: [R] 2 D density plot interpretation and manipulating the data

2020-10-09 Thread Ana Marija
an open mind is that people keep coming along and > sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > > On Fri, Oct 9, 2020 at 8:25 AM Ana Marija wrote: >> >> Hi Abby, >> >> thank you for getting bac

Re: [R] 2 D density plot interpretation and manipulating the data

2020-10-09 Thread Ana Marija
Hi Abby, thank you for getting back to me and for this useful information. I'm trying to detect the outliers in my distribution based of mean and variance. Can I see that from the plot I provided? Would outliers be outside of ellipses? If so how do I extract those from my data frame, based on

Re: [R] 2 D density plot interpretation and manipulating the data

2020-10-08 Thread Ana Marija
NP[SNP$density>400,] and plot it again: p <- ggplot(a, mapping = aes(x = mean, y = var)) p <- p + geom_density_2d() + geom_point() + my.theme + ggtitle("SNPS_red") On Thu, Oct 8, 2020 at 3:52 PM Ana Marija wrote: > > Hello, > > I have a data frame like this: > >

[R] 2 D density plot interpretation and manipulating the data

2020-10-08 Thread Ana Marija
Hello, I have a data frame like this: > head(SNP) mean var sd FQC.10090295 0.0327 0.002678 0.0517 FQC.10119363 0.0220 0.000978 0.0313 FQC.10132112 0.0275 0.002088 0.0457 FQC.10201128 0.0169 0.000289 0.0170 FQC.10208432 0.0443 0.004081 0.0639 FQC.10218466 0.0116 0.000131

Re: [R] how to turn column into column names and fill it with values

2020-09-29 Thread Ana Marija
4:ncol(mt)) mt[,i] <- 1 + (names(mt)[i]== mt$PLATE) Thanks! On Tue, Sep 29, 2020 at 12:08 PM Ana Marija wrote: > > HI Bert, > > thank you for getting back to me. > I tried this: > > > dat <- cbind(mc, matrix(0,ncol = 34)) > > head(dat) > FID IID PLATE 1

Re: [R] how to turn column into column names and fill it with values

2020-09-29 Thread Ana Marija
69 2 1 1 > 5 fam0118 G118 5XAV049 1 1 2 > 6 fam0119 G119 cherry 1 2 1 > > > Bert Gunter > > "The trouble with having an open mind is that people keep coming along and > sticking things into it." > -- Opus (aka Ber

[R] how to turn column into column names and fill it with values

2020-09-29 Thread Ana Marija
Hello, I have a data frame like this: > head(mc) FID IID PLATE 1 fam0110 G110 4RWG569 2 fam0113 G113 cherry 3 fam0114 G114 cherry 4 fam0117 G117 4RWG569 5 fam0118 G118 5XAV049 6 fam0119 G119 cherry ... > dim(mc) [1] 16254 > length(unique(mc$PLATE)) [1] 34 I am trying to make a

Re: [R] help with nesting if else statements

2020-09-23 Thread Ana Marija
osition 1 taken as TRUE when assigning to type 'logical' (column 6 named 'PHENO') Please advise, Ana On Wed, Sep 23, 2020 at 2:48 PM Jeremie Juste wrote: > > > Hello Ana Marija, > > I cannot reproduce your error, > > with a$PHENO=ifelse(a$PLASER==2 |a$RTNPTHY==2, 2, ifelse(

Re: [R] help with nesting if else statements

2020-09-23 Thread Ana Marija
, 2020 at 11:43 AM Ana Marija wrote: > > Hello, > > I have a data frame as shown bellow. > I want to create a new column PHENO which will be defined as follows: > if CURRELIG==1 -> PHENO==1 > in the above subset those that have: > PLASER==2 -> PHENO==2 > and >

[R] help with nesting if else statements

2020-09-23 Thread Ana Marija
Hello, I have a data frame as shown bellow. I want to create a new column PHENO which will be defined as follows: if CURRELIG==1 -> PHENO==1 in the above subset those that have: PLASER==2 -> PHENO==2 and those where RTNPTHY==1 -> PHENO==1 I tried doing this: a$PHENO=ifelse(a$CURRELIG==1 |

Re: [R] how to overlay two histograms

2020-09-17 Thread Ana Marija
gt; barpos<-barplot(counts~name+CHR,data=d,beside=TRUE,names.arg=rep("",22)) > legend(40,22,c("new","old"),fill=c("gray20","gray80")) > library(plotrix) > staxlab(1,at=colMeans(barpos),labels=1:22) > > Jim > > On Fri, Sep

[R] how to overlay two histograms

2020-09-17 Thread Ana Marija
Hello, I am trying to overlay two histograms with this: p <- ggplot(d, aes(CHR, counts, fill = name)) + geom_bar(position = "dodge") p but I am getting this error: Error: stat_count() can only have an x or y aesthetic. Run `rlang::last_error()` to see where the error occurred. my data is this:

Re: [R] How to represent the effect of one covariate on regression results?

2020-09-15 Thread Ana Marija
% had Type 1. (my TD covariate is reference for the type of diabetes) In the attach is the description of the data. Cheers, Ana On Tue, Sep 15, 2020 at 7:59 PM David Winsemius wrote: > > > On 9/15/20 8:57 AM, Ana Marija wrote: > > Hi Abby and David, > > > > Th

Re: [R] How to represent the effect of one covariate on regression results?

2020-09-15 Thread Ana Marija
; > https://groups.google.com/g/plink2-users?pli=1 > > > -- > > David. > > On 9/14/20 6:29 AM, Ana Marija wrote: > > Hello, > > > > I was running association analysis using --glm genotypic from: > > https://www.cog-genomics.org/plink/2.0/assoc with these

Re: [R] how to replace values in a named vector

2020-09-14 Thread Ana Marija
sorry not replace with NA but with empty string for a name, for example for example this: > geneSymbol["Ku8QhfS0n_hIOABXuE"] Ku8QhfS0n_hIOABXuE "MACC1" would go when I subject it to > geneSymbol["Ku8QhfS0n_hIOABXuE"] Ku8QhfS0n_hIOABXuE On Mon,

[R] How to represent the effect of one covariate on regression results?

2020-09-14 Thread Ana Marija
Hello, I was running association analysis using --glm genotypic from: https://www.cog-genomics.org/plink/2.0/assoc with these covariates: sex,age,PC1,PC2,PC3,PC4,PC5,PC6,PC7,PC8,PC9,PC10,TD,array,HBA1C. The result looks like this: #CHROMPOSIDREFALTA1TESTOBS_CT

Re: [R] How to extract information from .Rdata format

2020-07-31 Thread Ana Marija
ed for tutorials also. This list cannot > substitute for such homework on your own. > > Bert Gunter > > "The trouble with having an open mind is that people keep coming along and > sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County&qu

Re: [R] How to extract information from .Rdata format

2020-07-31 Thread Ana Marija
It seems that "treatment" and "patient" are just vectors. > treatment [1] "treat" "treat" "treat" "treat" "treat" "control" "control" [8] "control" "control" "cont

Re: [R] How to extract information from .Rdata format

2020-07-31 Thread Ana Marija
uot;treatment" > str(treatment) chr [1:10] "treat" "treat" "treat" "treat" "treat" "control" "control" ... but this is not the format I need. On Fri, Jul 31, 2020 at 9:18 PM Ana Marija wrote: > > Hello, > >

[R] How to extract information from .Rdata format

2020-07-31 Thread Ana Marija
Hello, I have this file: > a=load("paired_example.Rdata") > a [1] "rawdata" "treatment" "patient" I can extract "rawdata" with: dat<-local(get(load("paired_example.Rdata"))) Can you please advise how would I extract in data frame "treatment" and "patient"? Thanks Ana

Re: [R] How to loop over two files ...

2020-06-22 Thread Ana Marija
Thank you so much as.character(r) indeed resolved the issue! On Sat, Jun 20, 2020 at 3:47 AM Ivan Krylov wrote: > > On Fri, 19 Jun 2020 19:36:41 -0500 > Ana Marija wrote: > > > Error in cat(x, file = file, sep = c(rep.int(sep, ncolumns - 1), > > "\n"),

Re: [R] How to loop over two files ...

2020-06-19 Thread Ana Marija
but I try to avoid extras > > make your for statements: > > for ( a in rownames(f1) ) { > > # a will now be a row number rather than the value, so replace ' a ' in > the paste0 with: f1[ a, 1] > > so > > ext <- paste0( "/ld/human/pairwise/", >

Re: [R] How to loop over two files ...

2020-06-19 Thread Ana Marija
SNPs at the time and I need to do that for 300 pairs On Fri, Jun 19, 2020 at 6:42 PM Rasmus Liland wrote: > > On 2020-06-19 14:34 -0500, Ana Marija wrote: > > > > I have two files (each has 300 lines)like this: > > The example looks quite similar to the R example in &g

Re: [R] How to loop over two files ...

2020-06-19 Thread Ana Marija
u may have something that adds it but better to use > something that works. So try using: > > library(readr) > f1 <- read_tsv("1g.txt", col.names=F) > > This will give you a tibble with f1$X1 with the file in it > > then loop it with (a in as.list(f1[,1]) > > Ot

Re: [R] How to loop over two files ...

2020-06-19 Thread Ana Marija
thing wrong? Do I need any other libraries loaded? Thanks Ana On Fri, Jun 19, 2020 at 3:49 PM Rasmus Liland wrote: > > On 2020-06-19 14:34 -0500, Ana Marija wrote: > > > > server <- "http://rest.ensembl.org; > > ext <- > > "/ld/human/pairwise/rs679236

Re: [R] How to loop over two files ...

2020-06-19 Thread Ana Marija
> > r <- GET(paste(server, ext, sep = ""), > content_type("application/json")) > > # You presumably need to do something with 'r' at the > moment its over written by the next loop.. were > # you appending

[R] How to loop over two files ...

2020-06-19 Thread Ana Marija
Hello, I have two files (each has 300 lines)like this: head 1g.txt rs6792369 rs1414517 rs16857712 rs16857703 rs12239392 ... head 1n.txt rs1042779 rs2360630 rs10753597 rs7549096 rs2343491 ... For each pair of rs# from those two files I can run this command in R library(httr) library(jsonlite)

Re: [R] comparing variances/distributions

2020-06-17 Thread Ana Marija
proximate in the presence of ties as I understand high p-values here say I cannot claim statistical support for a difference, but low p-values are not evidence of sameness? D should be the maximum difference between the two probability distributions? On Wed, Jun 17, 2020 at 3:06 PM Ana Marija wrote: > &g

[R] comparing variances/distributions

2020-06-17 Thread Ana Marija
Hello, I have p values from two distributions, Pold and Pnew > head(m) CHR POS MARKER Pnew Pold 1: 1 785989 rs2980300 0.1419 0.9521 2: 1 1130727 rs10907175 0.1022 0.4750 3: 1 1156131 rs2887286 0.3698 0.5289 4: 1 1158631 rs6603781 0.1929 0.2554 5: 1 1211292 rs6685064

Re: [R] how to change manhattan plot code to get a different color per chromosome

2020-06-16 Thread Ana Marija
pos<--log10(x[,p]) > plot(x[,BP],ypos,ylim=c(0,max(ypos,na.rm=TRUE)*1.05), > main=main,xlab=xlab,ylab=ylab, > pch=pch,col=chrcol[x[,CHR]],cex=4,xaxt="n") > abline(h=-log10(siglevel),lty=2) > staxlab(1,at=(1:nchr) + 0.5,labels=chrlab) > sigindx<-which(ypos >

[R] how to change manhattan plot code to get a different color per chromosome

2020-06-15 Thread Ana Marija
Hello, Is there is a way to set colors in this plot to look like this one in attach (different color for each CHR-there is 22 of them)? library(qqman) results_log <- read.table("meta_p_pos_chr.F", head=TRUE,stringsAsFactors=FALSE) png("META.png")

Re: [R] if else statement adjustemtn

2020-06-15 Thread Ana Marija
a(b$pheno),]$FLASER,NA) > # use the valid PLASER values when FLASER if NA > b[is.na(b$pheno),]$pheno<-ifelse(!is.na(b[is.na(b$pheno),]$PLASER), > b[is.na(b$pheno),]$PLASER,NA) > b > > I could write that mess in one straitjacket of conditional statements > but my brain hurts eno

Re: [R] if else statement adjustemtn

2020-06-12 Thread Ana Marija
opriate logic to get rid of only the > ones you don't want. > > Jim > > On Sat, Jun 13, 2020 at 12:50 PM Ana Marija > wrote: > > > > Hi Rasmus, > > > > thank you for getting back to be, the command your provided seems to > > add all 11 NAs to 2s > &

Re: [R] if else statement adjustemtn

2020-06-12 Thread Ana Marija
; > > On Sat, Jun 13, 2020 at 10:46 AM Ana Marija wrote: > > > > > > > > I am trying to make a new column > > > > "pheno" so that I reduce the number > > > > of NAs > > > > > > it looks like those two NA values in >

Re: [R] if else statement adjustemtn

2020-06-12 Thread Ana Marija
$pheno<-ifelse(b$PLASER==2 | b$FLASER==2 | > is.na(b$PLASER) & b$FLASER == 2,2,1) > > and if I have it the wrong way round, swap FLASER and PLASER in the > bit I have added. > > Jim > > On Sat, Jun 13, 2020 at 10:46 AM Ana Marija > wrote: > > > > Hell

[R] if else statement adjustemtn

2020-06-12 Thread Ana Marija
Hello I have a data frame like this: > head(b) FID IID FLASER PLASER 1: fam1000 G1000 1 1 2: fam1001 G1001 1 1 3: fam1003 G1003 1 2 4: fam1005 G1005 1 1 5: fam1009 G1009 1 1 6: fam1052 G1052 1 1 ... > table(b$PLASER,b$FLASER,

Re: [R] How to stack two Stack manhattan plots?

2020-06-11 Thread Ana Marija
some shown on the x-axis? On Thu, Jun 11, 2020 at 4:39 PM wrote: > > Your dots are too big! > > Add > > geom_points(... , size = 1 > > May need to play... 0.5 or 0.1? > > On 11 Jun 2020 22:26, Ana Marija wrote: > > I tried it, > ggplot( data = tmp.tidy) +geom

Re: [R] How to stack two Stack manhattan plots?

2020-06-11 Thread Ana Marija
I tried it, ggplot( data = tmp.tidy) +geom_point( aes(y = BP,x = CHR,color=key) ,position = "jitter" ) I got the attached On Thu, Jun 11, 2020 at 4:18 PM wrote: > > Try adding > position = "jitter" to the geom_point(... > > > > On 11 Jun 2020 21:41, Ana M

Re: [R] How to stack two Stack manhattan plots?

2020-06-11 Thread Ana Marija
Hello, I tried your code and this is what I got I really need two groups side by side shown per chromosome as it is here: https://imgur.com/a/pj40c on the image there are 4 groups I do have only two On Thu, Jun 11, 2020 at 11:52 AM wrote: > > On 2020-06-11 15:59, Ana Marija wrote: >

Re: [R] How to stack two Stack manhattan plots?

2020-06-11 Thread Ana Marija
me, and CHR would go from 1 to 22 On Thu, Jun 11, 2020 at 9:26 AM wrote: > > On 2020-06-11 14:54, Ana Marija wrote: > > Hello, > > > > I expected it to look like this: > > https://imgur.com/a/pj40c > > > > Ah - so all on the one plot? - so you don't want a

Re: [R] How to stack two Stack manhattan plots?

2020-06-11 Thread Ana Marija
m 0.952 0.475 0.529 0.255 0.295 ... Unfortunately qqman doesn't do this kind of overlay of two plots On Wed, Jun 10, 2020 at 11:24 PM John wrote: > > On Wed, 10 Jun 2020 15:36:11 -0500 > Ana Marija wrote: > > > Hello, > > > > I have a data frame like this: > &g

Re: [R] How to stack two Stack manhattan plots?

2020-06-10 Thread Ana Marija
mon wrote: > > Hi Ana, > The problem may be that the JPEG device doesn't handle transparency. > Perhaps PNG? > > Jim > > On Thu, Jun 11, 2020 at 6:48 AM Ana Marija > wrote: > > > > Hello, > > > > I have a data frame like this: > > > >

[R] Error in plot.window(...) : need finite 'ylim' values

2020-06-10 Thread Ana Marija
Hello, I do have a file like this: head M3.assoc.logistic.C CHR SNP BP P 1 1:785989:T:C 785989 0.4544 1 1:785989:T:C 785989 0.689 1 1:1130727:A:C 1130727 0.05068 1 1:1130727:A:C 1130727 0.07381 1 1:1156131:T:C 1156131 0.6008 1 1:1156131:T:C 1156131 0.8685 ... And I don't have any "NA" or "inf"

Re: [R] how to filter variables which appear in any row but do not include

2020-06-03 Thread Ana Marija
e at least one of "E102" or "E112" > > > unwanted <- c("E102", "E112") > no <- sapply(dat, function(x){ >grepl(paste(unwanted, collapse = "|"), x) > }) > no <- apply(no, 1, any) > dat[!no, ] > > > That's

Re: [R] how to filter variables which appear in any row but do not include

2020-06-03 Thread Ana Marija
t; > > > Bert Gunter > > "The trouble with having an open mind is that people keep coming along and > sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > > On Wed, Jun 3, 2020 at 7:56 AM Ana Marija >

[R] how to filter variables which appear in any row but do not include

2020-06-03 Thread Ana Marija
Hello. I am trying to filter only rows that have ANY of these variables: E109, E119, E149 so I did: controls=t %>% filter_all(any_vars(. %in% c("E109", "E119","E149"))) than I checked what I got: > s0 <- sapply(controls, function(x) grep('^E10', x, value = TRUE)) > d0=unlist(s0) >

Re: [R] is there is a way to extract lines in between 3 files that are in common based on one column?

2020-06-01 Thread Ana Marija
Hi Jim, not in this case, but thanks for asking! Ana On Mon, Jun 1, 2020 at 10:04 PM Jim Lemon wrote: > > So recombination sticks out its foot before us. Do you want to account > for gene linkage? > > JIm > > On Tue, Jun 2, 2020 at 11:55 AM Ana Marija > wrote: >

Re: [R] is there is a way to extract lines in between 3 files that are in common based on one column?

2020-06-01 Thread Ana Marija
r","Chr")) nn2<-merge(nn1,ret1,by=c("Marker","Chr")) > Marker3<-nn2$Marker > length(Marker3) [1] 3742962 > Marker4<-nn1$Marker > length(Marker4) [1] 373 On Mon, Jun 1, 2020 at 8:50 PM Ana Marija wrote: > > Hi David, > > that is a

Re: [R] is there is a way to extract lines in between 3 files that are in common based on one column?

2020-06-01 Thread Ana Marija
43494 9 How would I rewrite this code so that is merging by Chr and Marker column? It seems that a Marker can be under a few Chr. On Mon, Jun 1, 2020 at 8:41 PM David Winsemius wrote: > > > On 6/1/20 5:40 PM, Ana Marija wrote: > > Hi Jim, > > > > thank you so m

Re: [R] is there is a way to extract lines in between 3 files that are in common based on one column?

2020-06-01 Thread Ana Marija
ctors=FALSE) > > # merge the three data frames on "Marker" > nn1<-merge(neu1,nep1,by="Marker") > nn2<-merge(nn1,ret1,by="Marker") > # get the common "Marker" strings > Marker3<-nn2$Marker > # subset all three data frames on Marker3 &g

[R] is there is a way to extract lines in between 3 files that are in common based on one column?

2020-06-01 Thread Ana Marija
Hello, I have 3 data frames which have about 3.4 mill lines (but they don't have exactly the same number of lines)...they look like this: > neu1=neu[order(neu$Marker),] > head(neu1) ChrBP Marker MAF A1 A2 Direction pValueN 209565 1 10012 1:10012:G:T

Re: [R] how to load data frame where numeric will be numeric instead of character

2020-06-01 Thread Ana Marija
0.4156 G A + 0.484813 1641 2 10 10645 10:10645:A:C 0.216027 C A + 0.73597 1641 Can you please tell me what colClasses=colClassvec suppose to do? Thanks Ana On Mon, Jun 1, 2020 at 4:13 PM David Winsemius wrote: > > On 6/1/20 1:37 PM, Ana Marija wrote: &g

Re: [R] how to load data frame where numeric will be numeric instead of character

2020-06-01 Thread Ana Marija
ple keep coming along and > sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > > On Mon, Jun 1, 2020 at 1:38 PM Ana Marija > wrote: > >> Hello, >> >> I have a dataframe like this: >> >> Chr

[R] how to load data frame where numeric will be numeric instead of character

2020-06-01 Thread Ana Marija
Hello, I have a dataframe like this: ChrBP Marker MAF A1 A2 Direction pValueN 1 10 10625 10:10625:A:G 0.416562 G A - 0.558228 1594 2 10 10645 10:10645:A:C 0.215182 C A - 0.880622 1594 ... which I load with: NEU <-

Re: [R] How to only show two numbers on bar_plot with ggplot

2020-05-22 Thread Ana Marija
ous(breaks = unique(d)) ed where: > head(e) ESRD pheno 11 1 21 1 31 2 41 1 51 1 > sapply(e,class) ESRD pheno "integer" "factor" On Fri, May 22, 2020 at 1:52 PM Ana Marija wrote: > > Hello, > > I made t

[R] How to only show two numbers on bar_plot with ggplot

2020-05-22 Thread Ana Marija
Hello, I made the plot in attach via: ed<-ggplot(e) + geom_bar(aes(x = ESRD, fill = factor(pheno,labels=c("control","case"+scale_fill_manual(values=c("#56B4E9","#E7B800"))+labs(fill="pheno") ed How do I show only 1 and 2 on x axis? Thanks Ana

Re: [R] how to show percentage of individuals for two groups on histogram?

2020-05-22 Thread Ana Marija
d$HBAIC[aafd$pheno=="control"],breaks=0:15)) > > > par(mar=c(0,4,1,2)) > > > barpos=barplot(100*casehist,names.arg=names(casepct),col="orange", > > > space=0,ylab="Percentage",xaxt="n",ylim=c(0,25)) > > > text(mean(barpos)

Re: [R] how to show percentage of individuals for two groups on histogram?

2020-05-22 Thread Ana Marija
arpos=barplot(100*casehist,names.arg=names(casepct),col="orange", > > space=0,ylab="Percentage",xaxt="n",ylim=c(0,25)) > > text(mean(barpos),23, > > "Cases: n=848, nulls=26, median=7.3, mean=7.45, sd=1.96") > > box() > > p

Re: [R] how to show percentage of individuals for two groups on histogram?

2020-05-21 Thread Ana Marija
the result would basically look something like this on in attach or the overlay of those two plots On Thu, May 21, 2020 at 5:23 PM Ana Marija wrote: > > Hello, > > I have a data frame like this: > > head(a) > FID IID FLASER PLASER DIABDUR HBA1C ESRD pheno

[R] how to show percentage of individuals for two groups on histogram?

2020-05-21 Thread Ana Marija
Hello, I have a data frame like this: > head(a) FID IID FLASER PLASER DIABDUR HBA1C ESRD pheno 1 fam1000-03 G1000 1 1 38 10.21 control 2 fam1001-03 G1001 1 1 15 7.31 control 3 fam1003-03 G1003 1 2 17 7.01case 4

Re: [R] text annotation on Manhattn plot in qqman

2020-05-20 Thread Ana Marija
suming a is where it finds the remaining parameters. > > You may also need to play with the sep =, and collapse = parameters to > paste() to get the precise layout you want. > > Michael > > On 19/05/2020 17:21, Ana Marija wrote: > > Hi Michael, > > > >

Re: [R] text annotation on Manhattn plot in qqman

2020-05-19 Thread Ana Marija
Hi Michael, can you please send me code how that would be done? Thanks Ana On Tue, May 19, 2020 at 11:18 AM Michael Dewey wrote: > > Dear Ana > > Perhaps paste together SNP and GENE using paste() and then supply that > as the snp parameter. > > Michael > > On 19/05/2

[R] text annotation on Manhattn plot in qqman

2020-05-19 Thread Ana Marija
Hello, I am making manhattan plot with: library(qqman) manhattan(a, chr="CHR", bp="BP", snp="SNP", p="P",annotatePval = 0.0001) and I would like to annotate these two SNPs which are above the threshold so that they have GENE name beside them: > a[a$SNP=="rs4081570",] SNPP

Re: [R] how to extract strings in any column and in any row that start with

2020-05-15 Thread Ana Marija
value = TRUE) > > > Hope this helps, > > Rui Barradas > > Às 20:24 de 15/05/20, Ana Marija escreveu: > > Hello, > > > > this command was running for more than 2 hours > > grep("E10",tot,value=T) > > and no output > > > > a

Re: [R] how to extract strings in any column and in any row that start with

2020-05-15 Thread Ana Marija
ith E10. Thanks Ana On Fri, May 15, 2020 at 12:13 PM Jeff Newmiller wrote: > > Read about regular expressions... they are extremely useful. > > df1 <- tot %>% filter_all(any_vars(grepl( '^E10', .))) > > It is bad form not to put spaces around the <- assignment. > &

[R] how to extract strings in any column and in any row that start with

2020-05-15 Thread Ana Marija
Hello, I have a data frame: > dim(tot) [1] 502536 1093 How would I extract from it all strings that start with E10? I know how to extract all rows that contain with E10 df0<-tot %>% filter_all(any_vars(. %in% c('E10'))) > dim(df0) [1] 5105 1093 but I just need a vector of strings that start

[R] Error: Cannot use `+.gg()` with a single argument.

2020-05-07 Thread Ana Marija
Hello, I got this error: Error: Cannot use `+.gg()` with a single argument. Did you accidentally put + on a new line? After running this: data(murders) library(ggplot2) library(dplyr) library(ggplot2) ggplot(data=murders) #define the slope of the line r<-murders %>%

Re: [R] calculating t-score/t-stats as my zscores

2020-05-06 Thread Ana Marija
> > t.test(x, mu = beta0)$statistic > > > But in this case the estimator is the estimator for the mean value. > > Hope this helps, > > Rui Barradas > > Às 15:54 de 06/05/20, Ana Marija escreveu: > > Thanks Patrick, so in conclusion this is fine? > > z-sco

Re: [R] calculating t-score/t-stats as my zscores

2020-05-06 Thread Ana Marija
> normal distribution. So like a t-test with infinite df. > > > On Wed, May 6, 2020 at 10:41 AM Rui Barradas wrote: > > > > Hello, > > > > By z-scores do you mean function help('scale')? > > > > Hope this helps, > > > > Rui Bar

Re: [R] calculating t-score/t-stats as my zscores

2020-05-06 Thread Ana Marija
his helps, > > Rui Barradas > > Às 15:31 de 06/05/20, Ana Marija escreveu: > > Hi Rui, > > > > Thank you for getting back to me. Is there is a better way to > > calculate Z scores if I have p values, SE and Beta? > > > > Thanks > > Ana >

Re: [R] calculating t-score/t-stats as my zscores

2020-05-06 Thread Ana Marija
I guess I can have z-score=Beta/StdErr On Wed, May 6, 2020 at 9:37 AM Ana Marija wrote: > > thanks, can you please tell em what would be the way not to get the > absolute (always positive values) > > On Wed, May 6, 2020 at 9:33 AM Rui Barradas wrote: > > > > Hel

Re: [R] calculating t-score/t-stats as my zscores

2020-05-06 Thread Ana Marija
's all you need/want, then the > > answer is yes, you can. > > > > Hope this helps, > > > > Rui Barradas > > > > Às 14:28 de 06/05/20, Ana Marija escreveu: > >> Hello, > >> > >> Can I apply the

Re: [R] calculating t-score/t-stats as my zscores

2020-05-06 Thread Ana Marija
wer is yes, you can. > > Hope this helps, > > Rui Barradas > > Às 14:28 de 06/05/20, Ana Marija escreveu: > > Hello, > > > > Can I apply the quantile function qt() this way? > > qt(pvals/2, 406-34, lower.

[R] calculating t-score/t-stats as my zscores

2020-05-06 Thread Ana Marija
Hello, Can I apply the quantile function qt() this way? qt(pvals/2, 406-34, lower.tail = F) to get the T-scores? Thanks Ama __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

Re: [R] if else statement

2020-05-04 Thread Ana Marija
"Patrick (Malone Quantitative)" < > mal...@malonequantitative.com> wrote: > >"I tried this but I am not sure if this is correct:" > > > >Does it provide the expected result for all possible combinations of > >1/2/NA > >for both variables? > &g

[R] if else statement

2020-05-04 Thread Ana Marija
Hello, I have a data frame like this: > head(b) FID IID FLASER PLASER 1: fam1000 G1000 1 1 2: fam1001 G1001 1 1 3: fam1003 G1003 1 2 4: fam1005 G1005 1 1 5: fam1009 G1009 NA 2 6: fam1052 G1052 1 1 ... > unique(b$PLASER) [1] 1

  1   2   3   >