similar to: help with the unique function

Displaying 20 results from an estimated 10000 matches similar to: "help with the unique function"

2005 May 20
5
getting the unique values and counts from a vector
Hi all, >From a vector, I want to get the unique values and the counts of these unique values in the vector. For example, x<-c(2 ,1 ,2, 1, 4 ,2 ,1, 4 ,1 ,1) xu<-unique(x) xn<-numeric(length(xu)) for (i in 1:length(xu)) {xn[i]<-length(which(x==xu[i]))} There must be a very much simpler method of doing this. Can somebody direct me to the functions that I must read in order to do
2008 May 07
6
help with updating to R2.7
Hi, From R 2.6, I would like to update to R2.7. I would like to have some tips on the recommended method of installing the latest versions of an entire list of packages in R2.7 - i.e. all the packages that I have presently installed in R2.6. I am hoping that there is an easier method than fetching the packages individually as I did, to begin with, for R2.6. Additionally, I would like to install
2008 Aug 13
3
Comination of two barcharts and one xyplot
Hi Rhelpers, I would like to have some help with a plot which is beyond my capabilities. This plot that I am seeking involves an overlay of two different barcharts and one xyplot. The code that I have used is the following : #save(df1,file="M:\\KBR\\df1.RData") load(file="M:\\KBR\\df1.RData") # df1$Year.ord created to obtain the right order i.e. 2015M < 2015K
2009 Aug 04
4
regex question
Hi, I am getting stuck over an apparently simple problem in the use of regular expressions : To collect together the first letters of the words from the Perl motto, ?There is more than one way to do it? in the following form ? TIMTOWTDI. I tried the following code : ? ##### A regex problem with the Perl motto astr<-"There is more than one way to do it" b1<-grep("\\<",
2007 Dec 30
2
Installing Rgraphviz package on a windows vista pc
Hi, I want to install Rgraphviz on a windows vista pc. The only source file that I found in the bioconductor homepage is a tar file. I can't install from this using the packages command in the R menu. I would like to get some tips on how I can do the installation. Can I just place the extracted Rgraph folder (from the source tar file) in the library folder of R2.6.1 along with the other
2011 Nov 09
1
installing java on ubuntu 11.10 installation
Dear list members, I am starting to get acquainted with linux on a ubuntu 11.10 installation on an external hard disk. I have just installed R and all the packages available in the r-cran-* list. Now, I would like to get on with the installation of packages like Deducer and Acinonyx. The former requires JGR which in turn requires Java. I have tried to follow the instructions available at the
2011 May 21
1
dealing with sweave.sty and pgfSweave
Hi, I would appreciate some help with a very basic problem in using pgfSweave. That is, dealing with the sweave.sty file. After some googling, I did the following : (1) copied the sweave.sty file to my trial folder and (2) added the line?? \usepackage{Sweave}?? to the Rnw file. Are there more elegant ways of dealing with this issue? I have read something about letting Miktex know about the
2008 Nov 13
1
replacing Na's in a vector with the preceding integer element
Hi, I have a vector where an integer is followed by a randomly varying number of NA elements. I want to replace the NA's with the preceding integer. Let me explain with a simple?example : avec<- c(1,NA,NA,5,NA,3,4,NA,NA,NA,NA,9,NA,0,NA,NA) I want to get the following vector from a : bvec<-c(1,1,1,5,5,3,4,4,4,4,4,9,9,0,0,0) How can I do this with R? Will appreciate all the help that I
2009 Jul 31
1
help in using gsub and ?
Hi all, I would like to strip the R prompt from a series of code lines and copy the resulting text into a R script. For example, consider the following : ##### str1<-" > library(MASS) > data(Cars93) > attach(Cars93) > imosaic(data.frame(AirBags,Cylinders,Origin))" str2<-gsub('>','',str1) ###### This gives, as expected .? > str2 [1] "\n
2012 Aug 25
2
sourcecode for the balloonplot function from the gplots package
Hi, I want to take a look at the sourcecode for balloonplot. I would appreciate it if I could get help on overcoming the following problem : > methods(balloonplot) [1] balloonplot.default* balloonplot.table* ? ? ?Non-visible functions are asterisked > balloonplot.default Error: object 'balloonplot.default' not found > How do I access the non-visible functions? Thanks, Ravi??
2008 Sep 23
1
Summing up columns with NA elements in a data frame
Hi all, When I try to sum a few columns in a data frame (which has NA?s randomly distributed as elements), I am not able to get the summing operation to ignore the NA?s. Let me explain with the following code : ################################? a<-structure(list(a1 = c(NA, 2, 3, NA, 5, 6, NA, 8, 9, NA), a2 = c(NA, + 4, 5, 5, NA, 7, 8, 8, NA, 10), a3 = c(2, NA, 6, 8, NA, 12, 14, + NA, 18, 20)),
2010 Jun 23
1
Generation of binomial numbers using a loop
Dea'R' helpers I have following data - prob = c(0.1, 0.2, 0.3, 0.4, 0.5) frequency = c(100, 75, 45, 30, 25) no_trials = c(10, 8, 6, 4, 2) freq1 = rbinom(frequency[1], no_trials[1], prob[1]) freq2 = rbinom(frequency[2], no_trials[2], prob[2]) freq3 = rbinom(frequency[3], no_trials[3], prob[3]) freq4 = rbinom(frequency[4], no_trials[4], prob[4]) freq5 = rbinom(frequency[5],
2011 May 08
2
help with mysql and R: partitioning by quintile
Hi, I have a mysql table with fields userid,track,frequency e.g u1,1,10 u1,2,100 u1,3,110 u1,4,200 u1,5,120 u1,6,130 . u2,1,23 . . where "frequency" is the number of times a music track is played by a "userid" I need to turn my 'frequency' table into a rating table (it's for a recommender system). So, for each user, I need to categorise the frequency of tracks
2010 Jul 21
1
Get distribution of positive/negative examples for each cluster
Dear R experts, I have a labeled data set. Each data is assigned a binary label 0 or 1. Assume that I use some clustering algorithm to group the data by clusters (using some features of the data). Now I want to know how many data are labeled as 0/1 in each cluster. For example, assume that I have 9 labeled data grouped into three clusters. The ids of the clusters are 1, 2, and 3. The dataset is
2009 Aug 17
1
regex problems with the escape character
Hi R-users and R-experts, I am having a hard time in figuring out how to tackle regex questions where the "backslash" character is an integral part of the string. Let me explain how I?came across?this problem : I wanted to clearly see all the components in the windows environmental path variable. This is a long string.?For easy readability, I wanted to split up this string so that each
2009 Sep 11
1
help in matching two column vectors
Dear list, I have a long list of two vectors with some matching elements. I would like to line them up in two columns and have an NA in those positions of the second vector where a match is absent. With a simple example, I will explain my problem. (a<-1:6) (b<-c(5,2)) (m1<-match(a,b)) (ab<-cbind(a,m1)) m2<-numeric(length(m1)) for (i in 1:length(m1))
2008 Apr 09
2
fuzzy merge
Hi, I would like to merge two data frames. It is just that I want the merging to be done with some kind of a fuzzy criterion. Let me explain. My first data frame looks like this : ID1 time1 dt 1 2008-01-02 13:11 10 2 2008-01-02 14:20 20 3
2013 Nov 19
3
[LLVMdev] Quad-Core ARMv7 Build Slave Seeks Noble Purpose
On 17 November 2013 05:15, Mikael Lyngvig <mikael at lyngvig.org> wrote: > I finally got it to work - and my ODROID-XU is now a passive member of the > LLVM builder society for the next week or so, until it has proven itself > (it monitors changes to the SVN repository and builds in my end without > bothering anyone at LLVM.org about its findings). I did write up a
2010 Sep 22
3
Extracting bins and frequencies from frequency table
Dear R users, I would like to great a frequency table from raw data and then access the classes/bins and their respective frequencies separately. Here the code to create the frequency tables: x1 <- c(1,5,1,1,2,2,3,4,5,3,2,3,6,4,3,8) t1 <- table(x1) print(t1[1]) Its easy to plot this, but how do I actually access the frequencies alone and the bins alone? Basically I am looking to get:
2009 Aug 08
1
frequency of numbers in a list
Hi, I have two vectors, mag and i, and I want to generate a of vector where each element is the frequency of mag which is greater than i. i produced the following code. However I get the following error: mag<-rnorm(40,5,3) i<-seq(floor(min(mag)),max(mag), 0.5) freq<-sum(mag>=i) Warning message: In mag >= i : longer object length is not a multiple of shorter object length