All Questions
4 questions
1
vote
1
answer
16
views
Create a dataframe by fixing rows in one column and repeating other columns
Lets say I have three variables:
var1<-c(101,102,103,104)
var2<-c("AB","XY")
var3<-c(1,2)
X<-expand.grid(var1,var2,var3)
X
Above code gives this output
Var1 Var2 ...
2
votes
1
answer
3k
views
R data.table create from all combinations of multiple data.tables [duplicate]
I have:
require(data.table)
tblDT1 <- data.table(ID_1 = 1:2) # in reality, there are multiple columns per table
tblDT2 <- data.table(ID_2 = 3:4)
tblDT3 <- data.table(ID_3 = 5:6)
tblDT1
...
0
votes
1
answer
218
views
R merge data /expand data set
I'm trying to expand my data set using R. I have recorded the observations for each sample and calculated percentages based on those observations. I need now to expand each sample to list each ...
2
votes
1
answer
977
views
Reverse of aggregate / by?
I have a question and hope that some of you can help me. The issue is this: for a given data frame that includes a vector y of length n and a factor f with k different levels, I want to assign a new ...