named
How do I extract just the number from a named number (without the name)?
For a single element like this, use [[ rather than [. Compare: coefficients(out)[“newx”] # newx # 1 coefficients(out)[[“newx”]] # [1] 1 More generally, use unname(): unname(coefficients(out)[c(“newx”, “(Intercept)”)]) # [1] 1.0 1.5 head(unname(mtcars)) # NA NA NA NA NA NA NA NA NA NA NA # Mazda RX4 21.0 6 160 110 3.90 2.620 16.46 0 … Read more