Gistlib Logo

gistlib

count the number of duplicate rows per value in a specific column in r

# Sample data
df <- data.frame(id = c(1, 2, 3, 4, 4, 5),
                 value = c("A", "B", "A", "C", "C", "B"))

# Count the number of duplicate rows per value in the 'value' column
dup_count <- table(df$value)

# Display the count of duplicate rows per value
dup_count
273 chars
10 lines

similar r code snippets

export csv in dataframe, remove specific rows and column in r
remove specific columns in a dataframe in r
export df as csv in r
load a spreadsheet into r. combined the first four rows and six columns into a matrix and if there are duplicate values in the matrix, randomise all rows in r
sort a dataframe according to a specfic variable pattern in r
create a loop based on columns varaibles in r
create a loop in specific columns from a dataframe in r
filter a dataframe from a specific value in a column in r
remove columns in a dataframe in r
recode some rows of dataframe in r

related categories

r
dataframe
duplicates

gistlibby LogSnag