Displaying 2 results from an estimated 2 matches for "targetx1sum".
Did you mean:
targetx1sums
2008 Oct 22
0
newbie Syntax questions: Re-Calculating expansion factors
...and sum of X1 in
the dataframe for that tripid_nu.
I will soon receive corrected lineon values and new X1 (and hence trip)
targets. I'm trying to figure out how to program the subsequent
recalculations in R. I'm thinking that {schematically} it may look
something like this:
TargetX1Sums <- ##{read an external file of totals for tripid_nu/lineon,
How should I format the data?? Dataframe or matrix??}##
TargetX2Sums <- xtabs(~tripid_nu, data= TargetX1Sums)
InitX1Sums <- xtabs(~tripid_nu+lineon, data=SurveyData)
SurveyData$NewX1= ##{some formulation of TargetX1Su...
2008 Nov 05
1
How do I read a text (.csv) file to match a matrix/cross tab? (Object confusion??)
...1 1 1
2 2 2 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:...