Partial Credit Model: How to calculate the item difficulty? - r

I have a dataframe with credits of participants for several items. I would like to calculate the item difficulty of those items. With the eRm Package I can calculate the difficulty for the different categories of each item:
Some data:
x1 <- c(1, 2, 1, 0, 3, 3, 0, 4, 4, 1, 0, 3, 2, 0, 4, 1, NA, 1, 1, NA, 0, 1, 2, 1, 1, 3, 0, 2, 1, 0)
x2 <- c(0, 1, 0, 3, 2, 0, 1, 2, 2, NA, 0, 1, 2, 2, NA, 1, 2, 1, 2, 1, 0, 2, 3, 0, 1, 1, 0, 1, 1, 3)
x3 <- c(NA, NA, 3, 0, 1, 2, 0, 1, 1, NA, 3, 0, 1, 2, 0, 1, 2, 1, 0, 1, 3, 1, 3, 0, 1, 1, 0, 1, 1, 0)
x4 <- c(3, 0, 2, 2, 3, 2, 1, 2, 0, 0, 1, 0, 1, 1, 0, 1, 2, 1, 1, 2, 0, 1, 1, 2, 1, 1, 0, 1, 1, 0)
x5 <- c(1, NA, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, NA, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0)
dat <- data.frame(x1, x2, x3, x4, x5)
library("eRm")
Calculation of category difficulties:
PCM(dat)
PCM(dat)$etapar
I do not need the difficulty for the categories, but for the whole item. How can I calculate the overall difficulty of each item?
Thank you very much in advance!

Related

Percentage histogram with facet_grid: x variable is a factor

I want to split a percentage histogram (that integrates to 100%) into two facets using facet_grid. However, when splitting to facets, each facet by itself doesn't integrate to 100%. This kind of question has been resolved here in the past, but I cannot translate that solution to my current situation where x is a factor, and thus a histogram using stat(density) doesn't work.
My Data
Dataframe with two columns. equipment denotes whether a household has enough equipment for homeschooling, and children_n denotes number of children.
library(tidyverse)
library(magrittr)
df <-
structure(list(equipment = c(1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1,
0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1,
0, 1, 1, 1, 1, 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, 5, 1, 1, 2, 4,
2, 3, 5, 4, 1, 3, 2, 1, 2, 2, 4, 3, 4, 2, 2, 1, 3, 2, 4, 2, 3,
3, 2, 3, 2, 1, 2, 3, 4)), row.names = c(NA, -1059L), class = c("tbl_df",
"tbl", "data.frame"))
df
## # A tibble: 1,059 x 2
## equipment children_n
## <dbl> <dbl>
## 1 1 4
## 2 0 4
## 3 1 2
## 4 1 2
## 5 0 2
## 6 1 1
## 7 1 1
## 8 1 3
## 9 1 2
## 10 1 3
## # ... with 1,049 more rows
In cases where number of children is above 6, I want to collapse those cases to one category of "6+".
df %<>%
mutate_at(vars(children_n), as.character) %>%
mutate_at(vars(children_n), recode, "9" = "6_plus", "8" = "6_plus", "7" = "6_plus", "6" = "6_plus") %>%
mutate_at(vars(children_n), fct_relevel, "1", "2", "3", "4", "5", "6_plus")
glimpse(df)
## Rows: 1,059
## Columns: 2
## $ equipment <dbl> 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, ...
## $ children_n <fct> 4, 4, 2, 2, 2, 1, 1, 3, 2, 3, 3, 6_plus, 3, 2, 1, 2, 1, 1, 3, 3, 3, 2, 3, 3, 3, 2, 4, 3, 1, 2, 3, 4, 4, 1, 2, 5, 2, 6_plus, 1, 2, 1, 2,...
Now I want to plot the proportion of number of children in two separate panels: one panel for families who have enough equipment, and another panel for families who don't have enough equipment:
df %>%
ggplot(data = ., aes(x = children_n, y = equipment)) +
geom_histogram(aes(y = (..count..)/sum(..count..)), stat = "count" , fill = "darkblue") +
geom_text(aes(label = scales::percent(((..count..)/sum(..count..)), accuracy = 1),
y = ((..count..)/sum(..count..)) ), stat= "count", vjust = -.5, color = "darkblue") +
scale_y_continuous(labels = scales::percent) +
facet_grid(~ equipment, labeller = as_labeller(c("1" = "have enough equipment",
"0" = "don't have enough equipment")))
This gives two panels that *DON'T* integrate to 100% independently:
Trying to solve the problem
I found this question that describes the same intention and problem. The chosen solution suggests defining the geom_histogram as density so it integrates to 100%. But this won't work in my case because stat(density) asks that the x variable will be continuous, unlike my case where x is a factor.
df %>%
ggplot(data = ., aes(x = children_n, y = equipment)) +
geom_histogram(aes(y = stat(density) * 6), binwidth = 6, fill = "darkblue") +
facet_grid(~ equipment, labeller = as_labeller(c("1" = "have enough equipment",
"0" = "don't have enough equipment")))
Error: StatBin requires a continuous x variable: the x variable is
discrete. Perhaps you want stat="count"?
Other approaches suggest using ..PANEL.. while others are strongly against it.
How can I get the two facets to show percents that independently integrate to 100%, in a proper way?
This could be achieved like so:
Map the facetting variable on the group aes
Use e.g. tapply to get the total number per group or facet
BTW: I have put the code for the normalization inside a helper function to reduce the code duplication and readability
library(tidyverse)
library(magrittr)
df %<>%
mutate_at(vars(children_n), as.character) %>%
mutate_at(vars(children_n), recode, "9" = "6_plus", "8" = "6_plus", "7" = "6_plus", "6" = "6_plus") %>%
mutate_at(vars(children_n), fct_relevel, "1", "2", "3", "4", "5", "6_plus")
help <- function(count, group) {
count / tapply(count, group, sum)[group]
}
df %>%
ggplot(data = ., aes(x = children_n, y = equipment, group = equipment)) +
geom_histogram(aes(y = help(..count.., ..group..)), stat = "count" , fill = "darkblue") +
geom_text(aes(label = scales::percent(help(..count.., ..group..), accuracy = 1),
y = help(..count.., ..group..) ), stat= "count", vjust = -.5, color = "darkblue") +
scale_y_continuous(labels = scales::percent) +
facet_grid(~ equipment, labeller = as_labeller(c("1" = "have enough equipment",
"0" = "don't have enough equipment")))
#> Warning: Ignoring unknown parameters: binwidth, bins, pad

