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,690 points
14 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,550 points

Related Questions In Data Analytics

0 votes
1 answer

How to sort a data frame by columns in R?

You can just use the order function ...READ MORE

answered Apr 10, 2018 in Data Analytics by darklord
• 6,140 points
74 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,060 points

edited Apr 12, 2018 by nirvana 1,886 views
0 votes
1 answer

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

You can use complete.cases in the following ...READ MORE

answered Apr 13, 2018 in Data Analytics by darklord
• 6,140 points
3,762 views
0 votes
1 answer

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,690 points
29 views
0 votes
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,700 points
47 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
• 37,430 points
39 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,550 points
32 views
+1 vote
1 answer

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

This code gives the total number of ...READ MORE

answered Mar 27, 2018 in Data Analytics by Bharani
• 4,550 points
27 views