similar to: unique columns in a matrix and number of each

Displaying 20 results from an estimated 6000 matches similar to: "unique columns in a matrix and number of each"

2008 Nov 24
8
matching matrix columns to a vector
I need help with (hopefully) just one more thing. I have been fussing with this for quite some time and have decided just to give up and ask! I want to match a column in a matrix to a vector. I found a "which" command that I thought would be helpful as it does the following: > g=c(1,5,3,2,7) > which(g==5) [1] 2 As the above gave which placement in the g vector corresponded to
2008 Nov 18
2
random value changes in a vector
To clear up a question regarding my earlier posting regarding random changes in a vector: Say you have a vector (1, -1, -1, 1, 1, -1). I want each value in the vector to have a probability that it will change signs when this vector is regenerated. For example, probability = 50%. When the vector is regenerated, the first value in the vector (1) has a 50% chance of switching to -1. If I
2009 Mar 24
3
Summarizing each row into a frequency table
I have a matrix containing -1, 0, 1, however certain rows will not have all 3 numbers. I have written some codes to compute the frequency table of how many -1s, 0s, 1s per row, but it is very ugly and not efficient if there are more than 3 numbers. Please suggest. m <- rbind(sample(0:1, replace=T, 10), sample(-1:1, replace=T, 10)) m.table <- t(apply(m, 1, function(x) c(sum(x==-1, na.rm=T),
2010 Jul 28
3
how to code it??
Hi I have say a large vector of 3500 digits. Initially the digits are 0s and 1s. I need to check for a rule to change some of the 0s to -1s in this vector. But once I change a 0 to -1 then I need to start applying the rule to change the next 0 only after I see the next 1 in the vector. Say for example x = (0,0,0,0,0,0,0,1,0,0,1,1,0,0,1,0,0,0,1) I need to traverse from the 9th element to the last
2011 Jul 05
2
sample function with different proportions
Hi there, I guess this is an easy one, but still:  I would like to randomly sample 0s and 1s but in a way that I end up having for example 70% of 1s and the rest of 0s and not 50:50 as this function does: sample(c(0,1), 100, replace = TRUE) Any recommendations? Many thanks! Ana [[alternative HTML version deleted]]
2011 Jan 06
2
algorithm help
Hi, I am seeking help on designing an algorithm to identify the locations of stretches of 1s in a vector of 0s and 1s. Below is an simple example: > dat<-as.data.frame(cbind(a=c(F,F,T,T,T,T,F,F,T,T,F,T,T,T,T,F,F,F,F,T) ,b=c(4,12,13,16,18,20,28,30,34,46,47,49,61,73,77,84,87,90,95,97))) > dat a b 1 0 4 2 0 12 3 1 13 4 1 16 5 1 18 6 1 20 7 0 28 8 0 30 9 1 34 10 1 46 11 0
2010 Nov 10
2
Asterisk 1.8 -- queue not recognizing that agent is busy
Hi All, I've got a realtime queue in place (strategy is "wrandom"), and have added a member dynamically via "queue add member ". My agent shows in the queue, but when he gets the call is not recognized as "In Use". Here is the output from "queue show" prior to the call: *CLI> queue show QUEUE_3 has 0 calls (max unlimited) in 'wrandom'
2009 Jun 24
2
Boxplots: side-by-side
Dear R-sians.. I am trying to plot boxplots with side-by-side option.. I tried some of the posted suggestions and could not make it work due to unequal sizes of categories... e.g. weekly measured water depth values are categorized into 5 levels based on their values such measurement is again categorized into dichotomous levels - based on the result of a test I would like generate boxplot of
2010 Jan 11
2
help needed to find zero areas in a vector
Dear Helpers:   I spend more than half a day to solve this problem in R:   Let x be a vector of a string of 0s and 1s, such as x<-c(0,0,1,1,0,0,0,0,1,1,0,0,0,0). It can be a very long vector. How to sub vectors of 0s? In the above example, I would like get the vectors (0,0), (0,0,0,0), (0,0,0,0). I can use which(x==0) to get the index of the 0 elements, but I don't know how to get the
2008 Apr 09
1
If statements for vectors
Dear Sirs, I am using both the Bioconductor adds on (Affy, AffyPLM,...) and the 'standard' R-package. I am trying to select a list of genes which all have expression values below a certain threshold. I have done this by creating a vector which has 0s where the expression is greater than the threshold and 1s where it is less than or equal to it. Multiplying this vector by the expression
2018 Apr 21
2
Removing columns from big.matrix which have only one value
I have a very large binary matrix, stored as a big.matrix to conserve memory (it is over 2 gb otherwise - 5 million columns and 100 rows). r <- 100 c <- 10000 m4 <- matrix(sample(0:1,r*c, replace=TRUE),r,c) m4 <- cbind(m4, 1) m4 <- as.big.matrix(m4) I need to remove every column which has only one unique value (in this case, only 0s or only 1s). Because of the number of columns, I
2009 Apr 08
1
Sweave problem, with multicolumn tables from R to LaTeX
Hi there, I have been using the example provided bellow for a while, and It was working without any problem. Nevertheless, just since 2-3 days is not working, probably because I did update.packages(). I have tried to re-install the older versions of the packages Hmisc() and xtable(), but still does not work. Can you run this example, and tell me if you got the same problems? I use
2006 Apr 24
6
Two asterisk process in one hardware.
Hello. Has anybody knows how run two asterisk process in one hardware? (each one with its own configuration?) Thanks Juan Salas.
2007 Oct 05
8
Linux editor for R+LaTeX, but not Emacs
Using Tinn-R (in windows) is possible to run latex and R from the same editor, which was great. Now, I am using Ubuntu-linux, which has been better than WinXP. Currently, I am using Emacs (and then install ESS) for running LaTeX and R from a same editor-program (like i was doing with Tinn-R in windows). Nevertheless, and even though i have been using Emacs for almost 2 years, it is not as
2009 Jul 15
2
Spaces in a name
I am reading regressors from an excel file (I have no control over the file) and some of the element names have spaces: i.e. "Small Bank Aquired" but I have found that lm(SourceData ~ . - "Small Bank Aquired", mcReg) doesn't work (mcReg = modelCurrentRegressors) As they are toggles I have ran them through factor() to be treated propertly as 0 or 1 but due to the fact I
2005 Jul 02
1
Sipura SPA2000 behind NAT
Hi, I've one Sipura SPA2000 at home behind a linuxbox with two network adapters (eth0 for WAN and eth1 for LAN) doing NAT/DHCP: ___________ HOME _______________ ____OFFICE ____ SPA2000 <---> Linux Box <--> Asterisk Box 192.168.0.253 192.168.0.1 eth1 200.93.xxx.a 200.93.xxx.b eth0 My problem is when I try to call to any trunk or extention
2010 May 09
4
Fwd: R apply() help -urgent
---------- Forwarded message ---------- From: Dr. Venkatesh <drvenki at liv.ac.uk> Date: Sun, May 9, 2010 at 4:55 AM Subject: R apply() help -urgent To: r-help at r-project.org I have a file with 4873 rows of 1s or 0s and has 26 alphabets (A-Z) as columns. the 27th column also has 1s and 0s but stands for a different variable (pLoss). columns 1 and 2 are not significant and hence lets
2009 Oct 13
1
Time Dependent Cox Model
I am having trouble formatting some survival data to use in a time dependent cox model. My time dep. variable is habitat and I have it recorded for every day (with some NAs). I think it is working properly except for calculating the death.time. This column should be 1s or 0s and as I have it only produces 0s. Any help will be greatly appreciated.
2009 Jan 07
4
Another newbie question
Problem: I have a data frame with 1s and 0s denoting presence/absence of species (columns) for particular plot measurements (rows). What I want to do is make a new column whose entries for each row is a list of the column names in which a species is present (ie. for row one its entry might read: "sp1","sp2", etc.). I've tried various functions etc. but can't seem to
2009 Feb 26
4
Singularity in a regression?
R friends, In a matrix of 1s and 0s, I'm getting a singularity error. Any helpful ideas? lm(formula = activity ~ metaF + metaCl + metaBr + metaI + metaMe + paraF + paraCl + paraBr + paraI + paraMe) Residuals: Min 1Q Median 3Q Max -4.573e-01 -7.884e-02 3.469e-17 6.616e-02 2.427e-01 Coefficients: (1 not defined because of singularities)