How can I write a simple classifier and generate a merged dataframe from it

I have a df like this;
>df[1:6,1:6]
> ABT.263 ABT.869 ABT.888 AC220 Afatinib Afatinib.rescreen.
> BT-20 1 1 1 1 0 1
> CAL-120 0 1 1 1 1 1
> CAL-51 1 1 1 1 1 1
> CAL-85-1 1 1 1 1 1 0
> DU-4475 0 1 1 1 1 1
> HCC1143 1 1 1 1 0 1
Basically, I want to extract 1's and 0's of each column's row name. Then put them into adjacent columns in a loop form.
Desired output is like this;
> final_df[1:6,1:4]
> ABT.263_1 ABT.263_0 ABT.869_1 ABT.869_0
> BT-20 CAL-120 BT-20 NA
> CAL-51 DU-4475 CAL-120
> CAL-85-1 CAL-51
> HCC1143 CAL-85-1
> DU-4475
> HCC1143
I can extract rownames of 0 cells and 1 cells separately with this;
value1 <- rownames(df)[which(df[,1] == 1)]
value0 <- rownames(df)[which(df[,1] == 0)]
However, failed to assign value1 and value0 vectors respectively in a df format with loops.
> dput(head(resp_tnbc, 20))
structure(list(ABT.263 = c(1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1,
1, 1, 1, 1, 1), ABT.869 = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1), ABT.888 = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1), AC220 = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
1, 1, 1, 1, 1, 1, 1), Afatinib = c(0, 1, 1, 1, 1, 0, 1, 1, 1,
0, 1, 0, 1, 1, 1, 0, 1), Afatinib.rescreen. = c(1, 1, 1, 0, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1), AG.014699 = c(1, 1, 0, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), AICAR = c(1, 1, 1, 1,
1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0), AKTinhibitorVIII = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1), AMG.706 = c(1,
1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1), AP.24534 = c(1,
1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), AR.42 = c(1,
1, 1, 1, 1, 1, 1, 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 1, 1, 1, 1), BIRB0796 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0), BIX02189 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), Bleomycin = c(1,
1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1), Bleomycin.50uM. = c(1,
1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), BMN.673 = c(1,
1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), BMS.345541 = c(1,
1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), BMS.536924.1 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), BMS.708163 = c(1,
0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1), BMS.708163.1 = c(1,
1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1), BMS.754807 = c(1,
1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), Bosutinib = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), Bryostatin1 = c(1,
1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1), BX.795 = c(1,
1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), BX.912 = c(1,
1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1), CAL.101 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1), Camptothecin = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), CAY10603 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), CCT007093 = c(1,
1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), CCT018159 = c(1,
1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1), CEP.701 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), Cetuximab = c(0,
1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1), CH5424802 = c(1,
1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1), CHIR.99021 = c(1,
1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1), CHIR.99021.1 = c(1,
1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), CI.1040 = c(1,
1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), Cisplatin = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), CP466722 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), CP724714 = c(1,
1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), CUDC.101 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), CX.5461 = c(1,
0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1), Cytarabine = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), Dabrafenib = c(1,
0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), DMOG = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), Docetaxel = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), Doxorubicin = c(1,
1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), EHT1864 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), EKB.569 = c(1,
1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1), Elesclomol = c(1,
1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1), Embelin = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), EpothiloneB = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), Etoposide = c(1,
1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), EX.527 = c(1,
1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1), FH535 = c(1,
1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1), FK866 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), FMK = c(1, 1,
1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), FR.180204 = c(1,
1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), FTI.277 = c(1,
1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), GDC0941 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1), GDC0941.rescreen. = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), Gefitinib = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1), Gemcitabine = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), GenentechCpd10 = c(1,
1, 1, 1, 0, 1, 0, 1,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, 1, 1, 1, 1, 1, 1, 1), JQ1.1 = c(1, 1,
1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1), JQ12 = c(1, 1,
1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), JW.7.24.1 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), KIN001.055 = c(1,
1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), KIN001.102 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), KIN001.236 = c(1,
1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), KIN001.244 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), KIN001.260 = c(1,
1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), KIN001.266 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), KIN001.270 = c(1,
1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), KU.55933 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1), LAQ824 = c(1,
1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), Lenalidomide = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), LFM.A13 = c(1,
1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1), LY317615 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), Masitinib = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), Methotrexate = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 1, 1, 1, 1), Olaparib.1 = c(1,
0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1), OSI.027 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), OSI.906 = c(1,
1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), OSI.930 = c(1,
1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1), OSU.03012 = c(1,
1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), PAC.1 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), Pazopanib = c(1,
1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1), PD.0325901 = c(1,
1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1), PD.0332991 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), PD.173074 = c(1,
1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0), PF.4708671 = c(1,
1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), PF.562271 = c(1,
1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1), PFI.1 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), PHA.793887 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), Phenformin = c(1,
1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1), PI.103 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), PIK.93 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), piperlongumine = c(1,
1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1), PLX4720 = c(1,
1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), PLX4720.rescreen. = c(1,
1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), PXD101.Belinostat = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), QL.X.138 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), QL.XI.92 = c(1,
1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1), QL.XII.47 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), QS11 = c(1,
1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), RDEA119 = c(1,
1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), RDEA119.rescreen. = c(1,
1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), RO.3306 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1), rTRAIL = c(1,
0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1), Ruxolitinib = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), SB.505124 = c(1,
1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1), SB.715992 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1), SB216763 = c(1,
1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), SB52334 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1), SB590885 = c(1,
1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), SGC0946 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1), Shikonin = c(1,
1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), SL0101.1 = c(1,
1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), SN.38 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), SNX.2112 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), STF.62247 = c(1,
1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1), T0901317 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), TAK.715 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), Tamoxifen = c(1,
1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), Temozolomide = c(1,
1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1), Temsirolimus = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), TG101348 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), Thapsigargin = c(1,
1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1), THZ.2.102.1 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), THZ.2.49 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), Tipifarnib = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1), TL.1.85 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), TL.2.105 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), TPCA.1 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), Trametinib = c(1,
1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1), TubastatinA = c(1,
1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1), UNC0638 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), UNC0638.1 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), UNC1215 = c(1,
1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), Vinblastine = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), Vinorelbine = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), Vismodegib = c(1,
1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1), VNLG.124 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), Vorinostat = c(1,
1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), VX.11e = c(1,
1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), VX.702 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), WZ3105 = c(1,
1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1), X.5Z..7.Oxozeaenol = c(1,
1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), X17.AAG = c(1,
1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), X5.Fluorouracil = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), X681640 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), XAV939 = c(1,
1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0), XL.184 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0), XL.880 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), XMD13.2 = c(1,
1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), XMD14.99 = c(1,
1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), XMD15.27 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), Y.39983 = c(1,
0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), YK4.279 = c(1,
1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), YM155 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), YM201636 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), Zibotentan.ZD4054 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), ZM.447439 = c(1,
1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), ZSTK474 = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)), row.names = c("BT-20",
"CAL-120", "CAL-51", "CAL-85-1", "DU-4475", "HCC1143", "HCC1187",
"HCC1395", "HCC1937", "HCC2157", "HCC38", "HDQ-P1", "Hs-578-T",
"MDA-MB-231", "MDA-MB-436", "MDA-MB-468", "MFM-223"), class = "data.frame")
Not really sure, because I did not fully understand your desired output...
But here is a go using the data.table-package
#load library
library(data.table)
#first, create the sample data
#note, rownames are stored in their own column, 'row_name'
dt <- fread("row_name ABT.263 ABT.869 ABT.888 AC220 Afatinib Afatinib.rescreen.
BT-20 1 1 1 1 0 1
CAL-120 0 1 1 1 1 1
CAL-51 1 1 1 1 1 1
CAL-85-1 1 1 1 1 1 0
DU-4475 0 1 1 1 1 1
HCC1143 1 1 1 1 0 1")
#melt the data to long format, using the 'row_name'-column as identifier
dt.melt <- melt( dt, id.vars = "row_name" )
#now summarise, pasting together row_names by variable-value combination
dt.melt[, .( row = paste0( row_name, collapse = ";" ) ),
by = .( value = paste0( variable, "_", value ) ) ]
# value row
# 1: ABT.263_1 BT-20;CAL-51;CAL-85-1;HCC1143
# 2: ABT.263_0 CAL-120;DU-4475
# 3: ABT.869_1 BT-20;CAL-120;CAL-51;CAL-85-1;DU-4475;HCC1143
# 4: ABT.888_1 BT-20;CAL-120;CAL-51;CAL-85-1;DU-4475;HCC1143
# 5: AC220_1 BT-20;CAL-120;CAL-51;CAL-85-1;DU-4475;HCC1143
# 6: Afatinib_0 BT-20;HCC1143
# 7: Afatinib_1 CAL-120;CAL-51;CAL-85-1;DU-4475
# 8: Afatinib.rescreen._1 BT-20;CAL-120;CAL-51;DU-4475;HCC1143
# 9: Afatinib.rescreen._0 CAL-85-1
A base R solution with a list of vectors is also possible:
Code:
names <- names(df)
#
l1 <- list()
for(i in 1:length(df)){
l1[[i]] <- rownames(df)[which(df[,names[i]] == 1)]
}
Result
l1
[[1]]
[1] "BT-20" "CAL-51" "CAL-85-1" "HCC1143"
[[2]]
[1] "BT-20" "CAL-120" "CAL-51" "CAL-85-1" "DU-4475" "HCC1143"
[[3]]
[1] "BT-20" "CAL-120" "CAL-51" "CAL-85-1" "DU-4475" "HCC1143"
[[4]]
[1] "BT-20" "CAL-120" "CAL-51" "CAL-85-1" "DU-4475" "HCC1143"
[[5]]
[1] "CAL-120" "CAL-51" "CAL-85-1" "DU-4475"
[[6]]
[1] "BT-20" "CAL-120" "CAL-51" "DU-4475" "HCC1143"
This is the list of names with 1 in the data.frame, the list of 0's could be obtained identically.

Summing in a list in dplyr

I have a tibble which has the date, day of the quarter, and a list of whether the days in quarter are sales days or not (1/0). I would like to sum the list of sales days (to get # of sales days left in the quarter) by summing from day_num to the end of sales_day_list So for the first day of Q2, 1993, I'd like to sum from 1:end of sales_day_list to get 64. On day 2, I'd like to sum from 2:end of sales_day_list etc.
Here is an example of my data (the output from dput)
my_data= structure(list(DW_DATE_ID = structure(c(733622400, 733708800,
733795200, 733881600, 733968000, 734054400), class = c("POSIXct",
"POSIXt"), tzone = "UTC"), day_num = 1:6, sales_day_list = list(
c(1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1,
1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0,
1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1,
0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1,
1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0), c(1, 0, 0,
1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1,
0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1,
1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1,
1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0,
0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0), c(1, 0, 0, 1, 1, 1,
1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1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 1, 1, 0))), row.names = c(NA,
-6L), class = c("tbl_df", "tbl", "data.frame"))
Upon inspection, the sales_day_list is the same for each row, which makes sense since the sales days shouldn't change throughout the quarter.
To solve this problem, get the day of the quarter and the sales days as vectors, then write a function to apply the sum across the sales days vector, subsetting it by the day of the quarter.
x <- my_data$day_num # days as vector
y <- my_data$sales_day_list[[1]] # can be any one of them
sapply(x, function(x){sum(y[x:length(y)])}) # desired output
You can assign the output of the last line back into your data frame.
First we can make a table of just the sales days, and count how many left in the qtr.
sales_days <- my_data[1,3] %>% # Grab row 1, column 3
tidyr::unnest() %>%
rename(sales_day = sales_day_list) %>%
mutate(day_num = row_number()) %>%
arrange(-day_num) %>%
mutate(remaining_sales = cumsum(sales_day)) %>%
arrange(day_num)
Then we can attach this to my_data:
my_data2 <- my_data[,1:2] %>%
left_join(sales_days)
head(my_data2)
# A tibble: 6 x 4
DW_DATE_ID day_num sales_day remaining_sales
<dttm> <int> <dbl> <dbl>
1 1993-04-01 00:00:00 1 1 64
2 1993-04-02 00:00:00 2 0 63
3 1993-04-03 00:00:00 3 0 63
4 1993-04-04 00:00:00 4 1 63
5 1993-04-05 00:00:00 5 1 62
6 1993-04-06 00:00:00 6 1 61

How to specify sampling weights (inverse probability weights) in a binomial mixed effect model or GEE

I'm looking at specifying inverse probability weights associated with each data point in a data frame (not analytical weights) for a mixed effect logistic regression for use vs. available GPS locations from animals. My question is closely related to this post: (Inverse probability weights in r), but for a mixed-effect model. The svyglm function specifies the correct weights, but the survey package doesn't allow for random effects, and lme4 uses analytical weights. I looked into the coxme package as an alternative but the help file indicates that weights are specified as per lm, which uses analytical weights.
Is there a package/function implemented in r to specify sampling weights for mixed effects, or a way to specify sampling weights using the coxme package?
example data:
data2 <- structure(list(Use = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0), Status = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), AnimalID = c(1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5), St.A1k = c(0.029627, 0.043414,
0.113816, 0.000000, 0.020241, 0.000000,0.000000, 0.007334, 0.000000,
0.046055, 0.028454, 0.042828, 0.018480, 0.106776, 0.018480, 0.046641,
0.033148, 0.039308, 0.035494, 0.000000, 0.004987, 0.051335, 0.046935,
0.018774, 0.000000, 0.043708, 0.014667, 0.080375, 0.000000, 0.015254,
0.000000, 0.053388, 0.055148, 0.036668, 0.006160, 0.016720, 0.029041,
0.057788, 0.023174, 0.022294, 0.031388, 0.043414, 0.005573, 0.000000,
0.024054,0.000000, 0.000000, 0.074215, 0.021121, 0.016720, 0.028454,
0.042828, 0.018480, 0.106776, 0.018480, 0.046641, 0.033148, 0.039308,
0.035494, 0.000000, 0.000000, 0.053388, 0.055148, 0.036668, 0.006160,
0.016720, 0.029041, 0.057788, 0.023174, 0.022294,0.031388, 0.043414,
0.005573, 0.000000, 0.024054, 0.000000, 0.000000, 0.074215, 0.021121,
0.016720, 0.029627, 0.043414, 0.113816, 0.000000, 0.020241, 0.000000,
0.000000, 0.007334, 0.000000, 0.046055, 0.029627, 0.043414, 0.113816,
0.000000, 0.020241, 0.000000, 0.000000, 0.007334, 0.000000, 0.046055),
InvWeight = c(1.332636, 1.248722, 1.248722, 1.248722, 1.179661, 1, 1, 1, 1,
1, 1.060296, 1.060296, 1.249593, 1.248595, 1.248626, 1, 1, 1, 1, 1,
1.294132, 1.740839, 1.740839, 2.377546, 2.377546, 1, 1, 1, 1, 1,
2.378091,2.378091, 2.378091, 2.378091, 1.060295, 1, 1, 1, 1, 1, 1.060296,
1.060296, 1.249593, 1.248595, 1.248626, 1, 1, 1, 1, 1, 2.378091, 2.378091,
2.378091, 2.378091, 1.060295, 1, 1, 1, 1, 1, 2.378091, 2.378091, 2.378091,
2.378091, 1.060295, 1, 1, 1, 1, 1, 1.294132,1.740839, 1.740839, 2.377546,
2.377546, 1, 1, 1, 1, 1, 1.332636, 1.248722, 1.248722, 1.248722, 1.179661,
1, 1, 1, 1, 1, 1.060296,1.060296, 1.249593, 1.248595, 1.248626, 1, 1, 1, 1,
1)),.Names = c("Use", "Status", "AnimalID", "St.A1k", "InvWeight"), class =
c("tbl_df", "tbl", "data.frame"), row.names = c(NA, -100L))
GLM with sampling weights
des2 <- svydesign(id = ~1, weights = ~InvWeight, data = data2)
glm.sampling.weights <- svyglm(Use ~ St.A1k, family = binomial, design=des2)
summary(glm.sampling.weights)
GLM (not sampling weights)
glm.w <- glm(Use ~ St.A1k, family = binomial, weight=InvWeight, data=data2)
summary(glm.w)
(from the glm help file: "For a binomial GLM prior weights are used to give the number of trials when the response is the proportion of successes").
GEE
cox.w <- coxme(Surv(Status,Use) ~ St.A1k + (1|AnimalID), weight=InvWeight,
data=data2)
summary(cox.w)

