3
I have two data frames:
Sexo <- rep(1:2 , length.out = 51)
Estudo <- rep(1: 17, length.out = 51)
Salário <- c(runif(51, min=900, max=3000))
data1 <- data.frame(Sexo, Estudo, Salário)
data2 <- data.frame(TaxaHomens = c(seq(0.1,0.99,length=17)),
TaxaMulheres = c(seq(0.2,0.99,length=17)),
Estudo = c(1:17))
The variable Sex in data1 is classified as 1 for men and 2 for women, Study corresponds to the person’s years of studies and salary to monthly earnings.
It is possible to create a column called Rate in the first data frame(data1) so that the rates of the second data frame are organized according to Sex and Study?
For example, in the new data1 column I want to have for Sex=1 and Study=3 a rate of 0.211250, for all such observations and so on.
When I use this solution in data frame I get the following answer: Error in
$<-.data.frame
(*tmp*
, "Desemp", value = c(NA, NA, NA, 0.0559149359202274 : Replacement has 4 Rows, date has 362555 -------- My data frame has more than 300000 lines so I think it doesn’t work.– Arthur Baldini