Dear R users;
I am trying to fill a column based on a specific value in another column of
a dataframe, but it seems there is a problem with the codes!
The "Layer" and the "LU" are two different columns of the dataframe.
How can I fix this?
Sincerely
for (i in 1:nrow(data2$Layer)){
if (d
Às 21:05 de 11/06/2023, javad bayat escreveu:
Dear R users;
I am trying to fill a column based on a specific value in another column of
a dataframe, but it seems there is a problem with the codes!
The "Layer" and the "LU" are two different columns of the dataframe.
How can I fix this?
Sincerely
Dear Rui;
Many thanks for your email. I used one of your codes,
"data2$LU[which(data2$Layer == "Level 12")] <- "Park"", and it works
correctly for me.
Actually I need to expand the codes so as to consider all "Levels" in the
"Layer" column. There are more than hundred levels in the Layer column.
If
Às 22:54 de 11/06/2023, javad bayat escreveu:
Dear Rui;
Many thanks for your email. I used one of your codes,
"data2$LU[which(data2$Layer == "Level 12")] <- "Park"", and it works
correctly for me.
Actually I need to expand the codes so as to consider all "Levels" in the
"Layer" column. There are
Às 13:18 de 11/06/2023, Rui Barradas escreveu:
Às 22:54 de 11/06/2023, javad bayat escreveu:
Dear Rui;
Many thanks for your email. I used one of your codes,
"data2$LU[which(data2$Layer == "Level 12")] <- "Park"", and it works
correctly for me.
Actually I need to expand the codes so as to conside
The problem being discussed is really a common operation that R handles
quite easily in many ways.
The code shown has way too many things that do not fit to make much sense
and is not written the way many R programmers would write it.
Loops like the one used are legal but not needed.
As has bee
6 matches
Mail list logo