R error when trying to cluster data using pam (package cluster)

I am trying to run k-means clustering on a data set which was preprocessed (categorical to dummy, na cleaning etc.).
here is an extract (head) of the data:
dput(head(clustering.set.in))
structure(list(activity_type = c(1, 1, 1, 1, 1, 1), app_id.PXkw7OJ1se = c(0,
1, 1, 1, 1, 0), app_id.PXszbKVa5M = c(0, 0, 0, 0, 0, 0), app_id.PXw3GFQKBm = c(1,
0, 0, 0, 0, 0), browser_version = c(48, 42, 9, 9, 48, 44), continent.AS = c(0,
1, 1, 0, 0, 0), continent.EU = c(0, 0, 0, 0, 1, 0), continent.SA = c(0,
0, 0, 0, 0, 0), f_activex = c(1, 1, 1, 1, 1, 1), f_atob = c(2,
2, 2, 2, 2, 2), f_audio = c(2, 2, 2, 2, 2, 2), f_battery = c(2,
2, 1, 1, 2, 2), f_bind = c(2, 2, 2, 2, 2, 2), f_flash = c(1,
2, 2, 2, 2, 2), f_getComputedStyle = c(2, 2, 2, 2, 2, 2), f_matchSelector = c(2,
2, 2, 2, 2, 2), f_mimeTypes = c(2, 2, 2, 2, 2, 2), f_mimeTypesLength = c(0,
8, 11, 55, 7, 8), f_navigationTiming = c(2, 2, 1, 2, 2, 2), f_orientationEvents = c(2,
1, 1, 1, 1, 1), f_plugins = c(2, 2, 2, 2, 2, 2), f_pluginsLength = c(0,
6, 6, 15, 5, 6), f_raf = c(2, 2, 2, 2, 2, 2), f_resourceTiming = c(2,
2, 1, 1, 2, 2), f_sse = c(2, 2, 2, 2, 2, 2), f_webgl = c(1, 2,
2, 2, 2, 1), f_websql = c(1, 2, 2, 2, 2, 2), f_xdr = c(1, 1,
1, 1, 1, 1), n_appCodeName = c(2, 2, 2, 2, 2, 2), n_doNotTrack = c(2,
2, 1, 2, 2, 2), n_geolocation = c(2, 2, 2, 2, 2, 2), n_mimeTypes = c(2,
2, 2, 2, 2, 2), n_platform.iPhone = c(0, 0, 0, 0, 0, 0), n_platform.Linux.armv7l = c(1,
0, 0, 0, 0, 0), n_platform.MacIntel = c(0, 0, 1, 1, 0, 0), n_platform.Win32 = c(0,
1, 0, 0, 1, 0), n_plugins = c(2, 2, 2, 2, 2, 2), n_product.Sub20030107 = c(1,
1, 1, 1, 1, 1), n_product.Sub20100101 = c(0, 0, 0, 0, 0, 0),
n_product.Submissing = c(0, 0, 0, 0, 0, 0), os_family.Android = c(1,
0, 0, 0, 0, 0), os_family.iOS = c(0, 0, 0, 0, 0, 0), os_family.Mac.OS.X = c(0,
0, 1, 1, 0, 0), os_family.Windows = c(0, 1, 0, 0, 1, 0),
os_version = c(6, 8.1, 10, 10, 7, 0), site_history_length = c(31,
1, 1, 1, 1, 1), w_chrome...loadTimes....csi....app....webstore....runtime.. = c(0,
1, 0, 0, 1, 0), w_chrome...loadTimes....csi.. = c(0, 0, 0,
0, 0, 0), w_chrome... = c(1, 0, 1, 1, 0, 0), window_dimensions = c(2,
1, 2, 2, 2, 2), window_history = c(50, 1, 1, 1, 1, 3)), .Names = c("activity_type",
"app_id.PXkw7OJ1se", "app_id.PXszbKVa5M", "app_id.PXw3GFQKBm",
"browser_version", "continent.AS", "continent.EU", "continent.SA",
"f_activex", "f_atob", "f_audio", "f_battery", "f_bind", "f_flash",
"f_getComputedStyle", "f_matchSelector", "f_mimeTypes", "f_mimeTypesLength",
"f_navigationTiming", "f_orientationEvents", "f_plugins", "f_pluginsLength",
"f_raf", "f_resourceTiming", "f_sse", "f_webgl", "f_websql",
"f_xdr", "n_appCodeName", "n_doNotTrack", "n_geolocation", "n_mimeTypes",
"n_platform.iPhone", "n_platform.Linux.armv7l", "n_platform.MacIntel",
"n_platform.Win32", "n_plugins", "n_product.Sub20030107", "n_product.Sub20100101",
"n_product.Submissing", "os_family.Android", "os_family.iOS",
"os_family.Mac.OS.X", "os_family.Windows", "os_version", "site_history_length",
"w_chrome...loadTimes....csi....app....webstore....runtime..",
"w_chrome...loadTimes....csi..", "w_chrome...", "window_dimensions",
"window_history"), row.names = c(NA, 6L), class = "data.frame")
I am trying to cluster kmeans this data sets (k=2)
and getting error message:
Error in pam(clustering.set.in, k) :
negative length vectors are not allowed
my line of code:
pam(clustering.set.in, 2)
Any suggestions ?
it turns out that one column has na values in it.
Removed it with
new.data[is.na(new.data)] <- 1
and it seems to work fine now

Resources