[R] cbind or ?
L.A.
romsa at millect.com
Fri Jan 15 20:06:47 CET 2010
Hey Guys,
It sure seems I get stuck on things that should be easy.
Heres my question:
PARCELS<-by(ResImp[ , "ACCOUNTNO"], ResImp["Property"], length)
> PARCELS
Property: UNSOLD
[1] 9053
-------------------------------------------------------------------------------------------
Property: SOLD
[1] 578
-------------------------------------------------------------------------------------------
Property: SubSale
[1] 52
QuanImpUnsold<-with(ResImp, by(Appraisal, Property,
FUN=function(x)quantile(x,
probs = c(1,25,50,75,90)/100)))
> QuanImpUnsold
Property: UNSOLD
1% 25% 50% 75% 90%
18106.4 92817.0 131794.0 185742.0 262365.0
-------------------------------------------------------------------------------------------
Property: SOLD
1% 25% 50% 75% 90%
35335.65 105034.25 138967.00 181971.25 254946.00
-------------------------------------------------------------------------------------------
Property: SubSale
1% 25% 50% 75% 90%
37255.72 117055.50 149314.00 196207.00 259288.60
tb<-cbind(PARCELS, QuanImpUnsold)
tb
PARCELS QuanImpUnsold
UNSOLD 9053 Numeric,5
SOLD 578 Numeric,5
SubSale 52 Numeric,5
This is what I want
> tb
Property: UNSOLD
Parcels 1% 25% 50% 75% 90%
9053 18106.4 92817.0 131794.0 185742.0 262365.0
-------------------------------------------------------------------------------------------
Property: SOLD
Parcels 1% 25% 50% 75% 90%
578 35335.65 105034.25 138967.00 181971.25 254946.00
-------------------------------------------------------------------------------------------
Property: SubSale
Parcels 1% 25% 50% 75% 90%
52 37255.72 117055.50 149314.00 196207.00 259288.60
Any suggestions?
Thanks,
L.A.
Don't know if this helps:
> str(PARCELS)
'by' int [1:3(1d)] 9053 578 52
- attr(*, "dimnames")=List of 1
..$ Property: chr [1:3] "UNSOLD" "SOLD" "SubSale"
- attr(*, "call")= language by.default(data = ResImp[, "ACCOUNTNO"],
INDICES = ResImp["Property"], FUN = length)
> str(QuanImpUnsold)
List of 3
$ UNSOLD : Named num [1:5] 18106 92817 131794 185742 262365
..- attr(*, "names")= chr [1:5] "1%" "25%" "50%" "75%" ...
$ SOLD : Named num [1:5] 35336 105034 138967 181971 254946
..- attr(*, "names")= chr [1:5] "1%" "25%" "50%" "75%" ...
$ SubSale: Named num [1:5] 37256 117056 149314 196207 259289
..- attr(*, "names")= chr [1:5] "1%" "25%" "50%" "75%" ...
- attr(*, "dim")= int 3
- attr(*, "dimnames")=List of 1
..$ Property: chr [1:3] "UNSOLD" "SOLD" "SubSale"
- attr(*, "call")= language by.default(data = Appraisal, INDICES =
Property, FUN = function(x) quantile(x, probs = c(1, 25, 50, 75,
90)/100))
- attr(*, "class")= chr "by"
--
View this message in context: http://n4.nabble.com/cbind-or-tp1015187p1015187.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list