Search
 
SCRIPT & CODE EXAMPLE
 

R

predict in r stack

# Tmod, Tamb and GI are columns in the data frame data2
# Find the k coefficient to complete the equation
Model_Tmod <- nls(Tmod ~ Tamb + k * GI, data = data2, start=list(k=1))

k = coef(Model_Tmod)

And where ever there is an NA in Tmod column it gets filled with the predicted
data2$Tmod[is.na(data2$Tmod)] = data2$Tamb[is.na(data2$Tmod)] + k * data2$GI[is.na(data2$Tmod)]
Comment

PREVIOUS NEXT
Code Example
R :: get list of words that are in two lists using set 
R :: if condition is met skip to next iteration in a for loop in r 
R :: rename a variable in r 
R :: open xlsx with r 
R :: r remove column by index 
R :: remove name of a column 
R :: how to add columns to a flextable in r 
R :: detect factors in r 
R :: convert country code to country name in r 
R :: kable thousand mark 
R :: eleminating a char in of a list in r 
R :: How to create a new column with spark_apply 
R :: del row matrix r 
R :: diff division R 
R :: SSL certificate problem in R 
R :: rename vector in r 
R :: r runif 
Rust :: rust convertinging string to int 
Rust :: rust nesting and labels loop 
Rust :: String to int in Rust 
Rust :: rust error handling 
Rust :: rust variables in println 
Rust :: rust initialize empty array 
Rust :: rust lang expected item found let 
Rust :: lifetime may not live long enough 
Rust :: rust•armanriazi•type•wraper 
Rust :: update a value in hashmap in rust 
Rust :: split text on multiple separators and put into a list 
Lua :: roblox lua random number 
Lua :: luau loop all players 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =