Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #set up some data
- mycodat <- read.csv(stdin(),header=TRUE)
- country,obsv
- Spain,4
- Spain,5
- Portugal,3
- Portugal,7
- Venezuala,8
- Zambia,2
- Zambia,4
- Zambia,3
- regdat <- data.frame(country=unique(mycodat$country)) # the thing you're trying to get
- # the country means into
- # Now generate the summary and put it in the data
- regdat$meanobsv <- with(mycodat,tapply(obsv,country,mean))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement