Hello everyone!
A simple question (I'm not sure about the answer):
How can I give a name to my data.frame from a character vector of names?
For example, each data.frame is a table of results for a subject and I have a vector of subject names like
b <- c("math", "geography", "history")
How do I create a data.frame named "math" by calling b[1]?
I'm importing data via RODBC in one big loop for all subjects and
I want them separated so I'll be able to load them one at a time later on.
Thanks for your help,
Gasper
Gasper Cankar
National Examinations Centre
Slovenia
+386 1 54 84 682
gasper.cankarATric.si
name of object from character vector
2 messages · Gasper Cankar, Dimitris Rizopoulos
look at "?assign", e.g.,
b <- c("math", "geography", "history")
assign(b[1], data.frame(x=rnorm(5), y=rnorm(5)))
math
I hope it helps.
Best,
Dimitris
----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat/
http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm
----- Original Message -----
From: "Gasper Cankar" <gasper.cankar at ric.si>
To: <r-help at stat.math.ethz.ch>
Sent: Friday, March 11, 2005 10:00 AM
Subject: [R] name of object from character vector
Hello everyone!
A simple question (I'm not sure about the answer):
How can I give a name to my data.frame from a character vector of
names?
For example, each data.frame is a table of results for a subject and
I have a vector of subject names like
b <- c("math", "geography", "history")
How do I create a data.frame named "math" by calling b[1]?
I'm importing data via RODBC in one big loop for all subjects and
I want them separated so I'll be able to load them one at a time
later on.
Thanks for your help,
Gasper
Gasper Cankar
National Examinations Centre
Slovenia
+386 1 54 84 682
gasper.cankarATric.si
______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html