[R] Data format question for triangle.plot package ade4

David Winsemius dwinsemius at comcast.net
Fri Jul 9 15:27:05 CEST 2010


On Jul 8, 2010, at 4:41 PM, Steve_Friedman at nps.gov wrote:

>
>
> hello,
>
> I am trying to develop a triangle plot but am having difficultly  
> assigning
> the row.names to the 3 columns in the data.frame
>
> Here is what I've done,
>
> attach(SoilVegHydro)
>
> dim(SoilVegHydro)
> 1292    39
>
> # now  take 3 variables from main data.frame for plotting
>
> dat <- cbind.data.frame(TP, meanAnnualDepthAve, BulkDensity)  #   
> These are
> variables held in the data frame SoilVegHydro

Did that "dat" object have what you wanted? The function call did not  
make any reference to SoilVegHydro. What does str(dat) return? Oh,  
never mind, I now see you use attach.

>
> row.names(dat) <- paste(row.names(SoilVegHydro$Physiogomy),

Generally row.names is used on a dataframe rather than on a column  
vector.

 > dat <- data.frame(1:3, LETTERS[1:3])
 > row.names(dat$X1)
 > row.names(dat)
[1] "1" "2" "3"
 > length(row.names(dat$X1))
[1] 0


> rep(c(1,2,3),
> rep(1292, 3)), sep =" ")  # following the syntax from the help
> triangle.plot page
>
> this is returned when the last line is submitted.
>
> row.names(dat) <- paste(row.names(SoilVegHydro$Physiogomy),  
> rep(c(1,2,3),
> rep(1292,3)), sep="")
> Error in `row.names<-.data.frame`(`*tmp*`, value = c("1", "1", "1",  
> "1",  :
>  invalid 'row.names' length
>
> I'm not certain how to define the row.names .  If anyone can help I'd
> appreciate it.
>
> I'm using R 2.11.1 (2010-5-31) on Windows XP
>
> Thanks
> Steve
>
>
> Steve Friedman Ph. D.
> Spatial Statistical Analyst
> Everglades and Dry Tortugas National Park
> 950 N Krome Ave (3rd Floor)
> Homestead, Florida 33034
>
> Steve_Friedman at nps.gov
> Office (305) 224 - 4282
> Fax     (305) 224 - 4147
>
> ______________________________________________
> R-help at 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.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list