[R] Transform a list of multiple to a data.frame which I want

2015-02-01 Thread Yao He
Dear all: I have a list like that,which is a standard str_locate_all() function (stringr package) output: $K start end $GSEGTCSCSSK start end [1,] 6 6 [2,] 8 8 $GFSTTCPAHVDDLTPEQVLDGDVNELMDVVLHHVPEAK start end [1,] 6 6 $LVECIGQELIFLLPNK start end [1,] 4

[R] Is that an efficient way to find the overlapped , upstream and downstream rangess for a bunch of rangess

2016-04-05 Thread Yao He
dx) find_overlapped_gene(idx, all_genes_gr))) However, for 100 genes, it use nearly ~8s by system.time().That means if I had 5 genes, nearly one hour for just find overlapped gene. I am just wondering any algorithm or strategy to do that efficiently, perhaps 5 genes in ~1

[R] how to read different files into different objects in one time?

2012-12-19 Thread Yao He
ad it in one time? I think the core problem is that I can't create different objects' name in the use of loop or sapply() ,but there may be a better way to do what I want. Thanks a lot Yao He Yao He -- — Master candidate in 2rd year Department

[R] how to aggregate T-test result in an elegant way?

2013-01-06 Thread Yao He
eport raw result. Can anybody give me some pieces of advice? Yao He — Master candidate in 2rd year Department of Animal genetics & breeding Room 436,College of Animial Science&Technology, China Agriculture University,Beijing,100193 E-mail: yao.h.1

Re: [R] how to aggregate T-test result in an elegant way?

2013-01-06 Thread Yao He
print(O2[2]) print(t.test(a[O2[1],,i],a[O2[2],,i],na.rm=T)) } I don't think it is an elegant way and I am inexperience to report raw result. Could you give me more help? Yao He 2013/1/7 arun : > Hi, > You didn't provide any example data. So, I am not sure whether this helps. &

Re: [R] how to aggregate T-test result in an elegant way?

2013-01-07 Thread Yao He
, is that generate a high-dimension array a good way ? Thank you! Yao He 2013/1/7 arun : > HI, > I tried to create an example dataset (as you didn't provide the data). > set.seed(25) > a<-array(sample(1:50,60,replace=TRUE),dim=c(2,10,3)) > dimnames(a)[[1]]<-c("1

Re: [R] how to aggregate T-test result in an elegant way?

2013-01-07 Thread Yao He
",row.names(res1))]) > res1 > # meanp.value > #EMW.13% 14.35000 0.09355374 > #EMW.21% 17.68000 0.09355374 > #EW.17.5.13% 42.87000 0.17464018 > #EW.17.5.21% 45.97333 0.17464018 > #EW.INCU.13% 49.61333 0.43689727 > #EW.INCU.21% 47.08333 0.43689727 > > A.K. &g

Re: [R] how to aggregate T-test result in an elegant way?

2013-01-07 Thread Yao He
4018 -9.265622 3.058955 > #EW.INCU 49.61333 47.08333 0.43689727 -7.119234 12.179234 > A.K. > > > > > - Original Message - > From: Yao He > To: arun > Cc: R help > Sent: Monday, January 7, 2013 10:57 AM > Subject: Re: [R] how to aggregate T-test result in an e

Re: [R] ggplot not showing all the years on the x-axis

2013-01-08 Thread Yao He
Hi,this is a question about how to set the scale,try this add a scale_x_discrete() like that: plot <- tmpplot + geom_line()+scale_x_continuous(breaks=ii) Yao He 2013/1/8 Francesco Sarracino : > Dear R helpers, > > I am currently having hard time fixing the values on the x-ax

Re: [R] how to count "A", "C", "T", "G" in each row in a big data.frame?

2013-01-09 Thread Yao He
", "GG"), X2476 = c("AA", > "TT", "TT", "CC", "TT", "CC", "CC", "TT", "CC", "GG", "GG", > "GG", "GG", "GT", "TC"

Re: [R] how to count "A", "C", "T", "G" in each row in a big data.frame?

2013-01-09 Thread Yao He
Thanks a lot. The problem is that I don't know how to handle the output list as I want calculate the frequency of A or G or T or C by row. Yao He 2013/1/10 Jessica Streicher : > Sorry, you wanted rows, i wrote for columns > > #rows would be: > test2<-apply(test[,-c(1:4)],1,f

Re: [R] how to count "A", "C", "T", "G" in each row in a big data.frame?

2013-01-09 Thread Yao He
Original Message- >> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On >> Behalf >> Of Yao He >> Sent: Wednesday, January 09, 2013 4:04 PM >> To: jim holtman >> Cc: R help >> Subject: Re: [R] how to count "A", "C&

Re: [R] how to count "A", "C", "T", "G" in each row in a big data.frame?

2013-01-09 Thread Yao He
3.167 > head(res1,3) > > # AA AG CC CT GA GG GT TC TG TT > # 1 29 10 0 0 13 1 0 0 0 0 > # 10 0 4 0 0 6 43 0 0 0 0 > # 100 19 15 0 0 15 4 0 0 0 0 > head(res2,3) > # id AA AG CC CT GA GG GT TC TG TT > #1 1 29 10 0 0 13 1 0 0 0 0

Re: [R] how to generate a matrix by an my data.frame

2013-01-10 Thread Yao He
0 > 2611 2611 0 > ", header = TRUE) > > mat1 <- matrix(nrow = 53, ncol = 53) # initialize with NA's > mat1[upper.tri(mat1, diag = TRUE)] <- dat$value > > mat2 <- matrix(0, nrow = 53, ncol = 53) # initialize with zeros > mat2[upper.tri(mat2, diag = TRUE)] &

[R] how to read a df like that and transform it?

2013-01-23 Thread Yao He
49401 292 38954 49396 4939749398 49399 291 39003 49392 library (plyr) and library (reshape2) and other good packages are OK for me. Thanks a lot! Yao He — Master candidate in 2rd year Department of Animal genetics & breeding

Re: [R] How to transpose it in a fast way?

2013-03-13 Thread Yao He
of pairs of A, C, G, T, then two pairs e.g., 'AA' 'CT' >> could be encoded as a single byte >> >> alf <- c("A", "C", "G", "T") >> nms <- outer(alf, alf, paste0) >> map <- outer(setNames(as.r

[R] Do association study based on mixed linear model

2013-03-19 Thread Yao He
xed effect estimates As asreml-R is not free ,is there any packages for my study? I heard nlme or lme4 but I'm not sure whether they could incorporate covariates and what about their computational efficiency? Thanks for you recommendation Yao He — Master candid

[R] how to do association study based on mixed linear model

2013-03-19 Thread Yao He
xed effect estimates As asreml-R is not free ,is there any packages for my study? I heard nlme or lme4 but I'm not sure whether they could incorporate covariates and what about their computational efficiency? Thanks for you recommendation Yao He — Master candid

[R] How to select a subset data to do a barplot in ggplot2

2012-12-13 Thread Yao He
es(x=factor(FID),y=..count..,fill=STATUS)) But how could I exclude "nosperm" or other levels just in the use of ggplot2 without generating another dataframe Thanks a lot Yao He — Master candidate in 2rd year Department of Animal genetics & breeding Room 4

[R] how to handle NA values in aggregate()

2012-12-15 Thread Yao He
,1],mean) But I couldn't set the agrument na.rm=T in the mean() function,so the results are all NAs Please tell me how to handle NA values in the use of aggregate() Thanks a lot Yao He — Master candidate in 2rd year Department of Animal genetics & breeding Room 436,C