Displaying 3 results from an estimated 3 matches for "currentx1sum".
Did you mean:
currentx1sums
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 Wood...
2008 Oct 31
0
Why are these different?
...matrix(xtabs(~tripid_nu+lineon, data=SurveyData)) and reading a .csv
table of target values. I can't even get them to list out as similar
data items.
My idea is to do something like this, but I don't know how to do it in R
SurveyData$X1 = NewTargetX1Sums[Trip,Stop] /
CurrentX1Sums[Trip,Stop]
That is; a different value for X1 for each
[Trip,Stop] combination
Should I be using as.matrix?
Why doesn't NewTargetX1Sums "name the rows" when CurrentX1Sums does?
Why does NewTargetX1Sums have dots in the label spaces?
Do I have the ri...
2008 Oct 30
1
Trying to "expand" some data - Newbie needs help
...s) 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" when I read "De Soto" into
NewTargetData?
How do I put this back into my dataframe?
SurveyData$NewX1 = NewTargetX1Sums/CurrentX1Sums but how do I
specify (tripid_nu lineon) the indices?
If I'm only a ?LookHere or ??LookThere away I'd appreciate being pointed
in the right direction.
Thanks in advance.
All the gory details:
> sessionInfo() # List loaded packages
R version...