a closer look to the help on predict.glm will reveal that the function
accepts a 'type' argument.
In you case 'type = response' will give you the results in probabilities
(that it seems to be what you are looking for).
There also is an example on use of the 'type' argument at the end of the
page.
?any
any(x==2)
Stefano
-Messaggio originale-
Da: r-help-boun...@r-project.org
[mailto:r-help-boun...@r-project.org]per conto di Dimitri Liakhovitski
Inviato: mercoledì 23 settembre 2009 17.38
A: R-Help List
Oggetto: [R] Function to check if a vector contains a given value?
Dear R'rs,
?unique
as an example
mat-matrix(c(1,2,3,1,1,2,1,2,3,4,7,5), ncol=3, byrow=T)
mat #rows 1 and 3 are identical
[,1] [,2] [,3]
[1,]123
[2,]112
[3,]123
[4,]475
unique(mat)
[,1] [,2] [,3]
[1,]123
[2,]112
[3,]4
try this
a-c(1, 6, 8, 9)
1*(1:10 %in% a)
[1] 1 0 0 0 0 1 0 1 1 0
Stefano
-Messaggio originale-
Da: r-help-boun...@r-project.org
[mailto:r-help-boun...@r-project.org]per conto di njhuang86
Inviato: Friday, June 12, 2009 4:45 PM
A: r-help@r-project.org
Oggetto: [R] Creating this
A short way (not necessairly the best way), using the coercion from
logical to numeric, could be:
(mydata-as.data.frame(matrix(sample(1:9, 12, repl=T), ncol=4)))
-1*(mydata =3) + (mydata =6)
For the second question start here:
help(Logic, package=base)
Stefano
-Messaggio
5 matches
Mail list logo