

Run the above code in R, and you’ll get the same results: Name Age

You can achieve the same outcome by using the second template (don’t forget to place a closing bracket at the end of your DataFrame – as captured in the third line of the code below): df <- ame(Name = c("Jon", "Bill", "Maria", "Ben", "Tina"), The values in R match with those in our dataset. Once you run the above code in R, you’ll get this simple DataFrame: Name Age Note that it’s necessary to place quotes around text (for the values under the Name column), but it’s not required to use quotes around numeric values (for the values under the Age column). Using the first template that you saw at the beginning of this guide, the DataFrame would look like this: Name <- c("Jon", "Bill", "Maria", "Ben", "Tina") The goal is to capture that data in R using a DataFrame. Let’s start with a simple example, where the dataset is: Name Next, you’ll see how to apply each of the above templates in practice. )ĭf <- ame(first_column, second_column)Īlternatively, you may apply this syntax to get the same DataFrame: df <- ame (first_column = c("value_1", "value_2". Generally speaking, you may use the following template in order to create a DataFrame in R: first_column <- c("value_1", "value_2".
