FAQ Database Discussion Community


SQLite: Unique insert issue

android,sqlite,unique,composite-primary-key
I have an issue inserting rows into a table with a compound primary key specified. Compound key on: _id = id of the series (this starts always with 0 for every new shooting) shooting_id = id of my training session program_id = id of discipline I am currently training Whenever...

How do i prevent duplicate records in my database while updating records?

c#,mysql,sql-update,unique
in my mysql table I made look like this one ControlNum|Title |NumOfEpis|Description| 001 |naruto |500 |some text | 002 |conan |700 |some text | now I made a user control in C# where in the user is allowed to update all columns except the primary"ControlNum". so assuming each column has...

Unique values of the array with four fields

php,arrays,unique
I've an array like this: array( 0 => array(1, 2, 3, 4), 1 => array(1, 3, 2, 4), 2 => array(1, 2, 4, 3), 3 => array(1, 2, 5, 6) ) I have to remove records that are repeated. So I need finally to have this array: array( 0 =>...

Combining unique cell's values

excel,excel-formula,filtering,unique
I'm trying to get the combined values from column B from a list in column A that contains duplicates names. Sally Cookies, Apples Jamie Pie Sally Muffins Bob Jam Bob Pie and have the result be: Sally Cookies, Apples, Muffins Jamie Pie Bob Jam, Pie I've tried sorting with Unique,...

Unexpected result using unique inside a data.table

r,unique,data.table
Given a data.table (vith version 1.9.5) TEST <- data.table(1:20,rep(1:5,each=4, times=1)) If I run this: TEST[unique(V2)] I get this result: V1 V2 1: 1 1 2: 2 1 3: 3 1 4: 4 1 5: 5 2 Is it really the intended beahaviour or a bug? Or I'm just not using...

Combining lists in python with unique elements but changing the third

