[R] assigning suitability index value

Marna Wagley m@rn@@w@g|ey @end|ng |rom gm@||@com
Wed Aug 11 07:30:57 CEST 2021


Hi R Users,
I have two tables, one is temperature data (temp) and another table is a
suitability index. I wanted to assign the suitability index value in the
temperature data (temp) based on Table 2 (or graph, which is a suitability
curve), but I could not figure it out.
Are there any suggestions for me how I can assign the suitability index
value in table1 (temp) based on the suitability graph? I have a very big
data set but showing only a few data to illustrate the problem.

temp<-structure(list(X = c(1468285.96, 1468476.96, 1468479.96, 1468482.96,

1468485.96, 1468467.96, 1468470.96, 1468473.96, 1468476.96, 1468479.96,

1468482.96, 1468485.96, 1468458.96, 1468461.96, 1468464.96, 1468467.96,

1468470.96, 1468473.96, 1468476.96), Y = c(415099.27, 415096.27,

415096.27, 415096.27, 415096.27, 415093.27, 415093.27, 415093.27,

415093.27, 415093.27, 415093.27, 415093.27, 415090.27, 415090.27,

415090.27, 415090.27, 415090.27, 415090.27, 415090.27), temp = c(1.959473,

15.092773, 15.128174, 14.368896, 9.892578, 15.720215, 15.767822,

15.26001, 14.642334, 14.6521, 13.916016, 10.3479, 16.052246,

16.094971, 15.167236, 15.455322, 15.472412, 24.741211, 14.755859

)), class = "data.frame", row.names = c(NA, -19L))


print(temp)


table2<-structure(list(temp = c(0L, 10L, 15L, 17L, 25L, 30L), Index = c(0,

0.3, 1, 1, 0.5, 0)), class = "data.frame", row.names = c(NA,

-6L))

print(table2)


ggplot(data=table2, aes(x=temp, y=Index)) +

  geom_path()+

  geom_point()



# now I would like to assign the index value of table 2 into table 1
(temp), and I was looking for the following table as an output. The index
value in the output I put manually.


Output<-structure(list(X = c(1468285.96, 1468476.96, 1468479.96, 1468482.96,
 1468485.96, 1468467.96, 1468470.96, 1468473.96, 1468476.96, 1468479.96,

1468482.96, 1468485.96, 1468458.96, 1468461.96, 1468464.96, 1468467.96,

1468470.96, 1468473.96, 1468476.96), Y = c(415099.27, 415096.27,

415096.27, 415096.27, 415096.27, 415093.27, 415093.27, 415093.27,

415093.27, 415093.27, 415093.27, 415093.27, 415090.27, 415090.27,

415090.27, 415090.27, 415090.27, 415090.27, 415090.27), temp = c(1.959473,

0.092773, 15.128174, 14.368896, 9.892578, 15.720215, 15.767822,

15.26001, 14.642334, 14.6521, 13.916016, 10.3479, 16.052246,

16.094971, 15.167236, 15.455322, 15.472412, 24.741211, 14.755859

), index = c(0.012, 0.001, 1, 0.9, 0.31, 1, 1, 1, 0.91, 0.921,

0.824, 0.254, 1, 1, 1, 1, 1, 0.652, 0.93)), class = "data.frame", row.names
= c(NA,

-19L))


print(Output)


Thank you very much for your help.

MW

	[[alternative HTML version deleted]]



More information about the R-help mailing list