I'm looking for some help to create subsets using %like%
operator in R.
I have a table called 'pruebas1', which contains this information:
scenario_name | land_consumption | land_consumption_pct
Contención al 30% 692.00 11.081468525813
Contención al 50% 221.23 3.542703786613
Contención al 70% 94.98 1.520975451494
Contención al 95% 69.29 1.109583760966
And more rows. They share a pattern, the percentage value '30%', '50%'
I want to create a subset for each percentage value, and I tried to do it with this code:
for (i in 1:33){
if (prueba1$scenario_name %like% '%30%'){
esc_30[[i]]<-prueba1$scenario_name[[i]]
}
}
The result is an object with no data. I built this with a friend and we are new to this. As you can see we need help first to use correctly the %like%
operator and of course make a loop to create a subset for the different percentages values.
You can help us with specific links or help with the code directly.