search for: newtbl

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

2002 Mar 28
1
extracting non-NA columns from a data frame
I'm clustering using kmeans, and it doesn't accept NA. if NA occurs in a column of the data frame, it occurs in every column, including column 1. they say that a (good) programmer can write FORTRAN in any language, so I came up with this, where tbl is the data frame containing NA - > newtbl<-NULL > for (i in 1:length(tbl)){if (!is.na(tbl[1,i])){ + newtbl<-if (is.null(newtbl))data.frame(tbl[i]) else data.frame(newtbl,tbl[i])}} > however, from looking at the examples in the reference manual, I believe that the same effect could be achieved using a more concise, APL-like, syn...
2011 Nov 04
1
How to use 'prcomp' with CLUSPLOT?
...344,3274,9264,1862,0,0,141,0,0,0 PRV5,0,0,0,0,0,0,29044,0,0,0,0 PRV6,59,6924,825,3008,377,926,0,0,10156,0,5555 PRV7,11,24902,36040,47223,20086,0,0,749,415,0,0 library(cluster) fn = "big.csv"; tbl = read.table(fn, header=TRUE, sep=",", row.names=1); mat <- as.matrix(tbl); newtbl <- prop.table(mat,1)*100; num.clust <- 3; fitnw <- kmeans(newtbl, num.clust); clusplot(newtbl, fitnw$cluster, color=TRUE, shade=TRUE, lines=0, main= paste('Principal Components plot - Kmeans ', clust.level, ' Clusters') ) Error in princomp.default(x, scores = TRUE, cor =...
2012 Jul 06
4
convert a table
I have my data in a table table <- table(test2$Filename, test2$PREDICT) I need to convert this table so it keeps the same structure, but is a different format. The current output is count data by Filename and I want to get the max for each Filename. Columns are: Filename, 1, 2, 3, 4, 5, 6, 7 When I try to convert it to a data.frame it reverts to Var1(Filename), Var2(1:7), Freq. My end goal