Displaying 3 results from an estimated 3 matches for "newtargetx2sum".
Did you mean:
newtargetx2sums
2008 Oct 30
1
Trying to "expand" some data - Newbie needs help
...sing 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 getting e.g. "De.Soto&q...
2008 Nov 05
1
How do I read a text (.csv) file to match a matrix/cross tab? (Object confusion??)
...1 1 5
...{More}...
I'm trying to read/process it like this:
> NewTargetData <- read.table("C:/Data/R/NewTarget.csv", header=TRUE,
sep=",", na.strings="NA", dec=".")
> NewTargetX1Sums <- as.matrix(NewTargetData)
> NewTargetX2Sums <- apply(NewTargetX1Sums, 1, sum)
The structures of CurrentX1Sums and NewTargetX1Sums are different:
> str(CurrentX1Sums)
xtabs [1:55, 1:13] 1 0 1 0 1 0 0 0 0 1 ...
- attr(*, "dimnames")=List of 2
..$ tripid_nu: chr [1:55] "9011880" "9011890" &...
2008 Oct 31
0
Why are these different?
...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 Valley College Laurel Canyon North
Hollywood
9011880 1 0 2 1 0 2
1...