search for: newtargetx1sum

Displaying 3 results from an estimated 3 matches for "newtargetx1sum".

Did you mean: newtargetx1sums
2008 Nov 05
1
How do I read a text (.csv) file to match a matrix/cross tab? (Object confusion??)
...1 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:...
2008 Oct 31
0
Why are these different?
...g the existing totals using as.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 la...
2008 Oct 30
1
Trying to "expand" some data - Newbie needs help
...d 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" 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 packa...