0

I used

milsa <- edit(data.frame()) 

To open the R Data Editor and now I can type the data of my table. My problem is: my table has 36 rows, but for some reason I have 39 rows appearing in the program (the 3 additional rows are all filled with NA). When I try to use:

length(civil)

I'm getting 39 instead of 36. How can I solve this? I am trying to use fix(milsa) but it can't delete the additional rows.

PS: Civil is a variable of milsa.

1
  • Please save the RStudio tag for RStudio-specific problems, for example if you have R code that works on the R command line or R Gui, but doesn't work in RStudio. Commented May 18, 2018 at 18:41

2 Answers 2

1

Subset with the index:

You can reassign the data.frame to itself with only the rows you want to keep.

milsa <- milsa[1:36,]

Here is a LINK to a quick tutorial for your reference

Sign up to request clarification or add additional context in comments.

Comments

0

To delete specific rows

milsa <- milsa[-c(row_num1, row_num2, row_num3), ]

To delete rows containing one or more NA's

milsa <- na.omit(milsa)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.