xtabs() produces a matrix with dimnames (actually a S3 class "table"
object, whchi is an array of integers -- in this case, a 2-d arrray, i.e. a
matrix). Spend some time with a basic R tutorial to learn how to index
matrices/arrays. This should be part of your basic R skill set.
Cheers,
Bert
Be
Thank you Bert and Jim,
Jim, FYI , I have an error message generated as
Error in allstates : object 'allstates' not found
Bert, it is working. However, If I want to chose to include only mos years
example, 2003,2004,2007 and continue the analysis as before. Where should
I define the years to g
... and similar to Jim's suggestion but perhaps slightly simpler (or not!):
> cross <- xtabs( Y ~ stat + year, data = tdat)
> keep <- apply(cross, 1, all)
> keep <- names(keep)[keep]
> cross[keep,]
year
stat 2003 2004 2006 2007 2009 2010
AL 38 21 20 12 16 15
NY 50 51 57
Hi Val,
This may help:
tdat$allpresent<-FALSE
for(state in allstates)
tdat$allpresent[tdat$stat == state]<-
all(allyears %in% tdat$year[tdat$stat==state])
tdat2<-tdat[tdat$allpresent,]
xtabs(Y~stat+year,tdat2)
table(tdat2$stat,tdat2$year)
Jim
On Fri, May 18, 2018 at 10:48 AM, Val wrote:
> H
Hi All,
I have a sample of data set show as below.
tdat <- read.table(textConnection("stat year Y
AL 200325
AL 200313
AL 200421
AL 200620
AL 200712
AL 200916
AL 201015
FL 200663
FL 200714
FL 200725
FL 200964
FL 200947
FL 201048
NY 200350
NY
Hi
I am looking into obtaining trusted timestamps in R for data files. I am
considering using OriginStamp and their API which you can find at
https://doc.originstamp.org/#!/default/getHashInformation . They have an R
client code which is available here http://originstamp.org/dev but I have no
> On May 17, 2018, at 6:40 AM, Miluji Sb wrote:
>
> Dear William and Ben,
>
> Thank you for your replies and elegant solutions. I am having trouble with
> the fact that two of the previous locations do not appear in current
> locations (that is no one moved to OKC and Dallas from other cities),
Dear William and Ben,
Thank you for your replies and elegant solutions. I am having trouble with
the fact that two of the previous locations do not appear in current
locations (that is no one moved to OKC and Dallas from other cities), so
these two cities are not being included in the output.
I h
8 matches
Mail list logo