List into table
On Jun 5, 2013, at 1:49 AM, Andtrei89 wrote:
Hi everyone,
I want to open an XML file in R and it also works.
But then I get a list of all numbers but it isn't in the type of "numeric".
I tried this:
exampleData <-
"C:/Users/Andreas/Desktop/Thesis/Interzeptionsmodell/Daten/Karlsruhe/Windgeschwindigkeit/1948.xml"
F <- system.file("exampleData", "1948.xml", package = "XML")
f <- xmlToDataFrame(exampleData, colClasses = NULL, homogeneous = TRUE,
collectNames = TRUE,
stringsAsFactors = default.stringsAsFactors())
I got this:
You got that when you did ? what?
1 4.9 5.0 5.3 4.4 2.9 1.9 1.1 1.5 1.6 1.2 0.7 0.8 2.5 2.3 1.6 0.6 1.3 0.8 1.3 1.2 3.9 5.0 6.4 6.3 8.4 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 1 8.4 8.3 8.3 9.1 8.3 7.7 6.8 5.4 4.8 3.6 3.6 3.5 2.6 3.5 3.0 3.1 2.4 3.4 3.3 4.8 6.1 5.1 4.2 4.5 4.5 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 1 5.4 4.7 4.6 3.8 4.0 1.5 0.0 1.1 0.7 0.0 0.0 1.3 1.5 1.6 0.0 0.7 0.6 0.5 1.8 1.5 1.6 1.5 1.9 2.5 2.5 I only want the numbers out of it as numeric ... if I try as.numeric() I got a list looking like that:
Probably not a "list". Probably a vector of indexes into a set of factor levels.
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 .......... I would be very thankful for your answer
Hard to know for sure, but try reading the FAQ regarding proper conversion of factor varibles to numeric and following its advice.
-- View this message in context: http://r.789695.n4.nabble.com/List-into-table-tp4668693.html
Posting from Nabble is likely to cause you problems at some point or another due to the tightened spam filters.
Sent from the R help mailing list archive at Nabble.com.
Nabble is not an archive and it is not the R mailing list.
David Winsemius Alameda, CA, USA