Displaying 8 results from an estimated 8 matches for "olddf".
2005 Dec 07
4
Maintaining factors when copying from one data frame to another
...(because I know I've
encountered this in the past). My problem is:
I have a data frame with columns A, B, C, D, and E. A, B, and E are
factors and C and D are numeric. I need a new data frame with just A,
C, and D. When I copy these columns to a new data frame
>newDF <- data.frame(cbind(oldDF$A, oldDF$C, oldDF$D))
all the factor data comes out as levels rather than the original
factors. How do I preserve the factors when I copy from one data frame
to another?
Thanks vary much,
Kurt Wollenberg, Ph.D.
Tufts Center for Vision Research
Tufts-New England Medical Center
750 Washington St #...
2003 Apr 07
4
subsetting a dataframe
How does one remove a column from a data frame when the name of
the column to remove is stored in a variable?
For Example:
colname <- "LOT"
newdf <- subset(olddf,select = - colname)
The above statement will give an error, but thats what I'm trying to
accomplish.
If I had used:
newdf <- subset(olddf,select = - LOT)
then it would have worked, but as I said the column name is stored in a
variable
so I can't just enter it explicity.
Thanks.
2010 Jun 18
5
extract date time from a text file
I a have a text file where every line is like that:
"2007-12-03 13:50:17 Juan Perez"
("yy-mm-dd hh:mm:ss First Name Second Name")
I would like to make a data frame with two column one for date and the
other one for name.
When I use read.delim it was transformed in a data frame with 4 colums.
Bye,
Sebasti?n.
2006 Jul 21
1
insert insertRow?
Dear all,
In the search for a command to insert a row between other rows in a data
frame I found that there seems to be no such command in the base R
package. There is however a very simple function insertRow in the
micEcon package, that makes use of rbind. I wondered if it would not be
possible to include the following micEcon functions in the base package:
insertRow
insertCol
Since the
2006 Jul 21
1
insert insertRow?
Dear all,
In the search for a command to insert a row between other rows in a data
frame I found that there seems to be no such command in the base R
package. There is however a very simple function insertRow in the
micEcon package, that makes use of rbind. I wondered if it would not be
possible to include the following micEcon functions in the base package:
insertRow
insertCol
Since the
2008 Mar 06
2
Help with parsing a data file
Hi All,
I need to parse data from a file, example shown below. The first two lines
can be skipped, the third line contains the column names. The next 13 lines
can be skipped. The next line "1991" is a year value, with the following 13
values data for that year. The file then repeats this format with (year, 13
lines of data for that year). I would ideally like to end up with an
2007 Nov 09
3
Normalizing grouped data in a data frame
Hi
I am a newbie to R but have tried a number of ways in R to do this and
can't find a good solution. (I could do it out of R in perl or awk but
would like to know how to do this in R).
I have a large data frame 49 variables and 7000 observations however for
simplicity I can express it in the following data frame
Base, Image, LVEF, ES_Time
A, 1, 4.32, 0.89
A, 2, 4.98, 0.67
A, 3, 3.7, 0.5
2006 Sep 11
9
rename cols
A quick question please!
How do you rename column names? i.e. V1 --> Apple; V2 --> Orange, etc.
thx much
ej
[[alternative HTML version deleted]]