python,merge,unique,mean
I have two different lists of experiments with three columns. I want to merge the lists in only one, but if they have the same first and second element, perform the mean between the thirds values, take that results and remove the other two. Example: List 1: [[ 2, '+',...

Pandas grouping by and aggregating with respect to unique values

python,pandas,group-by,unique
In pandas v 012, I have the dataframe below. import pandas as pd df = pd.DataFrame({'id' : range(1,9), 'code' : ['one', 'one', 'two', 'three', 'two', 'three', 'one', 'two'], 'colour': ['black', 'white','white','white', 'black', 'black', 'white', 'white'], 'texture': ['soft', 'soft', 'hard','soft','hard', 'hard','hard','hard'], 'shape': ['round', 'triangular', 'triangular','triangular','square', 'triangular','round','triangular'], 'amount' : np.random.randn(8)}, columns= ['id','code','colour',...

Given a dictionary of numbers, determine which sets contain unique values (i.e. numbers that do not belong to any of the other sets)

ios,objective-c,nsdictionary,unique
Looking for the most efficient way to solve this using Objective-C (and Swift as a second preference). You have a NSDictionary containing the below sets for example. NSDictionary dict = @{ { @"foo", [NSNumber numberWithInt:1] }, { @"bar", [NSNumber numberWithInt:10] }, { @"baz", [NSNumber numberWithInt:11] }, { @"boz", [NSNumber numberWithInt:1]...

Creating a sequence of unique random digits

arrays,perl,foreach,unique
I have the following code use strict; use warnings; use 5.22.0; # Generating random seed using # Programming Perl p. 955 srand( time() ^ ($$ + ($$ << 15 ) ) ); # Generating code that could have duplicates my @code = ( (int(rand(9)) + 1), (int(rand(9)) + 1), (int(rand(9))...

unique working incorrectly with data.table

r,unique,data.table
I've discovered some interesting behavior in data.table, and I'm curious if someone can explain to me why this is happening. I'm merging two data.tables (in this MWE, one has 1 row and the other 2 rows). The merged data.table has two unique rows, but when I call unique() on the...

R - Identify common elements in data frame columns

r,data.frame,unique,value
Let's say I have the following data.frame: df <- structure(list(cloudiness = structure(1:47, .Label = c("ACCESS1-0", "ACCESS1-3", "BNU-ESM", "CCSM4", "CESM1-BGC", "CESM1-CAM5", "CESM1-CAM5-1-FV2", "CESM1-FASTCHEM", "CESM1-WACCM", "CMCC-CESM", "CMCC-CM", "CMCC-CMS", "CNRM-CM5", "CNRM-CM5-2", "CSIRO-Mk3-6-0", "CanESM2", "FGOALS-g2", "FIO-ESM", "GFDL-CM3", "GFDL-ESM2G", "GFDL-ESM2M", "GISS-E2-H", "GISS-E2-H-CC", "GISS-E2-R", "GISS-E2-R-CC", "HadCM3", "HadGEM2-AO", "HadGEM2-CC", "HadGEM2-ES", "IPSL-CM5A-LR", "IPSL-CM5A-MR", "IPSL-CM5B-LR",...

Saving multiple files with same name

c#,wpf,unique,filenames
I'm working on a C# WPF application that does some data processing and outputs files in .csv format. What I am trying to achieve is that every time my program runs, it produces a test.csv output file, however when I run again with new data.. the new resultant file overwrites...

Python Pandas: How I can unique my table only based on certain columns?

python,pandas,unique
I have a df : How can I remove duplicates based on of only one column? Because I have rows that all of their columns are the same but only one is not. I want to ignore that column and get the unique values based on the other column? That...

MySQL, get last active users in batches but prevent duplicate users in the next batch

php,mysql,unique,distinct,packets
I'm trying to extract users contributing to a specific topic in a message board. Each request gets a batch of 10 Unique users. The problem is that if some users where part of a previous batch they can occur in the next batch too. SELECT p.post_id as id, p.author as...

Python data wrangling issues

python,pandas,unique,dataframes
I'm currently stumped by some basic issues with a small data set. Here are the first three lines to illustrate the format of the data: "Sport","Entry","Contest_Date_EST","Place","Points","Winnings_Non_Ticket","Winnings_Ticket","Contest_Entries","Entry_Fee","Prize_Pool","Places_Paid" "NBA","NBA 3K Crossover #3 [3,000 Guaranteed] (Early Only) (1/15)","2015-03-01 13:00:00",35,283.25,"13.33","0.00",171,"20.00","3,000.00",35 "NBA","NBA 1,500 Layup #4 [1,500 Guaranteed] (Early Only) (1/25)","2015-03-01...

Count number of unique values per row in R

r,count,row,unique
I want to count the number of unique values per row. For instance with this data frame: example <- data.frame(var1 = c(2,3,3,2,4,5), var2 = c(2,3,5,4,2,5), var3 = c(3,3,4,3,4,5)) I want to add a column which counts the number of unique values per row; e.g. 2 for the first row (as...

Generating Unique Values for MySQL Unique Fields

php,mysql,unique
When a user signs up to my website, for example, I create a unique string of length 40 and insert it into the database. We then send an email to the newly signed up user containing this unique string in the form of an URL, and this all works fine....

Set of dictionary values python

python,dictionary,set,unique
I have a dictionary like this. d = {'ABCS': ['12', '12', '113', '12']} I want unique values like this {'ABCS': ['12', '113']} I tried set and its giving me something like this {'ABCS': [set(['1', '2']), set(['1', '2']), set(['1', '3']), set(['1', '2'])]} ...

Create an array of sub-arrays with the value of an element and the number of times it has repeated in JavaScript

javascript,arrays,algorithm,unique,repeat
I'm trying to take an array (for an example, an array of years) and then make a new array of sub-arrays which tells, firstly, the unique element in the original array and, secondly, how many time it was repeated. For example, lets say I start of with an array of...

Assigning unique variable from a data.frame

r,function,functional-programming,unique,identity-column
This is a similiar question to this but my output results are different. Take the data: example <- data.frame(var1 = c(2,3,3,2,4,5), var2 = c(2,3,5,4,2,5), var3 = c(3,3,4,3,4,5)) Now I want to create example$Identity which take a value from 1:x for each unique var1 value I have used example$Identity <- apply(example[,1],...

Scala set element uniqueness: What to implement for comparison of user defined classes?

scala,set,compare,unique
I am trying to find this information in the Scala documentation but it looks like it is not there. In the case of Java this was dependent of the Set implementation that was used, AFAIK. In some cases the method to implement was equals, in the case of a HashSet...

Getting unique tuples out of a python set

python,python-2.7,set,tuples,unique
I currently have a set like the following: {(a,b), (b,a), (c,b), (b,c)} What I Would like to have is: {(a,b), (c,b)} As you may notice the duplicate values have been removed completely so that two tuples never have the same elements inside regardless of order. How can I tell the...

XSD unique element XPath limitations

xml,xpath,xsd,unique
In order to allow an element to appear multiple times but restrict it to element values only being allowed once I'm applying the unique element. I've only got it working in an inefficient manner due to the XPath limitations within XSD 1.0 though. XSD 1.1 is unfortunately not an option...

unique values from a list

list,python-3.x,unique
How can I get 6 unique values from the list below? # List of donuts Donuts = ['Apple Cinnamon', 'Strawberry","Custard', 'Sugar Ring', 'Chocolate Caramel', 'Lemon Circle', 'Blueberry Blaster', 'Strawberry Surprise', 'Simple Sugar'] This is what I have so far: # Function - Random Selection of Donuts def Generate_Random(): if (len(Donuts)>0):...

Validating numeric uniqueness of two attributes in Rails

ruby-on-rails,validation,ruby-on-rails-4,activerecord,unique
I have a model Track which has two attributes: disc which represents what disc the track belongs to and number which represents the numeric order of the track on the album. I'd like to validate the uniqueness of the track number to where there can only be one unique track...

Remove smallest non-unique value from vector

c++,algorithm,c++11,unique
I have an unsorted vector of doubles (Actually objects with a double member which is used in this case). From this vector I need to remove the smallest non-unique value. However, it is not guaranteed that a non-unique value exists. It is allowed to sort the range. As always I...

FatalErrorException: Call to a member function count() on a non-object

php,database,random,laravel-5,unique
I'm trying to generate a unique/random string in Laravel 5 and check it through my table to see if it exists. This is what I have, but it seems to be giving the error stated in the title: public static function generate() { $exists = true; while ($exists) { $code...

Having trouble with two of my functions for text analysis

python,python-3.x,unique,longest-substring
I'm having trouble trying to find the amount of unique words in a speech text file (well actually 3 files), I'm just going to give you my full code so there is no misunderstandings. #This program will serve to analyze text files for the number of words in #the text...

Counting unique values in Google Spreadsheet based on multiple columns

google-spreadsheet,unique
Let's take this spreadsheet for example: ID | StoreName | StoreID | CheckinTime | User 0 | w1 | 1 | 10:00 | user1 1 | w5 | 1 | 10:01 | user2 2 | w2 | 1 | 10:01 | user1 3 | w1 | 1 | 10:01 |...

Get unique values in List of Lists in python

python,list,set,unique
I want to create a list (or set) of all unique values appearing in a list of lists in python. I have something like this: aList=[['a','b'], ['a', 'b','c'], ['a']] and i would like the following: unique_values=['a','b','c'] I know that for a list of strings you can just use set(aList), but...

In Neo4j, can I enforce a relationship+node value constraint?

neo4j,constraints,unique
this is from a Neo4j noob. The question is about identity rules, I suppose. Imagine I have the following data structure: ARTIST MADE many ALBUMs I can enforce artist uniqueness in the following manner: CREATE CONSTRAINT ON (artist:Artist) ASSERT artist.name IS UNIQUE which means the name is the business identity...

Shiny: Creating an unique list from input file

list,unique,shiny
I have been trying for days to create a list from my uploaded file, using Shiny. My file (.csv) is uploaded and shows a table corresponding to the csv-file. However, I have a column named 'Peptide.Sequence', and from that I want to create a list of unique names, as it...

Unique value rule for an attribute in yii

php,yii,unique
I'm new to yii. I have a table called 'member' and when entering values to that through my yii app, the user should not be allowed to insert a member with same NIC. Is there a default rule for that or should I create a custom rule? Can any one...

Misunderstanding creating r function

database,r,function,unique
I am trying to create a function with a command line that was working. I was creating an identifier for a dataset that looks like this Nom Var1 Var2 N1 v11 v12 N2 . . N2 . . N3 V32 V32 My command was: transform(df$Nom, id=match(df$Nom, unique(df$Nom))) and works just...

Remove duplicate from php array (not array_unique)

php,arrays,sorting,unique
I have an array like this: Array( [0] => Array( [id] => 1 [name] => name1 [table] => warehouse) [1] => Array( [id] => 2 [name] => name2 [table] => warehouse) [2] => Array( [id] => 3 [name] => name1 [table] => kitchen) [3] => Array( [id] => 4 [name]...

Uniqueness and other restrictions for Arbitrary in QuickCheck

haskell,unique,predicate,quickcheck
I'm trying to write a modified Arbitrary instance for my data type, where (in my case) a subcomponent has a type [String]. I would ideally like to bring uniqueness in the instance itself, that way I don't need ==> headers / prerequisites for every test I write. Here's my data...

How can i return a list with 1 property not being duplicated?

c#,list,unique,hashset
I have a method that pulls a list of states and cities from a database. The states are unique, but there can be many cities in that state. What my method currently does is return each state, and city pair as an individual item. What I need it to do...

SortedDictionary ArgumentException: “Æ” and “AE” considered the same keys

c#,.net,dictionary,unique,sorteddictionary
I was trying to use SortedDictionary to store some of my data from file, but got really weird bunch of key duplication exceptions. I came up with the next code sample which reproduces my issue: var dict = new SortedDictionary<string, string>(); dict.Add("Æ", "qwerty"); // "aesc" (aka "ash"), single symbol Console.WriteLine(dict["AE"]);...

What can be used as a unique USB device identifier aside from serial number?

c#,c#-4.0,unique
I'm making a USB desktop locker, much like this one but I'm trying to make it work with other USB devices (mice, kb, anything really). Are there any other unique info I can use aside from a serial number? Are there ways to access these from .NET? (C# specifically) (I...

List unique values of an attribute within a group only for specific criteria in XSL 1.0

xml,xslt,unique,groups
I need to list the unique values of an attribute in a group, when another attribute has a specific value. Making this work in XSL 1.0 is very tricky to understand. Thanks to another post, I now have the groupings defined to allow me to perform counts when attributes match...

Unique elements in each column of an array (Matlab)

arrays,matlab,unique,element,vectorization
I might be a bit rusty with Matlab, maybe the answer to this question is more trivial than I imagine at this moment. However I have searched online for efficient solutions and I haven't found any, so I will try here. I have a large matrix, something like y here:...

How to swap fields on docs with unique constraint in MongoDB/mongoose?

node.js,mongodb,unique
I have docs in series: [{ _id: ObjectId(), position: 1, name: 'This doc' }, { _id: ObjectId(), position: 2 name: 'That doc' }] position field has a unique constraint. Also, I need them all ordered, from 1 to n with no holes. How can I swap those things? If I...

Joining Table that has no value

sql,database,join,design,unique
Im working on a friendship site for a client that has been built by another developer. The client has added new questions to the questions table. I cant figure out a query to get all the questions for old users who have not answered the new questions. See table structure...

Postgresql enforce unique two-way combination of columns

postgresql,unique,combinations
I'm trying to create a table that would enforce a unique combination of two columns of the same type - in both directions. E.g. this would be illegal: col1 col2 1 2 2 1 I have come up with this, but it doesn't work: database=> \d+ friend; Table "public.friend" Column...

MySQL/PHP - Avoid duplicates - (INSERT, UNIQUE, REPLACE)

php,mysql,replace,unique,profile
I've been working on my own/small social-media platform and I'm almost done except for the following problem: I have profiles for all my users where one user is able to comment on somebody elses profile. So there is a user table that looks like: id | name | first_name |...

unique() seems to be adding another copy of the last element

c++,vector,unique
When I call unique() in this code, the output ends up having a copy of the final element tacked on at the end. vector<vector<int>> ints; for(int i(0); i<files; i++) { stringstream stream(list[i]); int num(0); vector<int> aList; for(int j(0); j<list[i].length(); j++) { if(stream.peek() == ' ') stream.ignore(); while (stream >> num)...

r - maximum number of unique elements occurring for a given value in matrix

r,matrix,count,unique
Suppose I got a data frame like this: > id = c(1,1,1,1,1,2,2,2,3,3) > type = c("a","a","b","c","a","a","b","c","a","c") > data = data.frame(id,type) > data id type 1 1 a 2 1 a 3 1 b 4 1 c 5 1 a 6 2 a 7 2 b 8 2 c 9 3...

Efficiently picking a unique number

arrays,algorithm,optimization,unique
Let's say that I have a potentially largish array of 32-bit numbers, perhaps several million entries long... is there a way to efficiently pick some number of the same bit-width that does not appear anywhere in the array? Naively, I could just pick some random number of the appropriate width,...

Firebase: how to generate a unique numeric ID for key?

push,firebase,unique,identity
I need numeric IDs for human readability. How do I get it in Firebase? UPDATE Well someone voted the question down because he thinks I didn't elaborate. I better work on that. I want numeric ID for keys, e.g. "000000001", "000000002","00000003","00000004". The reason I need it is because these IDs...

Is it possible to set unique constraint to the subset of all rows?

sql,postgresql,unique
I'm in PostgreSQL 9.4. I have the following table: id name deleted seril PK varchar(32) boolean NOT NULL Is it possible to apply UNIQUE constraint to all rows with deleted = false?...

Creating random character unique URLS [closed]

php,random,unique
How do I generate random 12 character char for URL of a page for the record in the database like how youtube does it with 11 characters https://www.youtube.com/watch?v=kDjirnJcanw I want it to be unique for each entry in the database and consist of letters of upper and lower case, numbers...

python pandas: Simplest way to perform group by and extract count of unique entities?

python,pandas,count,group-by,unique
my df: nr,name 1,sam 2,sam 1,mar 1,sam 2,tom 2,jack 1,mar How can I group by 'nr' and count distinct names in 'name' column? this must be a very easy command in all languages like mysql(groupby and distinct command) but I cannot find this in pandas. Can anybody help?...

Unique Combos from powershell array - No duplicate combos

arrays,powershell,unique
I'm trying to figure out the best way to get unique combinations from a powershell array. For instance, my array might be @(B,C,D,E) I would be hoping for an output like this : B C D E B,C B,D B,E C,D C,E D,E B,C,D C,D,E B,C,D,E I do not want...

How to access the keys of a Hashmap and compare them with a predetermined value?

java,hashmap,unique
I have this Hashmap: HashMap<String, Student> students = new HashMap<String, Student>(); After getting 2 String values from the user input (sNo, name) I have been able to put these into the hashmap as such: students.put(sNo, new Student(sNo, name)); My problem is, each time I run through this process I want...

Mean all other other columns based on a single column in r

r,data.frame,unique,average
I have a large dataframe that has more than 40,000 columns and I am running into a problem similar to this Sum by distinct column value in R shop <- data.frame( 'shop_id' = c('Shop A', 'Shop A', 'Shop A', 'Shop B', 'Shop C', 'Shop C'), 'Assets' = c(2, 15, 7,...

Prevent duplicate entries in a database table based on 2 columns

mysql,sql,duplicates,unique,alter-table
I record the datas of a competition in an MySQL database. I need to have unique entry for each player so i’ve done this : alter table xtu_datas_competition add unique index(email); It works perfectly. But there are several competitions, so i have also a colum id_ competition and i want...

Safe to use random numbers to make filenames unique?

c#,unique,filenames
I'm writing a program which basically processes data and outputs many files. There is no way it will be producing more than 10-20 files each use. I just wanted to know if using this method to generate unique filenames is a good idea? is it possible that rand will choose,...

Rails uniqueness validation test failing

ruby-on-rails,validation,testing,unique
I'm starting out with Rails 4.2, and I'm try to test uniqueness for the Item models I'm making, I ran this code: item.rb: class Item < ActiveRecord::Base attr_accessor :name validates :name, uniqueness: true #, other validations... end item_test.rb: require 'test_helper' class ItemTest < ActiveSupport::TestCase def setup @item = Item.new(name: "Example...

Generate 200 unique 40-char strings using 3 chars

c,string,char,unique
I'd like to generate at least 200 unique 40-character strings using only 'a', 'b', or 'c'. For example, a good string would be "aaaa...aaaa" (40-char). Here's my approach so far: char newid[41]; sprintf(newid, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa%\n", "bbbb"); another approach: char newid[41]; char* pad[41] = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; sprintf(newid, "%s%s\n", pad+4, "bbbb"); but I still...

SQL Server 2008: Unique constraint for values non-related with columns

sql-server,constraints,unique
I have a simple problem. How can I add a unique constraint for a table, without relating the values to their columns? For example, I have this table ID_A ID_B ---------- 1 2 ... ... In that example, I have the record (1,2). For me, (1,2) = (2,1). So i...

How can I check if the array of objects have duplicate property values?

javascript,arrays,unique
I need some help with iterating through array, I keep getting stuck or reinventing the wheel. values = [ { name: 'someName1' }, { name: 'someName2' }, { name: 'someName1' }, { name: 'someName1' } ] How could I check if there are two (or more) same name value in...

R construct summary of values from columns

r,data.frame,unique
I would like to make an array that summarises the rows of a data frame with the unique values contained within said rows. with sample the following example code: ref <- c(1:8) data1 <- c("A","","C","","","","A","") data2 <- c("A","","","A","C","","","") data3 <- c("","B","","","","","","B") data4 <- c("A","B","","","","D","A","") initial.data <- data.frame(ref, data1, data2, data3,...

JSON log file compaction

json,filter,unique,stream-compaction
Given a file with line delimited JSON records: {"id": 1, "position": 1234} {"id": 2, "position": 23} {"id": 3, "position": 43} {"id": 1, "position": 223} I would like to compact such a file, by keeping only the last record for an id, e.g. for the above example I would like to...

Python: Check for unique characters on a String

python,string,character,unique
I'm asking the user to input a keyword and then remove any duplicate characters. Example: Input: balloon Output: balon I've tried this solution: Python: List of all unique characters in a string but it marks it as a syntax error. Any ideas?...

Create a unique key from XML

php,xml,key,unique
Starting point I have a small application which stores hardware data from all computers in my network. A powershell script fetches the data and generates an XML therefrom. This XML is then sent via HTTP request to my PHP script. On my PHP script I map the data into several...

Storing indices of unique strings/elements of a vector in MATLAB

matlab,vector,unique
I have three vectors A, B and C of same size. A and B are numeric quantities while C is a cell array of strings. I want to generate sub-vectors of A based on the unique values of B and C. For example, let A = [0.45 0.89 0.12 0.35...

Use R to replace integers with consecutive natural numbers in two columns

r,osx,replace,unique,two-columns
I am using R version 3.1.2 on a Mac (x86_64-apple-darwin13.4.0) I have 40 files that each have 5 columns as shown below. > D16S503 MARKER LANE ID A_1 A_2 1 D16S503 D16S503 1228-0198898 309 313 2 D16S503 D16S503 1228-0198899 301 311 3 D16S503 D16S503 1228-0198900 301 311 4 D16S503 D16S503...

How to enforce unique 2-tuple on oracle table?

database,oracle,constraints,unique
I am trying to enforce the property that table Match should have all unique tuples (Team 1, Team 2). However, let Team 1 = Detroit Pistons and Team 2 = Chicago Bulls. I do not want to allow (Detroit Pistons, Chicago Bulls) to be inserted into the table if (Chicago...

Unique Index when data already exists

php,symfony2,doctrine,migration,unique
I ran into troubles when I want to add new column mapped ONE TO ONE. It creates unique index on that column and while executing SQL it obviously fail, because that table already contains rows. It's not a problem to remove data in development database, but it will be in...

XSLT sorting by 2 parametres and choosing by the 1st unique and the 2nd highest

xml,sorting,variables,xslt,unique
I had an xls book saved as xml. There I have 1st rows with header and other rows with data. In xml it looks: <Row ss:AutoFitHeight="0"> <Cell><Data ss:Type="String">Header 1 - id</Data><NamedCell ss:Name="_FilterDatabase"/></Cell> <Cell><Data ss:Type="String">Header 2 - Version</Data><NamedCell ss:Name="_FilterDatabase"/></Cell> <Cell><Data ss:Type="String">Header 3 - some data...</Data><NamedCell ss:Name="_FilterDatabase"/></Cell> </Row>...

How to generate 4 unique digit each time form 1 to 12 [closed]

random,numbers,unique
i want to generate 4 unique digit each time from 1 to 12. For example: [1,3,4,6] or [1,3,10,6] or [1,2,3,4]... but not like [1,2,8,1] or [2,2,4,5] because in last two chunk 1 comes twice and so as 2 in second chunk. Again i need to generate those unique chunk of...

Counting Unique Occurences in Excel

excel,count,unique,dcount
I am trying the count the number of unique sensors (column 1) that are present by visit duration (column 2). Here is a small portion of the data: Sensor ID Implant duration 13113 1 13113 1 13113 1 13144 1 13144 1 13144 2 13144 2 13144 2 13144 2...

storing 13 random values without duplicates from a string array in java

java,android,random,unique,shuffle
I want distribute 13 values to a string without duplication. i have used random function and shuffle as well but it is giving me 1 value from this String array String[] orgCards = { "ca", "ck", "cq", "cj", "c10", "c9", "c8", "c7", "c6", "c5", "c4", "c3", "c2", "sa", "sk", "sq",...

R: Extract unique values in columns of a dataframe

r,data.frame,unique
I have a dataframe in R and I wonder if it is possible to retrieve values of a column that are not present in the others columns and this for each column. My dataframe looks like : sample_1 sample_2 sample_3 a a a c e c d f e g...

Partition an Array with duplicate elements into arrays with unique elements

java,arrays,unique,duplicate-removal
I have an Array which is structured like this : String Array = {"1","2","3","41","56","41","72","72","72","78","99"} and I want to partition this array into a number of arrays which values are not duplicates... like this : String Array1 = {"1","2","3","41","56","72","78","99"} String Array2 = {"41","72"} String Array3 = {"72"} is there any straight...

Finding common rows in R

r,data.frame,unique
While trying to get my data fit for analysis, I can't seem to do this correctly. Presume I have a datasets in this form: df1 V1 V2df1 a H b Y c Y df2 V1 V2df2 a Y j H b Y and three more (5 datasets of different lengths...

Use unique user number in Google Forms

forms,url,unique,spreadsheet
I want to send my clients in my database an e-mail with a request to fill in a Google form to research their needs for our service in the future. Every client has an unique ID already (for example EX0258, EA1405, EZ2815). I need a way how I can add...

R summarize unique values across columns based on values from one column

r,unique,aggregate
I want to know the total number of unique values for each column based on the values of var_1. For example: Test <- data.frame(var_1 = c("a","a","a", "b", "b", "c", "c", "c", "c", "c"), var_2 = c("bl","bf","bl", "bl","bf","bl","bl","bf","bc", "bg" ), var_3 = c("cf","cf","eg", "cf","cf","eg","cf","dr","eg","fg")) The results I am looking for would...

Selecting specific rows from a large dataset using column values

r,unique,large-data
I have a large data set (about 2000 rows and 38 columns) that looks like this (there is missing data in some columns): species crab cmass gill gmass treatment months avglw avgils 222 Cm 65 34.273 p 0.198 Newtons Cove 0 68.108 93.181 223 Cm 57 33.506 p 0.166 Newtons...

Simple cardinality estimation algorithm

algorithm,unique,probability,cardinality,hyperloglog
There's the HyperLogLog algorithm, but it is quite complex. Is there any simpler space efficient approach that could be expressed in couple of lines of code?...

Using xpath to locate element with an underline in the name

xpath,selenium-webdriver,unique
I am trying to click on a webelement that changes ID and xpath dynamically. I dont see any other information that can be used directly to identify the element uniquely everytime the page loads. Here is the Xpath for the element: .//*[@id='isc_SB']/table/tbody/tr/td This will be updated along with ID at...