[R] (sans objet)

Ben Bolker bolker at ufl.edu
Mon Aug 10 18:33:43 CEST 2009



something like

table(cut(M$GWP_Max,breaks=c(0,1000,3000,10000)))



Inchallah Yarab wrote:
> 
> i have written this in R, 
> 
> 
>> data1 <- read.csv2("c:/Total1.csv",sep=",")
>> data2 <- read.csv2("c:/GWPMax1.csv",sep=",")
>> M <- merge(data1, data2, by.x = "Policy.Number", by.y = "Policy.Number")
>> nrow(data1)
> [1] 20
>> nrow(M)
> [1] 12
>> NbOfPolicyWithoutGWPMax <- nrow(data1)-nrow(M)
>> NbOfPolicyWithoutGWPMax
> [1] 8
>> M$GWP_Max <- as.numeric(as.character(M$GWP_Max))
>> m1 <- M[(M[,25]> 0 & M[,25]<1000) ,]
>> nrow(m1)
> [1] 5
>> m2 <- K[(K[,25]>1000 & K[,25]<3000),]
>> nrow(m2)
> [1] 3
>> m3 <- K[(K[,25]>3000),]
>> nrow(m3)
> [1] 4
>> 
> 
> and i want to have in output a table like this 
> GWP_Max NumberOfPolicy 
> withoutGWP 8 
> 0-1000 5 
> 1000-3000 3 
>>3000 4 
> 
> Someone have an idea? 
> 
> thank you a lot !!
> 
> 
>       
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 

-- 
View this message in context: http://www.nabble.com/%28sans-objet%29-tp24901533p24903003.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list