MediaWiki to R DataFrame Converter
Transform MediaWiki tables into R DataFrame code with automatic type detection
MediaWiki Input
R DataFrame Output
About MediaWiki to R DataFrame Converter
Convert MediaWiki table markup to R data frame code. Perfect for statistical analysis, data science workflows, and R programming with wiki data.
Key Features
- Automatic Type Detection: Infers column types (logical, integer, numeric, character)
- data.frame() Generation: Creates ready-to-run R code
- Column Name Sanitization: Converts headers to valid R variable names
- NA Handling: Properly handles missing values as NA
- MediaWiki Parser: Accurately parses MediaWiki table syntax
- Type Comments: Includes helpful comments about data types
- Copy & Download: Save as .R file for RStudio
How to Use
- Input MediaWiki Table: Paste your MediaWiki table markup or upload a .wiki file
- Review Output: The R DataFrame code generates automatically
- Copy or Download: Use the Copy or Download button to save your .R file
- Run in R: Execute the code in R, RStudio, or Jupyter notebooks
Type Detection
The converter automatically detects column types based on data values:
- logical: Values matching "TRUE" or "FALSE" (case-insensitive)
- integer: Whole numbers without decimal points
- numeric: Numbers with decimal points or scientific notation
- character: Text values (default type)
Example Conversion
MediaWiki Input:
{| class="wikitable" border="1"
! Name !! Age !! City !! Department
|-
| John Doe || 28 || New York || Engineering
|-
| Jane Smith || 34 || London || Marketing
|} R DataFrame Output:
# Rows: 2, Columns: 4
# Column types: Name (character), Age (integer), City (character), Department (character)
df <- data.frame(
Name = c("John Doe", "Jane Smith"),
Age = c(28, 34),
City = c("New York", "London"),
Department = c("Engineering", "Marketing"),
stringsAsFactors = FALSE
)
print(df) Common Use Cases
- Statistical Analysis: Import wiki data for R statistical analysis
- Data Science: Use wiki tables in data science workflows
- Machine Learning: Prepare wiki data for ML models in R
- Visualization: Create plots and charts with ggplot2
- Research: Analyze research data from wiki documentation
- Reporting: Generate reports with R Markdown
R DataFrame Features
- stringsAsFactors = FALSE: Prevents automatic factor conversion
- c() Vectors: Uses R's combine function for column data
- NA Values: Empty cells converted to NA
- Type Preservation: Maintains numeric and logical types
- Print Statement: Includes print(df) for immediate output
Column Name Sanitization
MediaWiki headers are automatically converted to valid R variable names:
- Replaces special characters with underscores
- Removes leading/trailing underscores
- Prefixes numbers with 'X' (e.g., "1st" becomes "X1st")
- Handles duplicate names with numeric suffixes (_2, _3, etc.)
- Generates default names (column_1, column_2) for empty headers
MediaWiki Table Syntax
Supports standard MediaWiki table markup:
- {|: Table opening with optional attributes
- ! Header: Exclamation mark for header cells (separated by !!)
- |-: Row separator
- | Data: Pipe for data cells (separated by ||)
- |}: Table closing
Using in R
- Copy or download the generated R code
- Open RStudio or R console
- Paste and run the code
- The data frame 'df' will be created and displayed
- Use df in your analysis, visualizations, or models
R Packages Compatibility
The generated data frames work seamlessly with popular R packages:
- dplyr: Data manipulation and transformation
- ggplot2: Data visualization and plotting
- tidyr: Data tidying and reshaping
- caret: Machine learning and modeling
- data.table: High-performance data operations
- rmarkdown: Dynamic reporting
Tips for Best Results
- Ensure MediaWiki table has clear header rows
- Use consistent data types within columns
- Avoid special characters in header names when possible
- Test with sample data before processing large tables
- Review column types in comments and adjust if needed
- Use stringsAsFactors = TRUE if you need factor columns
Privacy & Security
All conversions happen locally in your browser. Your MediaWiki data is never uploaded to any server, ensuring complete privacy and security.
