Re: [R] Assignment problems

2012-04-25 Thread phillip03
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 -- Vie

Re: [R] Assignment problems

2012-04-24 Thread phillip03
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 none

Re: [R] Assignment problems

2012-04-23 Thread phillip03
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. ___

Re: [R] Assignment problems

2012-04-23 Thread phillip03
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 m

Re: [R] Assignment problems

2012-04-23 Thread phillip03
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 hel

Re: [R] OLS Estimating

2012-04-23 Thread phillip03
So how would I use the lm() to estimate b_0 and b_1 for example My Y_i and Y_j are data observations how does the lm() use my data.frame ? -- View this message in context: http://r.789695.n4.nabble.com/OLS-Estimating-tp4580055p4581048.html Sent from the R help mailing list archive at Nabble.

[R] OLS Estimating

2012-04-23 Thread phillip03
Hi I am looking for a efficient way to estimate all parameters in your data.frame set using a specific function: for example ln(T)=b_0 + b_1*ln(Y_i*Y_j) + b_2*ln()+ ... + etc. Thanks, Ph -- View this message in context: http://r.789695.n4.nabble.com/OLS-Estimating-tp4580055p4580055.html Sent

Re: [R] Assignment problems

2012-04-22 Thread phillip03
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 hel

Re: [R] Assignment problems

2012-04-22 Thread phillip03
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

Re: [R] Assignment problems

2012-04-22 Thread phillip03
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: http://r.789695.n4.nabble.com/Assignment-problems-tp4578672p4

[R] Assignment problems

2012-04-22 Thread phillip03
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

Re: [R] How to add specific column to data.set?

2012-04-18 Thread phillip03
So the lapply function checks every country pair row for row (in my country1 and country2 column) and send back a true if both countries are EU? How do I get a 1 instead of true and 2 instead of false? You have been a BIG help. I have a WHOLE assignment to get done, so maybe I'll post some more

Re: [R] How to add specific column to data.set?

2012-04-17 Thread phillip03
Wow it works :) Thank you SO much!! I am very new at R and was thinking if you would explain what these to codes do: countries<-data.frame(country1,country2,stringsAsFactors=FALSE) # I know this i a vector with both my county lists but what does stringsAsFacors= FALSE do ?. What if I wantede a

Re: [R] How to add specific column to data.set?

2012-04-17 Thread phillip03
This is the first and last part of my data frame. There is 3465 (not 7000) observations so the "1 or 0" column has to be 3465 rows long aswell year country1 country2 contig comlangpop1gdp1 pop2 gdp2 rtadist avgflow 11992 AUS AUT 0

Re: [R] How to add specific column to data.set?

2012-04-17 Thread phillip03
Hi Michael Sorry it is a data frame where to of the columns are 22 countries arranged in random. I now want to add and ekstra column that is 1 if the country par for the specific row is both european countries and 0 if not. Regards -- View this message in context: http://r.789695.n4.nabble.com/

[R] How to add specific column to data.set?

2012-04-17 Thread phillip03
Hi I have a data.set with 7 lists, with over 7000 observations in each list. to of the lists contain country names. like: aus dnk fra aus usa aut itlusa . . . etc. My dilemma is that I want to add an extra column/list to my data.set. If the countries are both european it should be assi