Displaying 20 results from an estimated 24 matches for "year2".
Did you mean:
year
2011 Dec 01
0
Error message: object 'A' not found
...","T","T","T","T","T","T"),nrow=18,ncol=1)
#CHANGE THIS!!! nrow=# of T and Cs or A-Ks (same #)
hab <- data.frame(hab)
#Year effects
year <-
matrix(c("Year1","Year1","Year1","Year1","Year2","Year2","Year2","Year2","Year2","Year1","Year1","Year1","Year1","Year2","Year2","Year2","Year2","Year2"),nrow=18,ncol=1)
#CHANGE THIS!!! to match number of A-Ks A...
2011 Jul 27
2
for loop help
...stations
lat <- dat1[,2] #latitude of station
lon <- dat1[,3] #longitude of station
year <- dat1[,4] # data year
month <- dat1[,5] #data month
ppt <- dat2 #precipiation data
#### station's missing zero years ###
ppt2 <- matrix(ppt[,which(stnid == '140365')],ncol=1)
year2 <- year[which(stnid == '140365')]
year2 <- year2[which(duplicated(year2) == FALSE)]
month2 <- month[which(stnid == '140365')]
ppt3 <- matrix(ppt[,which(stnid == '140405')],ncol=1)
year3 <- year[which(stnid == '140405')]
year3 <- year3[which(duplic...
2010 Aug 24
2
chisq.test on samples of different lengths
...rying to see whether there has been a significant difference in whether people experienced damages from wildlife in two different years. I therefore have two columns:
year 1:
yes
no
no
no
yes
yes
no
year 2:
no
yes
no
yes
I wanted to do a chisq.test, but if I enter it this way:
chisq.test(year1, year2)
I get the error saying the columns are two different lengths. So then I tried doing:
damages<-matrix(c(3,4, 2,2), ncol=2, dimnames=list(answer=c("yes", "no"), year=c("year1", year2)))
chisq.test(damages)
Does that make sense? Should I maybe be doing a different...
2008 Dec 10
2
how to merge panel data stored by variable?
Hi,
I have two datasets stored in tab-separated format in the following way
file1:
country year1 year2
Germany var1 var1
Hungary var1 var1
file2:
country year1 year2
Germany var2 var2
Hungary var2 var2
I can easily read in these files, but how can I merge them as a panel
dataset?
Thanks,
Viktor
[[alternative HTML v...
2012 Jun 24
2
Defining multiple variables in a loop
...(nrow(country1)), replace = T))
unemployment2 <- as.matrix(sample(country2$lagunemployment, size =
(nrow(country2)), replace = T))
unemployment3 <- as.matrix(sample(country3$lagunemployment, size =
(nrow(country3)), replace = T))
country.year1 <- as.matrix(cbind(country1$Country, country1$Year2))
country.year2 <- as.matrix(cbind(country2$Country, country2$Year2))
country.year3 <- as.matrix(cbind(country3$Country, country3$Year2))
country1.2 <- as.data.frame(cbind(country.year1, exp1, tax1, gdp1,
unemployment1))
country2.2 <- as.data.frame(cbind(country.year2, exp2, tax2, gdp2...
2010 Jan 30
2
drawing a line that shifts from solid to broken
I am graphing longitudinal data from three time points. I'd like to draw a
solid line from point 1 to point 2, and then a dashed line from point 2 to
point 3. It works if I do it in two steps:
> first.vector <- c(mean(year1$variable1), mean(year2$variable1))
> second.vector <- c(NA, mean(year2$variable1), mean(year3$variable1))
> plot(first.vector, type="b", xlim=c(1,3))
> lines(second.vector, type="b", lty=2)
It's clunky, though, and I have a bunch of these to do. Can I streamline it?
TIA.
Jamie
[[a...
2010 Nov 23
2
Help with grouped barplot
Given the data structure below, how can I create a bar plot for the values of disc for each area grouped by year?
bar <-structure(list(year = c(2003, 2003, 2003, 2003, 2003, 2003, 2003,
2007, 2007, 2007, 2007, 2007, 2007, 2007), area = structure(c(6L,
4L, 1L, 2L, 3L, 5L, 7L, 6L, 4L, 1L, 2L, 3L, 5L, 7L), .Label = c("AK",
"ID", "MT", "NW",
2013 Apr 18
1
Arranging two different types of ggplot2 plots with axes lined up
...n't been able to figure it out for two different types
of plots.
Below is my test case:
library(ggplot2)
library(gridExtra)
#generate test precipitation data
year<-c(2000,2001,2002,2003,2004)
precip<-c(46,100,80,74,20)
yp<-data.frame(year, precip)
#generate test fecal coliform data
year2<-c(2000,2000,2000,2000,2000,2000,2000,2000,2000,2000,
2001,2001,2001,2001,2001,2001,2001,2001,2001,2001,
2002,2002,2002,2002,2002,2002,2002,2002,2002,2002,
2003,2003,2003,2003,2003,2003,2003,2003,2003,2003,
2004,2004,2004,2004,2004,2004,2004,2004,2004,2004)
fc<-sample(1:1000, 50)
yfc<-data...
2006 Dec 14
1
legend/plotmath/substitute problem
...series:
year = 2001
g = 1.9
plot(1)
legend('top', legend=substitute(paste(year, ': ', gamma, '=', g), list(year=year, g=g)) )
My problem starts, when I want to put more than one series of data in
the plot and accordingly need one legend row per data series:
year1 = 2001
year2 = 2005
g1 = 1.9
g2 = 1.7
plot(1)
legend('top',
legend=c(
substitute(paste(year, ': ', gamma, '=', g), list(year=year1, g=g1)),
substitute(paste(year, ': ', gamma, '=', g), list(year=year2, g=g2))
)
)
This obviously does not produce the desired result....
2011 Oct 31
1
googleVis motionchart - slow with Date class
...untry.name", timevar="year", options=list(width=700, height=600))
plot(M)
This works fine and I can smoothly move back and forth between the scatter plots and the line plots.
## here I express the date as a Date class object - arbibrarily assigning each year to June 1st.
subData$year2 <- as.Date(ISOdate(subData$year, 6, 1 ))
M2 <- gvisMotionChart(subData, idvar="country.name", timevar="year2", options=list(width=700, height=600))
plot(M2)
Using Chrome, this plot is very slow to load and it appears when pressing play that the date field fills in each...
2013 Apr 03
1
linear model coefficients by year and industry, fitted values, residuals, panel data
...4,10)
industry1<-rep(20,50)
X<-rnorm(50)
Y<-rnorm(50)
Z<-rnorm(50)
data1<-data.frame(firm1,year1,industry1,X,Y,Z)
data1
colnames(data1)<-c("firm","year","industry","X","Y","Z")
firm2<-sort(rep(11:15,3),decreasing=F)
year2<-rep(2001:2003,5)
industry2<-rep(30,15)
X<-rnorm(15)
Y<-rnorm(15)
Z<-rnorm(15)
data2<-data.frame(firm2,year2,industry2,X,Y,Z)
data2
colnames(data2)<-c("firm","year","industry","X","Y","Z")
firm3<-sort(rep(16:20,4),...
2007 Jun 29
1
Assign name to a name
I would like to know how I can assign a name to a name. I have a
dataset that has different years in it. I am writing scripts using R
and I would like to give a month a generic name and then use the generic
name to do different analysis. The reason for the generic name would be
so that I only have to change one thing if I wanted to change the year.
For example.
Year1 = 1999
datayear <-
2012 May 24
1
svychisq using two frames
...is currently two data frames. I haven?t actually tried to run a
svychisq with the two frames yet as I am waiting on the data for the second
frame. I?m trying to plan out the logic ahead of time.
So, let?s say I have survey design frame Year1 with variables Wt1 and MyVar,
and survey design frame Year2 with variables Wt2 and MyVar ? remember the
variable name is the same in both frames.
My first inclination is that I would use a statement like:
svychisq(~MyVar+MyVar, Year1+Year2, statistic=?Chisq?)
However, it seems from reading the help files that I can only use the
?svychisq? function if I de...
2006 Aug 24
1
Using a 'for' loop : there should be a better way in R
...given all the warnings in the
Intro to R, etc, about using loops I wondered if
anyone could suggest something a bit simpler or more
efficent?
Example:
cat1 <- c( 1,1,6,1,1,5)
cat2 <- c( 1,2,3,4,5,6)
cat3 <- c( 5,4,6,7,8,8)
cat4 <- c( 1,2,1,2,1,2)
years <- c( 'year1', 'year2', 'year3', 'year3',
'year1', 'year1')
id <- c('a','a','b','c','c','a')
df1 <- data.frame(id,years,cat1,cat2, cat3, cat4)
nn <- levels(df1$id) # levels for outer loop
hh <- levels(df1$years) # level...
2010 Aug 20
1
Shifting of Principal amount while calculating Present Value
Dear R Helpers
I have following data -
cash_flow = c(7, 7, 107) # 107 = Principle 100 + interest of 7%
t = c(1,2,3)
and zero rate table as
rating year1 year2 year3
AAA 3.60 4.17 4.73
AA 3.65 4.22
4.78
A 3.72 4.32 4.93
BBB 4.10 4.67 5.25
For each of these ratings I need to calculate the Present Val...
2011 May 04
2
first occurrence of a value?
...<- data.frame(j1999=c(0,0,0,0,1,0), j2000=c(NA, 1, 1, 1, 0, 0), j2001=c(1, 0,
1, 0, 0, 0), year=c(2001, 2000, 2000, 2000, 1999, NA))
library(gsubfn)
x <- apply(df==1, 1, which)
giveYear <- function(df) { return( as.numeric(gsubfn("^[^0-9]+", "",
names(df)[1])) ) }
df$year2 <- sapply(x, giveYear)
Thanks in advance!
Cheers!!
Albert-Jan
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public
order, irrigation, roads, a fresh water system, and public health, what have...
2008 Oct 12
0
false convergence (8) after removal of the two-way interaction
...Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.513e-01 1.356e+00 -0.1116 0.91112
VAR2 -1.440e-02 6.429e-02 -0.2241 0.82271
VAR3 3.130e-04 1.413e-03 0.2215 0.82469
year1 -2.671e-01 5.719e-01 -0.4670 0.64050
year2 4.888e-01 4.792e-01 1.0199 0.30780
year3 -2.720e+00 1.169e+00 -2.3260 0.02002 *
year4 1.287e+00 4.211e-01 3.0569 0.00224 **
year5 -1.180e-01 4.195e-01 -0.2812 0.77855
year6 7.367e-01 4.249e-01 1.7340 0.08292 ....
2009 Apr 16
0
incorrect handling of NAs by na.action with lmList (package nlme) (PR#13658)
...:
lmgroup.data <- lmList (variable1 ~ treatmentB | year/treatmentA, data =
data, na.action = na.omit)
When I call the object, I see :
Call:
Model: variable1 ~ treatmentB | year/treatmentA
Data: data
Coefficients:
(Intercept) treatment B
year2/treatmentA0 44.08387 81.11284
year2/treatmentA1 66.61333 155.62163
year3/treatmentA0 60.55125 72.83121
year3/treatmentA1 63.62340 161.92080
Degrees of freedom: 188 total; 176 residual
Residual standard error:...
2013 Jun 07
4
matched samples, dataframe, panel data
...389,23456,2367,3892,5438,37824,
23,2897,3456,7690,6022,3678,9431,2890)
data1<-data.frame(firm1,year1,industry1,dummy1,dimension1)
data1
colnames(data1)<-c("firm","year","industry","dummy","dimension")
firm2<-sort(rep(11:15,3),decreasing=F)
year2<-rep(2001:2003,5)
industry2<-rep(30,15)
dummy2<-c(0,0,0,0,0,0,1,1,1,1,1,1,1,0,1)
dimension2<-c(12456,781,32489,2345,5754,8976,3245,2120,345,2341,5678,10900,12900,123,2345)
data2<-data.frame(firm2,year2,industry2,dummy2,dimension2)
data2
colnames(data2)<-c("firm","ye...
2010 Feb 24
1
Remove missing observations
...nnaire every year. The time span
covers 2 years.
Now I want to check if there is a significant change in the outcome over
the 2 years with a paired wilcox.test. The problem: Not every subject
completed both questionnaires. Thus, some subjects have the outcome only
for year1 and others only for year2.
If I try wilcox.test(Outcome~Year, paired=T), I receive an error "not the
same length".
Is there a fast method to remove those subjects with missing outcomes?
Thanks for any help.
Regards,
Denis Aydin
_____________________________________________
Denis Aydin, MSc
Swiss Tropical a...