Thanks again!
I would like to construct 14 new 'year' dummy variables. I have 14 years:
1992:2006 with 231 observations pr. year. The year dummies should assign a 1
if the observation is within the specific year and 0 otherwise. So for
example: 1992dummyvariable=1 if year=0 and so on.
P
--
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
Hello again,
Try changing the lines where you create 'EMUmix3' and 'EMUmix4' by the
following.
EMUmix3 - Reduce(``, lapply(countries, function(x,y){country1 %in% euro2
!country2 %in% euro2}))
# euro2 are also the EMUcountries, BUT in 2001 Greece became a EMU member.
So in the interval
Hello,
phillip03 wrote
Thank you Rui
Can you help me with my ifelse problem - I would like to add a list to my
data.frame where avgflow in those rows where ONLY my country pair both are
in euro
First of all, try to use better (much, much better) code writing.
What are you trying to do
Hi RUI
Thank you so much ! I know I have a lot to learn : / sorry for that.
If I want to make a new data.frame where it is the NONEURO avgflows. how do
I do that ?
Ph
--
View this message in context:
http://r.789695.n4.nabble.com/Assignment-problems-tp4578672p4581164.html
Sent from the R
If I want to make a new data.frame where it is the NONEURO avgflows. how
do I do that ?
Exactly like above, but without the negation (the exclamation mark).
You must also start to use the help system, for instance:
?!
Rui Barradas
--
View this message in context:
Thank you!
Do you know why ifelse() sometimes returns NULL ?
--
View this message in context:
http://r.789695.n4.nabble.com/Assignment-problems-tp4578672p4581491.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org
On 23-04-2012, at 21:37, phillip03 wrote:
Thank you!
Do you know why ifelse() sometimes returns NULL ?
Please provide a reproducible example for this phenomenon.
Berend
__
R-help@r-project.org mailing list
Hi
EMU1993-(for (i in 1:nrow(data)){
+ ifelse(year==1992,sum(avgflowEMU),0)
+ })
EMU1993
NULL
--
View this message in context:
http://r.789695.n4.nabble.com/Assignment-problems-tp4578672p4581590.html
Sent from the R help mailing list archive at Nabble.com.
That's not the ifelse() that's the for loop returning NULL
(everything's a function!). If you put the assignment inside you'll
get expected behavior.
x - (for(i in 1:5) i) # Strange
for(i in 1:5) x- i # Normal (but notice you only get the last value
because previous ones are overwritten)
Michael
On Apr 23, 2012, at 5:21 PM, R. Michael Weylandt wrote:
That's not the ifelse() that's the for loop returning NULL
(everything's a function!). If you put the assignment inside you'll
get expected behavior.
x - (for(i in 1:5) i) # Strange
for(i in 1:5) x- i # Normal (but notice you only get
The text below is a part of, some work I have to do, which is due in 2 days
and I am strung up with a lot of other stuff, so I was hoping someone would
take 5 mins and help me ??
Here is a part of my data.frame:
year country1 country2 contig comlangpop1gdp1
pop2
Look at ?ifelse, a combination of logical subscripting and mean(), or even
better ?ave -- I can't say too much more; there's a no homework policy on this
list and I recognize that first solution as mine already... (I should have
noted that the first time)
Michael
On Apr 22, 2012, at 2:54 PM,
Hello,
phillip03 wrote
The text below is a part of, some work I have to do, which is due in 2
days and I am strung up with a lot of other stuff, so I was hoping someone
would take 5 mins and help me ??
Here is a part of my data.frame:
year country1 country2 contig comlang
I have tried ifelse:
trade-data.frame(avgflow,EMU,stringsAsFactors=FALSE)
avgflowEURO-rep(0,nrow(trade))
trade1-(for (i in
1:nrow(trade)){ifelse(EMU[i]==1,avgflowEURO[i]-avgflow[i],NA)})
--
View this message in context:
Does mean(avgflow[EMU]) sum the avgflows for all countrypairs where
EMU[i]==TRUE and take the mean ? Practical question: is mean(avgflow[EMU]) =
mean(avgflow[EMU==TRUE]) ???
--
View this message in context:
http://r.789695.n4.nabble.com/Assignment-problems-tp4578672p4578761.html
Sent from the R
phillip03 wrote
Does mean(avgflow[EMU]) sum the avgflows for all countrypairs where
EMU[i]==TRUE and take the mean ? Practical question: is mean(avgflow[EMU])
= mean(avgflow[EMU==TRUE]) ???
Answer: yes.
Rui Barradas
--
View this message in context:
Thank you Rui
Can you help me with my ifelse problem - I would like to add a list to my
data.frame where avgflow in those rows where ONLY my country pair both are
in euro
--
View this message in context:
http://r.789695.n4.nabble.com/Assignment-problems-tp4578672p4578806.html
Sent from the R
18 matches
Mail list logo