Thank you all for your help. It's working now. I chose to use the sqldf
method and fn$ in the gsubfn package. I used fn$ so that I could put
variables into the sqldf statement. This helped me to increase or decrease
the window size in the Gene dataframe if I wanted to include values in the
aver
doggysaywhat writes:
> My apologies for the context problem. I'll explain.
>
> df1 is a matrix of genes labeled g1 through g5 with start positions in the
> START column and end positions in the END column.
>
> df2 is a matrix of chromatin modification values at positions along the DNA.
>
> I
On Fri, Jan 13, 2012 at 6:34 AM, doggysaywhat wrote:
> Hello all.
>
> I have two data frames.
> Group Start End
> G1 200 700
> G2 500 1000
> G3 2000 3000
> G4 4000
Hello,
I believe this works
res <- NULL
for(i in 1:nrow(df1)){
brk <- df1[i, 2:3]
ix <- df2$Pos >= brk$Start & df2$Pos <= brk$End
res <- rbind(res, apply(df2[ix, -1], 2, mean))
}
res
It's not very pretty but since the ranges can overlap, I'm not finding
anything prettier
I don't think my advice to use cut is in fact working, because the ranges
are overlapping. Following is a reproducible example... as the posting
guide indicates, you should provide self-contained examples like this in
future questions posted to the list.
# begin example
tc <- textConnection(
Hello Rui, I didn't see your post before I posted. I'll try that out
tomorrow. Many thanks.
--
View this message in context:
http://r.789695.n4.nabble.com/Averaging-within-a-range-of-values-tp4291958p4294137.html
Sent from the R help mailing list archive at Nabble.com.
My apologies for the context problem. I'll explain.
df1 is a matrix of genes labeled g1 through g5 with start positions in the
START column and end positions in the END column.
df2 is a matrix of chromatin modification values at positions along the DNA.
I want to average chromatin modificat
Lack of context and examples is making this hard to follow, but my stabs at
answers are
1) cut cannot guarantee that all numeric inputs will have unique factor results
if you use two columns to define the ranges. That is, the ranges could overlap
(multiple answers), or there could be gaps (no a
Hello Jeff, thank you for the reply. I tried the cut function and I had two
questions. How do I have the cut function take the first position in the
start column in df1 as the first cut point and the first position in column
2 as the second cut point. The break variable seems to want a single
ve
Regarding your last question, read ?cut
---
Jeff NewmillerThe . . Go Live...
DCN:Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead:
Hello all.
I have two data frames.
Group Start End
G1 200 700
G2 500 1000
G3 20003000
G4 40006000
G5 70008000
and
Pos
11 matches
Mail list logo