我想改变下表中 m 和 n 的值。 具体在第二列。我附上一张它的样子的图片。 我该怎么办?
这些是代码:
library(grid)
library(gridExtra)
n <- round(runif(1, 3, 10))
m <- round(runif(1, 11, 18))
intervalos17 <- c( paste0("x<",n) ,paste0("{", n, c( paste0( "<=x}<" )) ,m ), paste0("x>=",m))
prueba17 <- c(0, "frac(x-n, m-n)", 1 )
<<echo=FALSE, results=hide, fig=TRUE,width=5.5,height=3>>=
tablasolucion <-data.frame (intervalos17 , prueba17)
colnames (tablasolucion) <-c( "x" , 'F(x)' )
tt <- ttheme_default(core = list(fg_params = list(parse=TRUE)),colhead=list(fg_params = list(parse=TRUE)))
grid.newpage()
grid.table(tablasolucion, rows = NULL, theme=tt)
@
像这样吗?
library(grid)
library(gridExtra)
# Generate random n and m
n <- round(runif(1, 3, 10))
m <- round(runif(1, 11, 18))
# Create intervals with numeric values
intervalos17 <- c(paste0("x<", n),paste0(n, "<=x<", m),paste0("x>=", m))
# Create the fraction with ACTUAL n and m values
prueba17 <- c(0, paste0("frac(x-", n, ", ", m-n, ")"),1)
# Create and display the table
tablasolucion <- data.frame(intervalos17, prueba17)
colnames(tablasolucion) <- c("x", "F(x)")
tt <- ttheme_default(core = list(fg_params = list(parse=TRUE)), colhead = list(fg_params = list(parse=TRUE)))
grid.newpage()
grid.table(tablasolucion, rows = NULL, theme=tt)