About this question
Don’t know how add a row to a dataframe in r.
Don’t know how add a row to a dataframe in r.
Log in to share your answer and help other learners.
Log in to answerBest Answer · By JanBask Data Science Expert
Answered on Jul 26, 2021
You can quickly append one or more rows to a data frame in R by using one of the following methods: Method 1: Use rbind() to append data frames. Method 2: Use nrow() to append a row.
Consider a dataSet i.e cicar(present under library MASS)
In order to load the dataset type following commands in R console
>library(MASS)
>cicar
So you have loaded dataset, cicar which is as follows:
Sex Bwt Hwt
1 M 3.0 7.0
2 F 2.0 8.4
3 F 1.0 9.5To add new Row
1) First create new row for dataFrame
> nRow <- data.frame(Sex=’F’,Bwt=2.1,Hwt=8.1)
>cicar <- rbind(cicar,nRow)Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.
Step-by-step Data Science guides from industry experts
Common Data Science interview questions, answered
Guides, tips and career advice on Data Science from JanBask experts.
Data Science The Best Data Science Projects (Beginner To Advanced)
Discover 15 data science project ideas from beginner to advanced levels. Includes tech stacks, time estimates, & real-use cases.…
Data Science Data Science vs Software Engineering - What you should know?
Compare Data Science vs. Software Engineering - explore skills, tools, roles, salaries, and career scope. Discover which tech…
Data Science Top 15 Deep Learning Algorithms You Must Know in 2025
Discover the top 15 deep learning algorithms powering AI in 2025. Learn how deep learning models, DL models, and deep machine…
Data Science Deep Learning Tutorial Guide for Beginners
Deep Learning, Machine Learning & Artificial Intelligence have become trending words of the IT sector today.