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.
--
View this message in context: http://r.789695.n4.nabble.com/NA-in-last-row-while-reading-xlsx-file-tp3762119p3762119.html
Sent from the R help mailing list archive at Nabble.com.
NA in last row while reading xlsx file
3 messages · ashz, Jean V Adams, David Winsemius
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110823/25aa57ce/attachment.pl>
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