« Return to Thread: Simple one

Re: Simple one

by Ben Bolker :: Rate this Message:

Reply to Author | View in Thread


JoK LoQ wrote:
Just a quickly beginner's question.

I wanna find the mean only from the values from a column related to specific values from another one. Like, theres a 'region' column, i want the mean of the value on 'profit' column only from "south" sells from 'region' column
mean(x[x$region=="south",]$profit)

or  (untested)

mean(subset(x,region=="south",select=profit))

 « Return to Thread: Simple one