# Create a sequence of row labels row_labels <- paste0("R", sprintf("%02d", 1:10)) # Create an empty dataframe with the row labels new_df <- data.frame(matrix(nrow = length(row_labels), ncol = 0)) rownames(new_df) <- row_labels # Add a new column of random numbers to the dataframe new_df$numbers <- rnorm(length(row_labels)) # Print the new dataframe #new_df # Create a sequence of row labels #row_labels <- LETTERS[1:15] # Create an empty dataframe with the row labels #new_df <- data.frame(matrix(nrow = length(row_labels), ncol = 0)) #rownames(new_df) <- row_labels # Add a new column of random numbers to the dataframe #new_df$numbers <- rnorm(length(row_labels)) # Create a sequence of row labels row_labels <- LETTERS[1:15] # Create an empty dataframe with the row labels new_df <- data.frame(matrix(nrow = length(row_labels), ncol = 0)) rownames(new_df) <- row_labels # Add a new column of random numbers to the dataframe new_df$numbers <- rnorm(length(row_labels)) # Create a sequence of row labels row_labels <- paste0("R", sprintf("%02d", 1:15)) # Create an empty dataframe with the row labels new_df <- data.frame(matrix(nrow = length(row_labels), ncol = 0)) rownames(new_df) <- row_labels # Add a new column of random numbers to the dataframe new_df$numbers <- rnorm(length(row_labels)) # Add columns with the names "R01" through "R15" for (i in 1:length(row_labels)) { col_name <- paste0("R", sprintf("%02d", i)) new_df[[col_name]] <- rnorm(length(row_labels)) } # Print the new dataframe new_df