Merik,
You did get an answer to the question, and it's even included in the material
below.
What doesn't work for you in Ista's suggestion?
id<- c(1,1,1,1,1,2,2,2,3,3,3)
month <- c(1, 1, 2, 3, 6, 2, 3, 6, 1, 3, 5)
value <- c(10, 12, 11, 14, 16, 12, 10, 8, 14, 11, 15)
dat.tmp <- data.frame(id
Since I didn't get an answer to this question, I'm rephrasing my question in
simpler terms:
I have a dataframe and I want to split it based on the levels of one of its
columns, and apply a function to each section of the data. Output of the
function may be drawing a plot, returning a value, what
On Tue, Jul 26, 2011 at 10:12 AM, Ista Zahn
wrote:
> OK, easy enough:
>
> dat.tmp <- data.frame(id, month, value)
> my.plot <- function(dat) {print(dat[, c("id", "value")])}
> by(dat.tmp, id, my.plot)
Excellent. The output of that last line is:
* id value
1 110
2 112
3 111
4 1
Hi Merik,
Please keep the mailing list copied.
On Tue, Jul 26, 2011 at 6:44 AM, Merik Nanish wrote:
> You can convert my data into a dataframe simply by dat <- data.frame(id,
> month, value). That doesn't help though.
Can you be more specific? What is the problem you are having?
And no, that's
Hi Merik,
by() works most easily with data.frames. Is this what you are after?
my.plot <- function(dat) { print(dat$value);
print(dat$month[dat$id==dat$value]) }
by(dat.tmp, id, my.plot)
Best,
Ista
On Mon, Jul 25, 2011 at 9:19 PM, Merik Nanish wrote:
> Hello,
>
> Here are three vectors to give
Hello,
Here are three vectors to give context to my question below:
*id<- c(1,1,1,1,1,2,2,2,3,3,3))
month <- c(1, 1, 2, 3, 6, 2, 3, 6, 1, 3, 5)
value <- c(10, 12, 11, 14, 16, 12, 10, 8, 14, 11, 15)*
and I want to plot "value" over "month" separately for each "id". Before I
can do that, I nee
6 matches
Mail list logo