Questions tagged [subset]
A subset consists of those elements selected from a larger set of elements, by their position in the larger set or other features, such as their value.
subset
6,866
questions
0
votes
2
answers
27
views
Merge two datasets in a many to one framework, where dataset B's columns are a subset of dataset A's
My dataset A is a panel of individuals, as below. Many individuals can belong to a single family (variable fam_id). I have person variables and family variables in this dataset. As you can see, I have ...
0
votes
0
answers
19
views
How to request a huge amount of select CJK characters from Google Fonts API?
I'm trying to figure out how to subset a Japanese font by simply using a Google Fonts API request. There seem to be two options: subset= and text=. However, the former requires a set name which seems ...
1
vote
2
answers
42
views
How to get column-wise summary statistics with missing codes?
I have written a custom function ord_table() to extract summary statistics from a series of databases. To get those summary statistics, I have to filter out missing data codes (all codes are large ...
1
vote
2
answers
39
views
How to create a mask based on points coordinates?
Starting from this situation:
I would like to create a boolean mask where all external points are considered as True while all internal point are False. Something like this :
The objective would be ...
1
vote
3
answers
100
views
Can we retrieve entries from a tibble using index matrix?
I have a matrix where the row and column indices are stored that I want to retrieve from a dataset. With a data.frame this works fine:
set.seed(1)
df <- data.frame(a= letters[1:10], b= LETTERS[1:10]...
-2
votes
3
answers
156
views
Is there a Numpy function to subset an array based on values (not indices) in a slice or range?
I am trying to extract, from an array, all values within a certain slice (something like a range, but with optional start, stop and step). And in that, I want to benefit from the heavy optimizations ...
0
votes
2
answers
34
views
Loop in r with subset makes incomplete selection
I have a data frame (words) containing words with five letters, in which each letter appears in one of five columns. The sixth column represents the log probability of the word based on letter ...
2
votes
2
answers
80
views
How to check if some number can be retrieved as the result of the summation or difference of the given numbers
I have an arbitrary list of positive integers and some number X. I want to check if it is possible to retrieve X using basic operations such as summation and difference.
Any number from the list can ...
0
votes
0
answers
16
views
find-if-array-can-be-divided-into-two-subsets-of-equal-sum-if-any-one-element-deleted
Given a array of numbers find if there is a way to delete/remove a number from the array and make one partition in the array( dividing the array into two subsets ) such that sum of elements in ...
1
vote
2
answers
65
views
How to remove all rows where at least one column does not have a value of 1?
I have a presence/absence matrix of species occurences, which looks like this:
coords.x coords.y 1 2 3
Point 1 -69.07354 -15.76097 0 NA NA
Point 2 -69....
-2
votes
1
answer
84
views
What is the use of creating a copy of the input in a recursive call?
This is a code to generate all the substrings in of a given vector
class Solution {
public:
void sub(vector<int> &ip, vector<int> &op, vector<vector<int>> &ans) ...
0
votes
1
answer
19
views
Why does passing by reference change the answer while producing unique subsets?
Here is a solution to a problem to generate unique subsets of an array nums:
#include <bits/stdc++.h>
using namespace std;
void solveRec(vector<int> ss, set<vector<int>> &...
0
votes
2
answers
53
views
Filtering my data frame is erasing my data frame despite correct number of rows
I have a dataframe of transactions (roughly 76K rows). Each row has a column called START_DATE which is when the transaction started.
I am trying to filter down to transactions with START_DATE > 1/...
1
vote
1
answer
84
views
Overriding the subset method in R for a specific class interferes with other objects
I am working with R and I have created a new subset method for objects of class new_object. Here is my function:
setGeneric('subset', function(x, i) standardGeneric('subset'))
setMethod('subset', '...
1
vote
1
answer
52
views
Compute largest subset of a set such that all the elements of the subset would pairwise respect a certain condition
I have a set S consisting of natural numbers and a function that when given two natural numbers as an input it returns either true or false. Let's call the criteria based on which it computes the ...