On Aug 23, 2011, at 8:21 AM, Jean V Adams wrote:

ashz wrote on 08/23/2011 03:25:57 AM:

Hi,

I am using this script to read a xlsx file to a data frame:
library(xlsx)
File <- file.path("d:", "car ", "car95-99.xlsx")
B_car <- read.xlsx(File, "raw_data")
Car2x <- data.frame(month = B_car$Date,Ch = B_car$Ch.des,
lat=B_car$Latitude)

The last row in the data.frame is always NA, how can I remove it?

Thx.


Sometimes there is an invisible something in a row of data in Excel ... a blank space, a formatting something, i don't know ... that causes this to happen. Open the file in Excel, select the entire row (by clicking on the row number), right click for a menu, select "Delete", then save the file
and try your R script again.  It might work.

OR:  Assuming you want to remove the entire row :

Car_C <- Car_B[-nrow(Car_B), ]

--
David Winsemius, MD
West Hartford, CT

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to