[R] Assignment problems
phillip03
phillipbrigham at hotmail.com
Tue Apr 24 22:07:19 CEST 2012
Thank you David!
That was EXACTLY what I needed. I have one last question:
I want to create a mix of EMU and nonEMU country pairs. I have tried with:
EMUmix1<-Reduce(`&`, lapply(countries,function(x,y){country1 %in% euro &
country2 %in% noneuro}))
# Where euro are the EMU countries and noneuro are (obviously) the nonEMU
countries
EMUmix2<-Reduce(`&`, lapply(countries,function(x,y) {country1 %in% noneuro
& country2 %in% euro}))
EMUmix3<-Reduce(`&`, lapply(countries,function(x,y) {country1 %in% euro2 &
country2 %in% noneuro}))
# euro2 are also the EMUcountries, BUT in 2001 Greece became a EMU member.
So in the interval (1999:2000)
all euro countries are reprsentated and from 2001- all euro+GREECE=euro2
are representated.
EMUmix4<-Reduce(`&`, lapply(countries,function(x,y) {country1 %in% noneuro
& country2 %in% euro2}))
EMUmixnonGRC<-ifelse(year %in% (1999:2000),EMUmix1|EMUmix2,0)
EMUmixGRC<-ifelse(year >= 2001,EMUmix3|EMUmix4,0)
EMUmix<- EMUmixnonGRC|EMUmixGRC
data2<- cbind(data1,EMUmixnonGRC,EMUmixGRC)
# This dosent QUITE work. I get 0 in (1992:1998) and from 2001- there is
neither a problem, BUT in (1999:2000) there is a problem:
every country pair where Greece (nonEMU at the time) in either country1 list
or country 2 is paired with an EMU country I recieve a 0, where I of course
seek a 1, hence i am looking for EMUmix
Anyone ?
ps. thanks to everyone for helping me so far: michael, David, Berend, Rui
etc. I know I have a LOT to learn
--
View this message in context: http://r.789695.n4.nabble.com/Assignment-problems-tp4578672p4584675.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list