Constructing a new data frame by giving values row by row - R

0 votes
I would want to create a new data.frame by giving values row by row. Is that possible?
Jun 4, 2018 in Data Analytics by zombie
• 3,790 points
73 views

1 answer to this question.

0 votes

Create an empty data.frame first and then  give values to it by accessing the index value.

#Creating an empty datda.frame with 100 rows and 2 columns

My_Data<- data.frame(Numbers=rep(NA, 100), Names=rep("", 100),stringsAsFactors=FALSE)

#Now, go ahead and start giving the values by accesing the index value like this:

My_Data[i, ] <- list(10.7, "Spartaa!")
answered Jun 4, 2018 by Bharani
• 4,620 points

Related Questions In Data Analytics

+1 vote
2 answers

How to sort a data frame by columns in R?

You can use dplyr function arrange() like ...READ MORE

answered Aug 21, 2019 in Data Analytics by anonymous
• 32,910 points
565 views
0 votes
1 answer

How to convert a list to data frame in R?

Let's assume your list of lists is ...READ MORE

answered Apr 12, 2018 in Data Analytics by nirvana
• 3,150 points

edited Apr 12, 2018 by nirvana 18,400 views
0 votes
2 answers

How to remove rows with missing values (NAs) in a data frame?

Hi, The below code returns rows without ...READ MORE

answered Aug 20, 2019 in Data Analytics by anonymous
• 32,910 points
12,634 views
+1 vote
2 answers

How can I drop columns by name in a data frame ?

We can Drop Columns by name in ...READ MORE

answered Apr 13, 2018 in Data Analytics by zombie
• 3,790 points
17,175 views
+1 vote
1 answer

How to convert a list of vectors with various length into a Data.Frame?

We can easily use this command as.data.frame(lapply(d1, "length< ...READ MORE

answered Apr 4, 2018 in Data Analytics by DeepCoder786
• 1,720 points
516 views
0 votes
2 answers

In data frame how to spilt strings into values?

You can do this using dplyr and ...READ MORE

answered Dec 4, 2018 in Data Analytics by Kalgi
• 52,290 points
211 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Applying the same function to every row of a data.frame - R

You can use the 'appply()' function for ...READ MORE

answered May 22, 2018 in Data Analytics by Bharani
• 4,620 points
577 views
+1 vote
2 answers

Finding number of missing values and removing those missing values from a data-frame

To find number of missing values for ...READ MORE

answered Aug 14, 2019 in Data Analytics by anonymous
229 views