search for: dnn

Displaying 20 results from an estimated 39 matches for "dnn".

Did you mean: dan
2005 Feb 21
1
is.matrix(), as.matrix, & as(,"matrix")
Under help(matrix) it is written: 'is.matrix' tests if its argument is a (strict) matrix. It is generic: you can write methods to handle specific classes of objects, see InternalMethods. Further down, under "Details", the meaning of "strict" is explained more explicitly: 'is.matrix' returns 'TRUE' if 'x' is a matrix
2008 Jul 02
1
exporting ftable
...vars = "Survived") ftable(Titanic, row.vars = 2:1, col.vars = "Survived") ## Start with a data frame. x <- ftable(mtcars[c("cyl", "vs", "am", "gear")]) x ftable(x, row.vars = c(2, 4)) ## Start with expressions, use table()'s "dnn" to change labels ftable(mtcars$cyl, mtcars$vs, mtcars$am, mtcars$gear, row.vars = c(2, 4), dnn = c("Cylinders", "V/S", "Transmission", "Gears")) When I tried to export the object x i have thsis result: "V1" "V2" "V3&quo...
2009 Feb 18
1
Training nnet in two ways, trying to understand the performance difference - with (i hope!) commented, minimal, self-contained, reproducible code
...1 > ( nn1.pr.test <- predict(nn1, spam.test, type='class') ) [1] "spam" "spam" "spam" "spam" "nonspam" "spam" "spam" [etc...] # error matrix >(nn1.test.tab<-table(spam.test$type, nn1.pr.test, dnn=c('Actual', 'Predicted'))) Predicted Actual nonspam spam nonspam 778 43 spam 63 496 # Calucate overall error percentage ~ 7.68% >(nn1.test.perf <- 100 * (nn1.test.tab[2] + nn1.test.tab[3]) / sum(nn1.test.tab)) [1] 7.68116 ## Example...
2012 Sep 24
5
Memory usage in R grows considerably while calculating word frequencies
...sep="\n")) # Extract words pattern <- "(\\b[A-Za-z]+\\b)" match <- gregexpr(pattern,words.txt) words.txt <- regmatches(words.txt,match) # Create a vector from the list of words words.txt<-unlist(words.txt) # Calculate word frequencies words.txt<-table(words.txt,dnn="words") # Sort by frequency, not alphabetically words.txt<-sort(words.txt,decreasing=TRUE) # Put into some readable form, "Name of word" and "Number of times it occurs" words.txt<-paste(names(words.txt),words.txt,sep="\t") # Results to a file cat(&q...
2002 Dec 11
3
Excluding levels in table and xtabs
I'm trying to form contingincy tables among a set of character variables which were read from a .csv file and have missing represented as "". I want to exclude the missing levels from the table. > levels(CPIC) [1] "" "N" "Y" > levels(Manix) [1] "" "N" "Y" > xtabs(~CPIC + Manix, exclude=c("",NA))
2013 Jul 04
2
Modificar una función de un paquete
Estimados miembros de la lista. Estoy trabajando con la función mosaic del paquete vcd. Cómo puedo hacer para ver el contenido fe la función y modificar algunos de sus argumentos? Muchas gracias, Manuel -- *Manuel Spínola, Ph.D.* Instituto Internacional en Conservación y Manejo de Vida Silvestre Universidad Nacional Apartado 1350-3000 Heredia COSTA RICA mspinola@una.ac.cr
2013 Jul 04
1
Modificar una función de un paquete
...c2 <- function(zero_size = 0.5, zero_split = FALSE, > ## zero_shade = TRUE, zero_gp = gpar(col = 0)) > ## function(residuals, observed, expected = NULL, spacing, gp, > split_vertical, prefix = "") { > ## dn <- dimnames(observed) > ## dnn <- names(dn) > ## dx <- dim(observed) > ## dl <- length(dx) > > ## ## split workhorse > ## zerostack <- character(0) > ## split <- function(x, i, name, row, col, zero) { > ## cotab <- co_table(x, 1) > ## margin <- sapply(c...
2013 Jul 04
0
Modificar una función de un paquete
...ormant ## ## struc_mosaic2 <- function(zero_size = 0.5, zero_split = FALSE, ## zero_shade = TRUE, zero_gp = gpar(col = 0)) ## function(residuals, observed, expected = NULL, spacing, gp, split_vertical, prefix = "") { ## dn <- dimnames(observed) ## dnn <- names(dn) ## dx <- dim(observed) ## dl <- length(dx) ## ## split workhorse ## zerostack <- character(0) ## split <- function(x, i, name, row, col, zero) { ## cotab <- co_table(x, 1) ## margin <- sapply(cotab, sum) ## v <- split_verti...
2013 Jul 06
0
Modificar una función de un paquete
..._size = 0.5, zero_split = FALSE, > > ## zero_shade = TRUE, zero_gp = gpar(col = 0)) > > ## function(residuals, observed, expected = NULL, spacing, gp, > > split_vertical, prefix = "") { > > ## dn <- dimnames(observed) > > ## dnn <- names(dn) > > ## dx <- dim(observed) > > ## dl <- length(dx) > > > > ## ## split workhorse > > ## zerostack <- character(0) > > ## split <- function(x, i, name, row, col, zero) { > > ## cotab <- co_table(x, 1) > &...
2008 Oct 01
1
Help with CrossTable
...e CrossTable function from library(gmodels). x=unique(data[,c("L1","L1_Revenues","RIC")]) L1_Classification=CrossTable(x$L1,x$L1_Revenues,exclude = c("NA","","0%","0"),prop.r=FALSE,prop.c=FALSE,prop.t=FALSE,prop.chisq=FA LSE,dnn=c("L1_Classification","Revenue")) What I would like to do is to get the out put in excel. Also I do not want the output displayed on the console. Is there some way of doing this? sessionInfo() R version 2.7.1 (2008-06-23) i386-pc-mingw32 locale: LC_COLLATE=Engli...
2009 Dec 09
1
Exporting Contingency Tables with xtable
Dear R-philes: I am having an issue with exporting contingency tables with xtable(). I set up a contingency and convert it to a matrix for passing to xtable() as shown below. v.cont.table <- table(v_lda$class, grps, dnn=c("predicted", "observed")) v.cont.mat <- as.matrix(v.cont.table) Both produce output as follows: observed predicted uh uh~ uh 201 30 uh~ 6 10 However, when I construct the latex table with xtable(v.cont.mat), I get a good table without the headin...
2010 Sep 09
1
Emacs function argument hints
...ents for that function appear at the bottom of the window. E.g. if you type "table( " before you finish typing you can see at the bottom of the window: table(..., exclude = if (useNA == "no") c(NA, NaN), useNA = c("no", "ifany", "always"), dnn = list.names(...), deparse.level = 1) I think this feature may be called "function argument hints" but I'm not sure and searching the archive with that term has not produced anything useful. Is this feature available in Emacs or any other windows text editor for R? Thanks ve...
2010 Aug 18
4
Using objectname in function
Is there anyway I can convert a vectors objectname to a string to be used in fx: Monkey<-c(0,0,0,1,1,1) Wax<-c(1,0,1,0,1,0) f<-function(x,y){ table(x,y) } f(Monkey,Wax) so that the printout is not y x 0 1 0 1 2 1 2 1 but Wax Monkey 0 1 0 1 2 1 2 1 -- View this message in context:
2010 Jul 29
1
Displaying Counts of Unused Factors in Contingency Tables with table()
...r data in them: local.labels("ah", "ah", "ah~") local.preds("ah", "ah", "ah") If I use the table function as shown below, I get an error because the number of levels do not match up. v.cont.table <- table(local.labels, local.preds, dnn=c("observed", "predicted")); Is there any way to get zero counts into the contingency table, or would I have to use a flat table? Any help with sample code, or a pointer to a previous post, would be much appreciated. Regards, Na'im
2008 May 06
4
General Plotting Question
f <- (structure(list(X = structure(96:97, .Label = c("119DAmm", "119DN", "119DNN", "119DO", "119DOC", "119Flow", "119Nit", "119ON", "119OPhos", "119OrgP", "119Phos", "119TKN", "119TOC", "148DAmm", "148DN", "148DNN", "148DO", "148D...
2012 Dec 03
2
How to rename the columns of as.table
...I J -0.005105154 0.016379572 0.058881676 Now i don't want the names A,B,C,D ..... etc, but i want to rename it with : Lag1, Lag2, Lag3 ... I know that it can be done with fix(autocorrelazione1), but i need somthing in the initial formula. I tried with dnn=list.names("lag1" , .... , "lag10") but the names remain the same. Some help? Thanks guys -- View this message in context: http://r.789695.n4.nabble.com/How-to-rename-the-columns-of-as-table-tp4651806.html Sent from the R help mailing list archive at Nabble.com.
2005 Feb 17
5
Again: Variable names in functions
Hello, still I have difficulties with variable names in functions. I know the famous example form help for deparse/substitute but I will give a simpler one to explain my problem. I know from Reid Huntsinger (Tue, 8 Feb 2005 12:39:32 -0500) that: "Semantically, R is pass-by-value, so you don't really have the names, just the values. In implementation, though, R *does* pass names, in part
2007 Jun 08
1
How to make a table of a desired dimension
...#code valid only when 'a', 'b', and 'c' have the proper dimension p<-mat.or.vec(48,4) p[,1]<-8:55 p[,2]<-c(matrix(a)[1:48]) p[,3]<-c(matrix(b)[1:48]) p[,4]<-c(matrix(c)[1:48]) matplot(p) I read the help about 'table' but I couldn't figure out if dnn, deparse.level, or the other arguments could serve my purpose. Thanks for your help Rub?n
2011 Aug 16
1
how to sort the levels of a table
...t(input[,-c(1,ncol(input))])) ## observations of the observers refValues<-factor(input[,ncol(input)]) ## data.frame that relates observations of observers and reference RefObs<-data.frame(refValues, obsValues) mtx<-table( RefObs$obsValues, RefObs$refValues, dnn=c("observers", "reference"), useNA=c("always") ) And now the problem: I need to sort the levels/classes of the table. Both axes shall be ordered 1st according to how often 1 occurs in the string that codes the observation and 2nd treating the ob...
2006 Jul 15
1
Some problems with latex(ftable)
...f the table with several cbind- and rbind-ed rows and columns of label information. The example in ?ftable has two row factors and two column factors. Continuing with the example in ?ftable, enter tmp <- ftable(mtcars$cyl, mtcars$vs, mtcars$am, mtcars$gear, row.vars = c(2, 4), dnn = c("Cylinders", "V/S", "Transmission", "Gears")) print.default(tmp) To get what you are looking for, you will need to intercept write.ftable with, for example, trace(write.ftable, exit=recover) then do 3 tmp.latex <- latex(t(x)) print.default(tmp.la...