Displaying 3 results from an estimated 3 matches for "currentx2sum".
Did you mean:
currentx2sums
2008 Oct 30
1
Trying to "expand" some data - Newbie needs help
...nce I'll have "missing values"
(many combinations will have no record) I'll need a second "expansion
factor" for each "row". I've included my "work to date" below, but I'm
not very close to getting this right.
My first question is why CurrentX2Sums seems OK but NewTargetX2Sums has
no totals? I've added the total to the "ID". How do I do this
correctly?
I expected CurrentX2Sums (and NewTargetX2Sums) to print in column form.
How do I make it do so? t(CurrentX2Sums) doesn't seem to do the trick.
How do I avoid...
2008 Nov 05
1
How do I read a text (.csv) file to match a matrix/cross tab? (Object confusion??)
I'm having a problem reading data to set control totals for a dataframe.
I want to adjust a dataframe based on a 2-d table of values, which I get
by using :
> CurrentX1Sums <- as.matrix(xtabs(~tripid_nu+lineon, data=SurveyData))
> CurrentX2Sums <- apply(CurrentX1Sums, 1, sum)
I've created a .csv file with new (target) sums that looks like this:
tripid_nu Warner Center De Soto Pierce College Tampa
Reseda Balboa Woodley Sepulveda Van Nuys Woodman
Valley College Laurel Canyon...
2008 Oct 31
0
Why are these different?
...abels=TRUE, max.value.labels=Inf, to.data.frame=TRUE)
> NewTargetData <- read.table("C:/Data/R/NewTarget.csv", header=TRUE,
sep=",", na.strings="NA", dec=".")
>
> CurrentX1Sums <- as.matrix(xtabs(~tripid_nu+lineon, data=SurveyData))
> CurrentX2Sums <- apply(CurrentX1Sums, 1, sum)
> NewTargetX1Sums <- as.matrix(NewTargetData)
> NewTargetX2Sums <- apply(NewTargetX1Sums, 1, sum)
>
> CurrentX1Sums
lineon
tripid_nu Warner Center De Soto Pierce College Tampa Reseda Balboa
Woodley Sepulveda Van Nuys Woodman Vall...