knitr package kable command issue in Rscript

I am new to using Rstudio and my professor has been conducting a tutorial to make it more familiar to us. I have been following the tutorial. I have installed the package knitr and I have a data matrix called val_kat and I basically want to form a table from it. When I go to type the command 'kable(val_kat)' it shows me this error:
processing file: kpt_jeremy_is_early.qmd
2/3 [data_entry]

Quitting from lines 29-38 [data_entry] (kpt_jeremy_is_early.qmd)
Error in kable():
! could not find function "kable"
Execution halted

This is all the code I have typed:

title: "bio2020_kpt"
author: "Jeremy Isearly"
format: html
editor: visual
title-block-banner: true
title-block-modified: "Updated"
date: "2 June 2023"
date-modified: today
code-fold: true
toc: true
toc-depth: 4
number-sections: true
number-depth: 4

{r data_entry}
species <- c("Orobanche", "Pinus halpensis", "Oxalis pes-caprae", "Orchis nivalis", "Pistacia lentiscus")
family <- c("Orobanchaceae", "Pinaceae", "Oxalidaceae", "Orchidaceae", "Anacardiaceae")
lifeform <- c("Therophyte", "Phanerophyte", "Geophyte", "Geophyte", "Chamaephyte")
chorology <- c("Indigenous", "Alien", "Alien", "Indigenous", "Indigenous")

val_kat <- data.frame(species,family,lifeform,chorology)

Any help at all would be greatly appreciated I am completely new to R and please bear my lack of experience with it. Thank you in advance for any help!

depending on how you're kinting the code, you may need to include the command library(knitr).

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.