search for: kkong

Displaying 3 results from an estimated 3 matches for "kkong".

Did you mean: kong
2009 Jul 24
2
How to find the min and max of two variables in a data frame
I have two variables in a data frame, I want to generate two additional variables. For every observations (i.e. every row), I want the first new variable 'min' to carry the minimum of the two existing variables, and I want the second new variable 'max' to carry the maximum of the two existing variables. I then want to sort the data frame by min and max, and delete duplicated rows
2009 Jul 22
3
How to use macro variable in a text string
I want to use read.table to input many files, each for a different year. I would like to use the macro variable 't' to refer to the exact file that I would like to input the data using read.table. How could I do this? Thank you! for (t in 1970:2005) { edge <- read.table(file="edge_t.csv", header=T, sep=",") ## I will have many rows of code following the
2009 Jul 22
1
How do I delete a row from a data frame when varA == "TRUE"
I want to delete a row from a data frame XYZ where A == "TRUE". Let's assume there are five variables in this data frame XYZ. My deletion is based on the TRUE vs. FALSE value under variable A. How do I do this? Thanks! My current code: for (i in 1:length(XYZ$A)) if (XYZ$A == "FALSE") XYZ<-XYZ else XYZ<- XYZ[-i,] Error message is: Error in if (XYZ$A ==