python (65.1k questions)
javascript (44.2k questions)
reactjs (22.7k questions)
java (20.8k questions)
c# (17.4k questions)
html (16.3k questions)
r (13.7k questions)
android (12.9k questions)
Selecting Rows of Data Based on Multiple Conditions
I am working with the R programming language.
I have this dataset in R:
v <- c(1,2,3,4,5,6,7,8,9,10)
var_1 <- as.factor(sample(v, 10000, replace=TRUE, prob=c(0.1,0.1,0.1,0.1,0.1, 0.1,0.1,0.1,0....
stats_noob
Votes: 0
Answers: 1
R: Loops Containing Lists and Data Frames
I am working with the R programming language.
I wrote the following code for a loop that randomly sample integers (between 1-10) 5 times:
results <- list()
for (i in 1:5) {
n_1_i = sample(1:10, 1...
stats_noob
Votes: 0
Answers: 1
Convert multiple binary columns into crosstab
I am trying to convert the following dataset which has multiple binary variables into a crosstab.
df = pd.DataFrame({'colour_blue': [1, 0, 1], 'colour_green': [0, 1, 1],
'colour_red...
J.A.D
Votes: 0
Answers: 1
Multiple Replace/Lookups
I have the data below:
data_1 = data.frame(var1 = c("A", "B", "C"), var2 = c("A1", "A2", "A3"))
data_1$var1 = as.factor(data_1$var1)
data_1$...
stats_noob
Votes: 0
Answers: 1