[R] data.frame to list
Larry Howe
linux at comjet.com
Wed Apr 5 03:23:31 CEST 2006
Hi,
I'm new to R, and I'm not a statistician (stunned silence). I am trying to do
the following:
1. read in a 2-column data file, e.g.
status new
db green
title "Most Significant Excursions"
2. end up with an R list such that I can write e.g.
lst$title
and have R return "Most Significant Excursions".
I know I could do this by coding
lst = list(title="Most Significant Excursions")
however I would like to populate the list at runtime from a data file. I have
tried
df = read.delim("params.txt", as.is=T)
and that gives me a data frame with the data in it. It seems to be a 2-element
list where the first element is the first column of data and the second
element is the second column of data. Not what I want.
Maybe this is a related question: what's the relation between names, dimnames,
row.name, and rownames? Is there any way to select records out of a data
frame or vector based on any of these attributes?
Thanks,
Larry Howe
More information about the R-help
mailing list