Re: [R] unique scale color ggplot2

2020-07-08 Thread Catalin Roibu
Dear all, Thank you for your email and help. I solved the problem! All the best! Catalin On Tue, 7 Jul 2020 at 20:43, Rasmus Liland wrote: > On 2020-07-07 19:23 +0200, Thierry Onkelinx wrote: > > > > Don't use the cut() function. > > Ah, I see it now. Changing > > fill = cut(cor,

Re: [R] unique scale color ggplot2

2020-07-07 Thread Rasmus Liland
On 2020-07-07 19:23 +0200, Thierry Onkelinx wrote: > > Don't use the cut() function. Ah, I see it now. Changing fill = cut(cor, zCuts) to fill = cor did it, probably. Perhaps Catalin agrees. __ R-help@r-project.org mailing list

Re: [R] unique scale color ggplot2

2020-07-07 Thread Thierry Onkelinx via R-help
Don't use the cut() function. ir. Thierry Onkelinx Statisticus / Statistician Vlaamse Overheid / Government of Flanders INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE AND FOREST Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance thierry.onkel...@inbo.be

Re: [R] unique scale color ggplot2

2020-07-07 Thread Rasmus Liland
On 2020-07-07 12:44 +0200, Thierry Onkelinx via R-help wrote: > Op di 7 jul. 2020 om 12:02 schreef Catalin Roibu : > > > > Dear R users, > > > > I want to create a plot for multiple > > sites and to keep the same color > > range scale (the correlation values > > range from -0.5 to 0.7 for all

Re: [R] unique scale color ggplot2

2020-07-07 Thread Thierry Onkelinx via R-help
Dear Catalin, use scale_fill_gradient() and set fixed limits ggplot(df1, aes(x=as.factor(spei), y=as.factor(month), fill = cut(cor, zCuts))) + geom_tile() + scale_fill_gradient(limits = c(-0.7, 0.7)) Best regards, ir. Thierry Onkelinx Statisticus / Statistician Vlaamse Overheid /

[R] unique scale color ggplot2

2020-07-07 Thread Catalin Roibu
Dear R users, I want to create a plot for multiple sites and to keep the same color range scale (the correlation values range from -0.5 to 0.7 for all data, but I have sites with different min and max). I used this code: cols<-c("#0288D1", "#039BE5", "#03A9F4","#29B6F6", "#4FC3F7", "#FFCDD2",

Re: [R] unique() duplicate() not what i am looking for

2018-11-19 Thread Fox, John
milton, Ontario, Canada Web: socialsciences.mcmaster.ca/jfox/ > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Knut > Krueger > Sent: Monday, November 19, 2018 9:42 AM > To: r-help@r-project.org >> r-help mailing list > Subject: [R]

Re: [R] unique() duplicate() not what i am looking for

2018-11-19 Thread Rui Barradas
Hello, Try i <- !(duplicated(Dup) | duplicated(Dup, fromLast = TRUE)) Dup[i] or in one line, I post it like this to make it more clear. Hope this helps, Rui Barradas Às 14:41 de 19/11/2018, Knut Krueger escreveu: It should be simple but i do not find the right keywords: Dup = 

Re: [R] unique() duplicate() not what i am looking for

2018-11-19 Thread PIKAL Petr
Hi and maybe sloightly less complicated setdiff(Dup,Dup[duplicated(Dup)]) Cheers Petr > -Original Message- > From: R-help On Behalf Of Knut Krueger > Sent: Monday, November 19, 2018 3:42 PM > To: r-help@r-project.org >> r-help mailing list > Subject: [R] unique()

Re: [R] unique() duplicate() not what i am looking for

2018-11-19 Thread PIKAL Petr
Hi Dup %in% Dup[duplicated(Dup)] Dup[!(Dup %in% Dup[duplicated(Dup)])] Cheers Petr > -Original Message- > From: R-help On Behalf Of Knut Krueger > Sent: Monday, November 19, 2018 3:42 PM > To: r-help@r-project.org >> r-help mailing list > Subject: [R] unique() d

[R] unique() duplicate() not what i am looking for

2018-11-19 Thread Knut Krueger
It should be simple but i do not find the right keywords: Dup = c(1,2,3,4,1,2,3,5) I need 4,5 as result unique(Dup) gives me [1] 4 1 2 3 5 duplicated(Dup) gives me [1] FALSE FALSE FALSE FALSE TRUE TRUE TRUE FALSE I need [1] TRUE TRUE TRUE FALSE TRUE TRUE TRUE FALSE Kind regards

Re: [R] unique dates per ID

2016-11-15 Thread jeremiah rounds
library(data.table) setDT(df) setkeyv(df, c("Subject", "dates")) unique(df) #gets what you want. On Mon, Nov 14, 2016 at 11:38 PM, Jim Lemon wrote: > Hi Farnoosh, > Try this: > > for(id in unique(df$Subject)) { > whichsub<-df$Subject==id > if(exists("newdf")) >

Re: [R] unique dates per ID

2016-11-14 Thread Jim Lemon
Hi Farnoosh, Try this: for(id in unique(df$Subject)) { whichsub<-df$Subject==id if(exists("newdf")) newdf<-rbind(newdf,df[whichsub,][which(!duplicated(df$dates[whichsub])),]) else newdf<-df[whichsub,][which(!duplicated(df$dates[whichsub])),] } Jim On Tue, Nov 15, 2016 at 9:38 AM, Farnoosh

Re: [R] unique dates per ID

2016-11-14 Thread Ulrik Stervbo
Hi Farnoosh, you can use unique in the R-base or distinct from the dplyr library. Best Ulrik On Tue, 15 Nov 2016 at 06:59 Farnoosh Sheikhi via R-help < r-help@r-project.org> wrote: > Hi, > I have a data set like below: > Subject<- c("2", "2", "2", "3", "3", "3", "4", "4", "5", "5", "5", >

[R] unique dates per ID

2016-11-14 Thread Farnoosh Sheikhi via R-help
Hi,  I have a data set like below: Subject<- c("2", "2", "2", "3", "3", "3", "4", "4", "5", "5", "5", "5")dates<-c("2011-01-01", "2011-01-01", "2011-01-03" ,"2011-01-04", "2011-01-05", "2011-01-06" ,"2011-01-07", "2011-01-07", "2011-01-09" ,"2011-01-10"         ,"2011-01-11"

Re: [R] Unique Ordering

2016-04-23 Thread Jim Lemon
Hi Edward, I'm not really sure that this is what you want as I can't figure out what the "earn" factor is, but: epdat[order(epdat$Var2,epdat$Freq,decreasing=TRUE),] Jim On Sat, Apr 23, 2016 at 4:08 AM, Patzelt, Edward wrote: > Hi R-Help, > > data at bottom > > I've been

[R] Unique Ordering

2016-04-22 Thread Patzelt, Edward
Hi R-Help, data at bottom I've been struggling with a problem where I need to order based on 1) the Frequency "Freq" and 2) keeping each group of 3 of the same type together "Var2" but I want across all groups it to go "high to low" based on the earn factor. Thank you! structure(list(Var1 =

Re: [R] unique identifier for number sequence

2015-11-23 Thread PIKAL Petr
Hi Cool, thanks. I knew I am missing some obvious way. Cheers Petr From: jim holtman [mailto:jholt...@gmail.com] Sent: Monday, November 23, 2015 4:14 PM To: PIKAL Petr Cc: r-help@r-project.org Subject: Re: [R] unique identifier for number sequence Here is one way of doing it: > x<-c(r

Re: [R] unique identifier for number sequence

2015-11-23 Thread jim holtman
Here is one way of doing it: > x<-c(rep(0,5), rep(1,5), rep(0,10), rep(1,8)) > x [1] 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 > > # mark changes from 0->1 and create increments > indx <- cumsum(c(FALSE, diff(x) == 1)) > > # keep just matches with '1' > x.i <- ifelse(x == 1, indx,

Re: [R] unique identifier for number sequence

2015-11-23 Thread jim holtman
lto:jholt...@gmail.com] > *Sent:* Monday, November 23, 2015 4:14 PM > *To:* PIKAL Petr > *Cc:* r-help@r-project.org > *Subject:* Re: [R] unique identifier for number sequence > > > > Here is one way of doing it: > > > > > x<-c(rep(0,5), rep(1,5), rep(0,

[R] unique identifier for number sequence

2015-11-23 Thread PIKAL Petr
Dear all I have a vector ones and zeroes like that x<-c(rep(0,5), rep(1,5), rep(0,10), rep(1,8)) and I need to get result like that x.i<-c(rep(0,5), rep(1,5), rep(0,10), rep(2,8)) It means I need an unique identifier for each sequence of ones. It probably can be done by rle, cumsum and some

Re: [R] unique identifier for number sequence

2015-11-23 Thread William Dunlap
> f <- function(x)cumsum(c(x[1]==1, x[-length(x)]==0 & x[-1]==1)) * (x==1) > f(x) [1] 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 2 2 2 2 2 2 2 2 > f(rev(x)) [1] 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 2 2 2 2 2 0 0 0 0 0 Bill Dunlap TIBCO Software wdunlap tibco.com On Mon, Nov 23, 2015 at 6:59 AM,

Re: [R] unique identifier for number sequence

2015-11-23 Thread Eik Vettorazzi
cumsum(c(x[1],pmax(0,diff(x*x Am 23.11.2015 um 15:59 schrieb PIKAL Petr: > Dear all > > I have a vector ones and zeroes like that > x<-c(rep(0,5), rep(1,5), rep(0,10), rep(1,8)) > > and I need to get result like that > x.i<-c(rep(0,5), rep(1,5), rep(0,10), rep(2,8)) > > It means I need an

[R] Unique values in dataframe columns

2014-09-25 Thread Maicel Monzón Pérez
Hello list I would like to know how can i detect dataframe columns that have as unique values elements of a list. For example, at a given dataframe to look for columns that unique values are elements of a list like this one… dataframe-data.frame( x = c(yes”, 1”, no”, no”), y = c(black”,

Re: [R] Unique values in dataframe columns

2014-09-25 Thread Jeff Newmiller
You messed up the quote marks and the library function is not capitalized. You defined your search list by the name list, which is also the name of a commonly used base function in R. Also, the vector you gave to GetAllSubsets had several misleading invisible conversions to character because

[R] unique rows

2014-01-28 Thread array chip
Hi, I wanted to remove redundant rows (with same entry in columns) in a data frame. For example, with this data frame: dat-cbind(x=c('a','a','b','b','c','c'),y=c('x','x','d','s','g','g')) dat x   y  [1,] a x [2,] a x [3,] b d [4,] b s [5,] c g [6,] c g after removing the redundancy, the

Re: [R] unique rows

2014-01-28 Thread Bert Gunter
Inline. -- Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 Data is not information. Information is not knowledge. And knowledge is certainly not wisdom. H. Gilbert Welch On Tue, Jan 28, 2014 at 2:06 PM, array chip arrayprof...@yahoo.com wrote: Hi, I wanted to remove

Re: [R] unique rows

2014-01-28 Thread arun
Hi, use ?unique  unique(dat) A.K. Hi, I wanted to remove redundant rows (with same entry in columns) in a data frame. For example, with this data frame: dat-cbind(x=c('a','a','b','b','c','c'),y=c('x','x','d','s','g','g')) dat x   y  [1,] a x [2,] a x [3,] b d [4,] b s [5,] c g

Re: [R] unique rows

2014-01-28 Thread array chip
sorry.. don't know unique().. such a great function From: Bert Gunter gunter.ber...@gene.com Cc: r-help@r-project.org r-help@r-project.org Sent: Tuesday, January 28, 2014 2:21 PM Subject: Re: [R] unique rows Inline. -- Bert Bert Gunter Genentech

[R] unique mismatch in R and Excel

2013-12-24 Thread Koushik Saha
i have a wired problem. i want to count the unique entry in a certain column.Here i have attached my csv file. i am doing this to get the unique entries in the column. dat-read.csv(C:/Project/Gawk-scripts/Book1.csv) names(dat)-c(user_name) unique(dat$user_name) results says i have 170 unique

Re: [R] unique mismatch in R and Excel

2013-12-24 Thread Duncan Murdoch
On 13-12-24 4:08 AM, Koushik Saha wrote: i have a wired problem. i want to count the unique entry in a certain column.Here i have attached my csv file. i am doing this to get the unique entries in the column. dat-read.csv(C:/Project/Gawk-scripts/Book1.csv) names(dat)-c(user_name)

Re: [R] unique mismatch in R and Excel

2013-12-24 Thread David Winsemius
On Dec 24, 2013, at 1:08 AM, Koushik Saha wrote: i have a wired problem. i want to count the unique entry in a certain column.Here i have attached my csv file. Files named with extension .csv do not typically make it through the R-help mail server. i am doing this to get the unique

[R] Unique in discerning missing values NA

2013-07-05 Thread Pancho Mulongeni
Hi, I am trying to remove duplicate Patient numbers in a clinical record, I used unique menPatients[1:40,1] [1] abr1160(C)/001 ABR1363(A)/001 ABR1363(A)/001 ABR1363(A)/001 abr1772(B)/001 [6] AFR0003/001AFR0003/001afr0290(C)/001 afr1861(B)/001 Aga0007/001 [11] AGA1548(A)/001

Re: [R] Unique in discerning missing values NA

2013-07-05 Thread Pascal Oettli
Hi, testUnique - unique(testData[!is.na(testData)]) or testUnique - unique(na.omit(testData)) And probably some other solutions. Regards, Pascal 2013/7/5 Pancho Mulongeni p.mulong...@namibia.pharmaccess.org Hi, I am trying to remove duplicate Patient numbers in a clinical record, I used

Re: [R] Unique in discerning missing values NA

2013-07-05 Thread Rui Barradas
Hello, Your data example is difficult to read into an R session. Next time, post the output of ?dput. Like this: dput(menPatients[1:40, 1]) # post the output of this The help page for unique says that Missing values are regarded as equal so you should expect one NA to still be present in

Re: [R] Unique in discerning missing values NA

2013-07-05 Thread Pancho Mulongeni
Subject: Re: [R] Unique in discerning missing values NA Hello, Your data example is difficult to read into an R session. Next time, post the output of ?dput. Like this: dput(menPatients[1:40, 1]) # post the output of this The help page for unique says that Missing values are regarded as equal so

Re: [R] Unique matching of two sets of multidimensional data

2013-06-25 Thread Adams, Jean
You could give 1-nearest neighbor classification a try. For example, a - data.frame(person=1:10, ht=rnorm(10, mean=5, sd=1), wt=rnorm(10, mean=180, sd=30), bp=rnorm(10, mean=120, sd=10)) meas.err - data.frame(ht=rnorm(10, sd=0.1), wt=rnorm(10, sd=3), bp=rnorm(10, sd=1)) b - (a[, -1] +

[R] Unique matching of two sets of multidimensional data

2013-06-24 Thread Leif Kirschenbaum
Dear list, I've searched the archives and tried some code, however would appreciate some input - even a pointer in the direction of the correct function to use. Given N samples each of which is measured for characteristics x1, x2, x3,... (m ˜ 6) where each characteristic is a roughly normally

[R] unique not working

2013-03-28 Thread Nicole Ford
i am using mac OSX 10.7.5, running R version 2.15.2 (2012-10-26) -- Trick or Treat when i do: uncountry - unique(wvsAB[,7]) wvsAB$numcountry - match(wvsAB$country, uncountry) unstate isn't attaching. library(base) uncountry - unique(wvsAB[,7]) wvsAB$numcountry - match(wvsAB$country,

Re: [R] unique not working

2013-03-28 Thread Sarah Goslee
Hi, I'm confused. On Thu, Mar 28, 2013 at 10:49 AM, Nicole Ford nicolefor...@gmail.com wrote: i am using mac OSX 10.7.5, running R version 2.15.2 (2012-10-26) -- Trick or Treat when i do: uncountry - unique(wvsAB[,7]) wvsAB$numcountry - match(wvsAB$country, uncountry) unstate isn't

Re: [R] unique not working

2013-03-28 Thread nicole ford
Now R isn't running on my computer AT ALL. i deleted it and d/l'd again, trying to get it to work, it keeps crashing. so perhaps this is a hardware issue. the absolute worst timing. ~Nicole Ford Ph.D. Student Instructor: Empirical Political Analysis Department of Government and International

Re: [R] unique not working

2013-03-28 Thread Nicole Ford
i meant uncountry. i am creating one now/ dput(). thanks. ~Nicole Ford Ph.D. student Graduate Assistant/ Instructor University of South Florida Government and International Affairs office: SOC 012M On Mar 28, 2013, at 11:55 AM, Sarah Goslee wrote: Hi, I'm confused. On Thu, Mar 28,

[R] unique

2012-10-16 Thread paladini
Hello everybody, I've got a problem concerning the function unique. I have got a data.frame shopdata with 1000 shop which were evaluated at different points in time. With function subset I chose those shops with more then 10 employee and store it in data.frame bigshopdata with 700 shops.

Re: [R] unique

2012-10-16 Thread Milan Bouchet-Valat
Le mardi 16 octobre 2012 à 14:45 +0200, paladini a écrit : Hello everybody, I've got a problem concerning the function unique. I have got a data.frame shopdata with 1000 shop which were evaluated at different points in time. With function subset I chose those shops with more then 10

Re: [R] unique

2012-10-16 Thread Rainer Schuermann
If I understand your problem correctly (as Milan has pointed out, sample data and code would help enormously) this should get you where you want: unique( shopdata$name[ shopdata$employee 10 ] ) If not, something is wrong from the outset (or with my understanding, but then ... see above)!

[R] unique with tolerance

2012-09-06 Thread Michael Bach
Dear R Users and Developers, I am trying to do the equivalent of v - c(1,2,3,3,2,1,) vu - unique(v) for a vector such as v2 - c(1.02, 2.03, 1.00, 3.04, 3.06) vut - ... As indicated in the subject, we need approximately unique values with a defined tolerance, i.e. for the v2 vector the

Re: [R] unique with tolerance

2012-09-06 Thread Duncan Murdoch
On 06/09/2012 6:48 AM, Michael Bach wrote: Dear R Users and Developers, I am trying to do the equivalent of v - c(1,2,3,3,2,1,) vu - unique(v) for a vector such as v2 - c(1.02, 2.03, 1.00, 3.04, 3.06) vut - ... As indicated in the subject, we need approximately unique values with a defined

Re: [R] unique with tolerance

2012-09-06 Thread PIKAL Petr
Hi -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Michael Bach Sent: Thursday, September 06, 2012 12:48 PM To: r-h...@stat.math.ethz.ch Subject: [R] unique with tolerance Dear R Users and Developers, I am trying to do

Re: [R] unique with tolerance

2012-09-06 Thread Bert Gunter
... and if it Duncan's suggestion won't do, maybe approaching it via clustering might be useful. But do note that, as stated, the problem is not well defined, because transitivity fails: consider v - c(1,2,3,4,5,10) with a tolerance of =2. Then 1 is the same as 2 and 3, 2 and 3 are the same as

Re: [R] unique with tolerance

2012-09-06 Thread Michael Bach
Thanks to both of you for suggestions. I settled for the round() approach. much obliged, Michael Bach __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] unique with tolerance

2012-09-06 Thread Michael Bach
On 9/6/2012 7:24 PM, Bert Gunter wrote: ... and if it Duncan's suggestion won't do, maybe approaching it via clustering might be useful. But do note that, as stated, the problem is not well defined, because transitivity fails: consider v - c(1,2,3,4,5,10) with a tolerance of =2. Then 1 is the

Re: [R] Unique Values per Column

2012-07-23 Thread Jean V Adams
Bert, Is it important that you end up with a data frame? If not, it would be very easy to generate a list with the unique values for each column. For example: df - data.frame(v1 = sample(5, 20, T), v2 = sample(7, 20, T), v3 = sample(9, 20, T), v4 = sample(11, 20, T)) lapply(df,

[R] Unique Values per Column

2012-07-20 Thread Bert Jacobs
Hi, I was wondering what the best way is to create a new dataframe based on an existing dataframe with only the unique available levels for each column (22 columns in total) in it. If some columns have less unique values than others, then those columns can be filled with blanks for the remaining

[R] unique vs duplicate problem

2012-07-09 Thread Nico902
Hi, Let say I have a numeric vector: x - c(1, 2, 3, 3). I want on one hand numbers which are not duplicated ie 1,2 and duplicated 3. so I did: duplicated(x) FALSE FALSE FALSE TRUE unique(x) 1 2 3 which is not what I want. Is there a function in R to have the following result:

Re: [R] unique vs duplicate problem

2012-07-09 Thread jim holtman
Here is one way of doing it -- you can create your own functions: x - c(1, 2, 3, 3) allDup - + function (value) + { + duplicated(value) | duplicated(value, fromLast = TRUE) + } duped - unique(x[allDup(x)]) duped [1] 3 setdiff(unique(x), duped) [1] 1 2 On Mon, Jul 9, 2012 at 12:42

Re: [R] unique vs duplicate problem

2012-07-09 Thread Rui Barradas
Hello, Maybe this function. fun - function(x) x %in% x[duplicated(x)] x - c(1, 2, 3, 3) fun(x) Hope this helps, Rui Barradas Em 09-07-2012 17:42, Nico902 escreveu: Hi, Let say I have a numeric vector: x - c(1, 2, 3, 3). I want on one hand numbers which are not duplicated ie 1,2 and

Re: [R] unique vs duplicate problem

2012-07-09 Thread Nico902
excellent!!! thanks a lot!! -- View this message in context: http://r.789695.n4.nabble.com/unique-vs-duplicate-problem-tp4635868p4635874.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] unique vs duplicate problem

2012-07-09 Thread arun
Hi, Try this: #Duplicated: x-c(1:3,3) x==x[duplicated(x)] #[1] FALSE FALSE  TRUE  TRUE #Unique:  x[!x==x[duplicated(x)]] #[1] 1 2 A.K. - Original Message - From: Nico902 descos...@ciml.univ-mrs.fr To: r-help@r-project.org Cc: Sent: Monday, July 9, 2012 12:42 PM Subject: [R

Re: [R] unique vs duplicate problem

2012-07-09 Thread Peter Ehlers
- Original Message - From: Nico902 descos...@ciml.univ-mrs.fr To: r-help@r-project.org Cc: Sent: Monday, July 9, 2012 12:42 PM Subject: [R] unique vs duplicate problem Hi, Let say I have a numeric vector: x - c(1, 2, 3, 3). I want on one hand numbers which are not duplicated ie 1,2

Re: [R] unique vs duplicate problem

2012-07-09 Thread arun
. - Original Message - From: Peter Ehlers ehl...@ucalgary.ca To: arun smartpink...@yahoo.com Cc: Nico902 descos...@ciml.univ-mrs.fr; R help r-help@r-project.org Sent: Monday, July 9, 2012 4:14 PM Subject: Re: [R] unique vs duplicate problem On 2012-07-09 11:07, arun wrote: Hi, Try

[R] Unique instances of a string in a vector -- there must be a better way to do this

2012-03-27 Thread z2.0
I'm sure there's a better way to do this using plyr. I just can't nail the right series of commands. I've got a vector of strings. I want to remove all where the string's count within the vector is 1. Right now I'm using: Where x2 is the original data.frame and my character strings live

Re: [R] Unique instances of a string in a vector -- there must be a better way to do this

2012-03-27 Thread R. Michael Weylandt
It's a bit of a hack, but I think you can try something like this: x - c(1,2,3,4,5,2,5) duplicated(x) | duplicated(x, fromLast=T) Michael On Tue, Mar 27, 2012 at 7:02 PM, z2.0 zack.abraham...@gmail.com wrote: I'm sure there's a better way to do this using plyr. I just can't nail the right

[R] Unique in DataFrame

2012-03-20 Thread MSousa
Hello, I have little doubt, and I do not think that the way I solve the problem is the best way to do it. The following is a small dataset x-data.frame(city=Barcelona,sales=253639) x-rbind(x,data.frame(city=Madrid,sales=223455)) x-rbind(x,data.frame(city=Lisbon,sales=273633))

Re: [R] Unique in DataFrame

2012-03-20 Thread jim holtman
This may be what you want: x-data.frame(city=Barcelona,sales=253639) x-rbind(x,data.frame(city=Madrid,sales=223455)) x-rbind(x,data.frame(city=Lisbon,sales=273633)) x-rbind(x,data.frame(city=Madrid,sales=266535)) x-rbind(x,data.frame(city=Barcelona,sales=258369))

Re: [R] Unique in DataFrame

2012-03-20 Thread MSousa
Thanks. -- View this message in context: http://r.789695.n4.nabble.com/Unique-in-DataFrame-tp4488943p4489554.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] unique combinations

2011-12-22 Thread Jeff Newmiller
On Wed, 21 Dec 2011, Keith Jewell wrote: Thanks Uwe, I was happy that my 2 lines gave what the OP asked for, albeit in a different order. My puzzlement arose from Jeff Newmillers comment: You could read the help for expand.grid very carefully for the answer to this question. ... which I

[R] unique combinations

2011-12-21 Thread Antje Niederlein
Hi there, I have a vector and would like to create a data frame, which contains all unique combination of two elements, regardless of order. myVec - c(1,2,3) what expand.grid does: 1,1 1,2 1,3 2,1 2,2 2,3 3,1 3,2 3,3 what I would like to have 1,1 1,2 1,3 2,2 2,3 3,3 Can anybody help?

Re: [R] unique combinations

2011-12-21 Thread peter dalgaard
On Dec 21, 2011, at 08:59 , Antje Niederlein wrote: Hi there, I have a vector and would like to create a data frame, which contains all unique combination of two elements, regardless of order. myVec - c(1,2,3) what expand.grid does: 1,1 1,2 1,3 2,1 2,2 2,3 3,1 3,2 3,3

Re: [R] unique combinations

2011-12-21 Thread Jeff Newmiller
You could read the help for expand.grid very carefully for the answer to this question. --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.

Re: [R] unique combinations

2011-12-21 Thread Keith Jewell
OK, someone point it out to me; my wife tells me I can't see what's in front of me :-} I read ?expand.grid carefully, went to ?combn and ?choose but still couldn't see an easy way to get what the OP asked for. The neatest I can get (which isn't very neat!) is: myVec - c(1,2,3) eg -

Re: [R] unique combinations

2011-12-21 Thread Uwe Ligges
On 21.12.2011 14:39, Keith Jewell wrote: OK, someone point it out to me; my wife tells me I can't see what's in front of me :-} I read ?expand.grid carefully, went to ?combn and ?choose but still couldn't see an easy way to get what the OP asked for. The neatest I can get (which isn't very

Re: [R] unique combinations

2011-12-21 Thread Keith Jewell
Thanks Uwe, I was happy that my 2 lines gave what the OP asked for, albeit in a different order. My puzzlement arose from Jeff Newmillers comment: You could read the help for expand.grid very carefully for the answer to this question. ... which I reas as saying that ?expand.grid would lead to

Re: [R] unique possible bug

2011-10-06 Thread Uwe Ligges
On 05.10.2011 22:15, Patrick McCann wrote: Hi, I am trying to read in a rather large list of transactions using the arules library. You mean the arules package? It seems in the coerce method into the dgCmatrix, it somewhere calls unique. Unique.c throws an error when n 536870912;

Re: [R] unique possible bug

2011-10-06 Thread Uwe Ligges
I see. For now: Yes, you need to change and recompile. I will take a look what was actually changed and will run some test cases. Best, Uwe On 06.10.2011 16:50, Patrick McCann wrote: The error I am referring to is in unique.c in Base R, it cannot accomodate greater than 2^29 values, even

Re: [R] unique possible bug

2011-10-06 Thread Patrick McCann
The error I am referring to is in unique.c in Base R, it cannot accomodate greater than 2^29 values, even though it appears the overflow protection should be 2^30. The only relevance of the arules package is I was using it while I discovered this issue. Thanks, Patrick 2011/10/6 Uwe Ligges

[R] unique possible bug

2011-10-05 Thread Patrick McCann
Hi, I am trying to read in a rather large list of transactions using the arules library. It seems in the coerce method into the dgCmatrix, it somewhere calls unique. Unique.c throws an error when n 536870912; however, when 4*n was modified to 2*n in 2004, the overflow protection should have

Re: [R] unique limited to 536870912

2011-01-05 Thread jim holtman
Could it be that you are running on a 32-bit version of R? 536870912 * 4 = 2GB if those were integers which would use up all of memory. You never did show what your error message was or what system you were using. On Wed, Jan 5, 2011 at 12:08 AM, Indrajeet Singh sin...@cs.ucr.edu wrote: Hi I

Re: [R] unique limited to 536870912

2011-01-05 Thread Indrajeet Singh
Hi I am using the 64 bit version. To check that i went in the bin folder and executed file r . It gave the following output ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped The error i got when

[R] unique limited to 536870912

2011-01-04 Thread Indrajeet Singh
Hi I am using R with igraph to analyze an edgelist that is greater than the said amount. Does anyone know a way around this? Thanks Inder __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] unique column values and counts

2010-11-29 Thread topman77
How do I create a second dataframe that shows unique column values from first dataframe and the number count of rows in first dataframe where column value appears? For example, first dataframe is this: x - matrix(c(101:104,101:104,105:106,1:10), nrow=10, ncol=2) x [,1] [,2] [1,] 101

Re: [R] unique column values and counts

2010-11-29 Thread Ben Tupper
Hi, On Nov 29, 2010, at 7:40 PM, topma...@yahoo.com wrote: How do I create a second dataframe that shows unique column values from first dataframe and the number count of rows in first dataframe where column value appears? For example, first dataframe is this: x -

[R] Unique subsetting question

2010-09-22 Thread AndrewPage
Hi all, I'm looking at a large data set, and I'm interested in removing rows where only one variable is duplicated. Here's an example: presidents Qtr1 Qtr2 Qtr3 Qtr4 1945 NA 87 82 75 1946 63 50 43 32 1947 35 60 54 55 1948 36 39 NA NA 1949 69 57 57

Re: [R] Unique subsetting question

2010-09-22 Thread Ivan Calandra
Hi, Take a look at ?duplicated and ?unique HTH, Ivan Le 9/22/2010 16:55, AndrewPage a écrit : Hi all, I'm looking at a large data set, and I'm interested in removing rows where only one variable is duplicated. Here's an example: presidents Qtr1 Qtr2 Qtr3 Qtr4 1945 NA 87

Re: [R] Unique subsetting question

2010-09-22 Thread AndrewPage
I understand how duplicated and unique work for a list where all parts of a given row are duplicated, or how to find duplicated values if I'm just looking at that first column, but in this case the rows for 1954 and 1955 are not completely the same; only quarter 1 is duplicated, so I'm not sure

Re: [R] Unique subsetting question

2010-09-22 Thread David Winsemius
On Sep 22, 2010, at 12:35 PM, AndrewPage wrote: I understand how duplicated and unique work for a list where all parts of a given row are duplicated, or how to find duplicated values if I'm just looking at that first column, but in this case the rows for 1954 and 1955 are not completely

Re: [R] Unique subsetting question

2010-09-22 Thread AndrewPage
I just figured that out, but the real data I'm using is a data frame for sure, so I'll find another example. -- View this message in context: http://r.789695.n4.nabble.com/Unique-subsetting-question-tp2550453p2550736.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Unique subsetting question

2010-09-22 Thread Ista Zahn
Hi Andrew, You can use duplicated() to index the rows you wish to keep, like this: test.dat - data.frame(a=c(1,1:5,5:10), b=1:12, c=letters[1:12]) #make up data duplicated(test.dat$a) # see what duplicated() function does !duplicated(test.dat$a) # see how we can invert using the ! function so

Re: [R] Unique subsetting question

2010-09-22 Thread AndrewPage
How about this: s = c(aa, bb, cc, , aa, dd, , aa) n = c(2, 3, 5, 6, 7, 8, 9, 3) b = c(TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE) df = data.frame(n, s, b) # df is a data frame I want to display df with no value in s occurring more than once. Also, I want to delete the

Re: [R] Unique subsetting question

2010-09-22 Thread AndrewPage
Thanks-- that works for what I'm trying to do. I was also wondering, in the data frame example you gave, if I just wanted to get rid of rows where the a value is 5, how would I do that? -- View this message in context:

Re: [R] Unique subsetting question

2010-09-22 Thread Ista Zahn
Hi Andrew, Perhaps you did not notice my previous email. The answer is still the same (see below): On Wed, Sep 22, 2010 at 1:48 PM, AndrewPage savejar...@yahoo.com wrote: How about this: s = c(aa, bb, cc, , aa, dd, , aa) n = c(2, 3, 5, 6, 7, 8, 9, 3) b = c(TRUE, FALSE, TRUE, TRUE, FALSE,

Re: [R] Unique subsetting question

2010-09-22 Thread Ista Zahn
I already gave you three examples of how this works. Your last request can be done in exactly the same way. Give it a try and see what happens (use example data of course!). As a last resort you could read the documentation: ?Comparison ?Extract -Ista On Wed, Sep 22, 2010 at 2:22 PM, AndrewPage

Re: [R] Unique subsetting question

2010-09-22 Thread AndrewPage
Oops, yeah I didn't see that. Thanks, Andrew -- View this message in context: http://r.789695.n4.nabble.com/Unique-subsetting-question-tp2550453p2550865.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing

[R] Unique rows in data frame (with condition)

2010-07-29 Thread Ralf B
I have to deal with data frames that contain multiple entries of the same (based on an identifying collumn 'id'). The second collumn is mostly corresponding to the the id collumn which means that double entries can be eliminated with ?unique. a - unique(data.frame(timestamp=c(3,3,3,5,8),

Re: [R] Unique rows in data frame (with condition)

2010-07-29 Thread Jorge Ivan Velez
Hi Ralf, Perhaps the following is what you are looking for: d - data.frame(timestamp=c(3,3,3,5,8), mylabel=c(a,a,a,b,c)) d d[!duplicated(d$timestamp),] HTH, Jorge On Fri, Jul 30, 2010 at 12:18 AM, Ralf B wrote: I have to deal with data frames that contain multiple entries of the same

Re: [R] Unique Data Frame Name?

2010-06-24 Thread Dennis Murphy
Hi: Try this: for (i in 1:2) { + x=c(1,2,3,4) + y=c(10,20,30,40) + G - paste(name, i, sep=) + assign(G, data.frame(x,y)) + } name1 x y 1 1 10 2 2 20 3 3 30 4 4 40 name2 x y 1 1 10 2 2 20 3 3 30 4 4 40 HTH, Dennis On Wed, Jun 23, 2010 at 3:56 PM, Douglas M.

[R] Unique Data Frame Name?

2010-06-23 Thread Douglas M. Hultstrand
Hello, I am trying to create a data frame with a unique name, based on indexing of for loop. I was wondering if there is a way to do this, I keep running into errors when I try to do this. Below is a brief example, I am trying to get two data frames (name1 and name2). Any suggestions are

Re: [R] Unique Data Frame Name?

2010-06-23 Thread Kjetil Halvorsen
\Why not put all the data frames in a list? Kjetil On Wed, Jun 23, 2010 at 6:56 PM, Douglas M. Hultstrand dmhul...@metstat.com wrote: Hello, I am trying to create a data frame with a unique name, based on indexing of for loop.  I was wondering if there is a way to do this, I keep running

[R] Unique Values of a Matrix

2010-02-26 Thread Todd DeWees
I have a 280,000 x 11 matrix with various values and many NA values. What I would like to do is get a vector of every unique value in the matrix. For example: X = [ 12NA 43 1 7 NA 2 ] Returns: Unique_X = [ 1, 2, 3, 4, 7] Thanks, Todd

Re: [R] Unique Values of a Matrix

2010-02-26 Thread Henrique Dallazuanna
Try this: unique(c(X)) On Fri, Feb 26, 2010 at 10:06 AM, Todd DeWees t.dew...@cpse.dundee.ac.uk wrote: I have a 280,000 x 11 matrix with various values and many NA values.  What I would like to do is get a vector of every unique value in the matrix. For example: X =     [ 1    2    NA    

Re: [R] Unique Values of a Matrix

2010-02-26 Thread Todd DeWees
Scotland UK PH: 01382-420119 -Original Message- From: Henrique Dallazuanna [mailto:www...@gmail.com] Sent: 26 February 2010 1:17 PM To: Todd DeWees Cc: r-help@r-project.org Subject: Re: [R] Unique Values of a Matrix Try this: unique(c(X)) On Fri, Feb 26, 2010 at 10:06 AM, Todd DeWees

  1   2   >