Go to Sign up
Note: Your files never leave your device. We don't upload, transfer, or store your data.
|
|
|
|
|---|---|---|
|
|
|
A DataFrame is the primary tabular data structure in R. It stores data in rows and columns where each column can hold a different data type — numeric, character, factor, logical, or Date. DataFrames are created using the data.frame() function and are the foundation for statistical modeling, data visualization, and machine learning in R.
When you convert Excel data to an R DataFrame, you get a ready-to-paste data.frame() constructor call that you can drop directly into R scripts, RMarkdown reports, or Shiny applications — no CSV import step required.
data.frame() Syntax at a Glance| Pattern | Example | Notes |
|---|---|---|
data.frame(col = values) | data.frame(Name = c("A", "B"), Age = c(30, 25)) | Column-wise vectors |
stringsAsFactors | data.frame(..., stringsAsFactors = TRUE) | Convert strings to factors (pre-4.0 default) |
row.names | row.names = c("r1", "r2") | Custom row labels |
str() | str(df) | Inspect structure and types |
Reproducible research — Embed data directly in RMarkdown or Quarto documents as a data.frame() call, ensuring the analysis is self-contained and reproducible.
Teaching and examples — Generate sample DataFrames from real Excel data for R tutorials, courses, and Stack Overflow answers.
Unit testing — Create test DataFrames from spreadsheet test cases for testthat or tinytest suites.
Avoid readxl dependency — Skip the library(readxl) + read_excel() step entirely by embedding the DataFrame inline.
Shiny apps — Pre-load reference or lookup data as static DataFrames inside Shiny application code.
Data migration — Move business data from Excel to R-based pipelines without intermediate CSV files.
Custom DataFrame name — Set the variable name for the generated R code (default: df).
Strings As Factors toggle — Enable to wrap character columns in factor(); disable to keep them as plain character vectors.
Row Names toggle — Enable to include row.names in the output, using the first column or auto-generated row indices.
Indentation control — Choose 2 spaces, 4 spaces, or tab indentation for the generated R code.
Drag-and-drop upload — Drop any .xlsx, .xls, or .xlsm file onto the upload zone.
Built-in table editor — Modify cell values, add or delete rows and columns, transpose, deduplicate, and apply case transformations before conversion.
Multi-sheet support — Switch between worksheets in multi-sheet workbooks via the sheet selector dropdown.
First Row as Header toggle — Control whether the first row is treated as column headers or regular data.
Find & Replace — Bulk-replace cell values with optional regex and case-sensitive matching.
Undo / Redo — Full edit history so you can revert mistakes.
Copy to clipboard — One-click copy of the generated R code.
100% client-side — Your spreadsheet data never leaves your device. No files are uploaded to any server.
Upload your file — Drag an .xlsx, .xls, or .xlsm file onto the upload area, or click Click here to choose to browse.
Edit if needed — Use the built-in table editor to modify values, add or remove rows and columns, transpose, deduplicate, or apply case changes.
Set the DataFrame name — Enter a variable name in the DataFrame Name field (e.g., employees, sales_data).
Configure options — Toggle Strings As Factors and Row Names as needed. Select your preferred Indent style.
Click Convert — Press the Convert button. The R data.frame() code appears in the Output Data area.
Copy the result — Click Copy to Clipboard and paste the R code into your script or RMarkdown file.
Input spreadsheet (employees.xlsx):
| Name | Department | Salary |
|---|---|---|
| Alice | Engineering | 95000 |
| Bob | Marketing | 72000 |
| Carol | Engineering | 102000 |
Generated R code (DataFrame Name: employees, Strings As Factors OFF, 2-space indent):
employees <- data.frame(
Name = c("Alice", "Bob", "Carol"),
Department = c("Engineering", "Marketing", "Engineering"),
Salary = c("95000", "72000", "102000"),
stringsAsFactors = FALSE
)
With Strings As Factors ON:
employees <- data.frame(
Name = factor(c("Alice", "Bob", "Carol")),
Department = factor(c("Engineering", "Marketing", "Engineering")),
Salary = c("95000", "72000", "102000"),
stringsAsFactors = FALSE
)
With Row Names ON:
employees <- data.frame(
Name = c("Alice", "Bob", "Carol"),
Department = c("Engineering", "Marketing", "Engineering"),
Salary = c("95000", "72000", "102000"),
row.names = c("1", "2", "3"),
stringsAsFactors = FALSE
)
| Aspect | data.frame | tibble (tidyverse) | data.table |
|---|---|---|---|
| Package | Base R (built-in) | tibble / dplyr | data.table |
| Print display | Full table | Truncated, types shown | First/last rows |
| Speed (large data) | Moderate | Moderate | Very fast |
| Partial matching | Yes (df$Na works) | No (strict) | No (strict) |
| Best for | General use, teaching | Tidyverse pipelines | Large datasets, aggregation |
This tool generates base R data.frame() code. To convert to a tibble, wrap the output: tibble::as_tibble(df). For data.table: data.table::as.data.table(df).
| Operation | Syntax | Result |
|---|---|---|
| Access column | df$Name or df[["Name"]] | Vector |
| Filter rows | df[df$Salary > 80000, ] | Subset DataFrame |
| Add column | df$Bonus <- df$Salary * 0.1 | Modified DataFrame |
| Summary stats | summary(df) | Min, median, max, etc. |
| Dimensions | nrow(df) / ncol(df) | Row / column count |
| Column names | colnames(df) | Character vector |
The tool accepts Microsoft Excel files in .xlsx, .xls, and .xlsm formats. LibreOffice and Google Sheets files exported as .xlsx also work.
No. All processing happens entirely in your browser using client-side JavaScript. Your file never leaves your device. There are no server uploads, transfers, or storage of any kind.
When enabled, character columns are wrapped in factor() in the generated R code. This is useful for statistical modeling where categorical variables should be treated as factors. When disabled (default since R 4.0), strings remain as character vectors.
When enabled, the output includes a row.names parameter in the data.frame() call, using sequential row indices. This is useful if you plan to reference rows by name rather than numeric index.
Yes. Enter any valid R variable name in the DataFrame Name field (e.g., sales_data, my_df, results). The default name is df.
Yes. After uploading, a full table editor appears. You can modify individual cells, add or delete rows and columns, transpose, deduplicate, apply case transformations (UPPERCASE, lowercase, Capitalize), and perform find-and-replace operations.
Yes. When your workbook contains multiple sheets, a dropdown selector appears in the editor header. Choose the sheet you want to convert.
Since processing is entirely client-side, the limit depends on your browser's memory. Most modern browsers handle workbooks with tens of thousands of rows without issues. For very large datasets, consider using R's readxl package directly.