similar to: How to avoid ifelse statement converting factor to character

Displaying 12 results from an estimated 12 matches similar to: "How to avoid ifelse statement converting factor to character"

2009 Jun 23
2
Problem with ifelse statement
Hi R-helpers, I am trying to use this ifelse statement to recode a variable: > data$SOCIAL_STATUS<-ifelse(data$SOCIAL_STATUS=="B" & data$MALE>4, "C", "B") (i.e., if social status is B and there are more than 4 males, then recode social status to C; otherwise, leave it B) But, it's not working. See the below R output. Notice that there were 71
2012 Aug 20
7
relating data in two data frames
Hi, My data.frame "A" has FID like this FID a a b b b c c d d d d Now my second data.frame "B" has age value for a, b, c, d like FID Age a      5 b      7 c      9 d      3 How can search for the Age column in "B" and replace the values in "A" so that my new "A" looks like this FID Age a      5 a      5 b      7 b      7 b      7
2009 Jun 16
3
How to subset my dataframe? (a bit tricky)
Hi R-helpers, I would like to subset my dataframe, keeping only those rows which satisfy the following conditions: 1) the string "dnv" is found in at least one column; 2) the value in the column previous to the one "dnv" is found in is not "0" Here's what my data look like: ??? POND_ID 2009-05-07 2009-05-15 2009-05-21 2009-05-28 2009-06-04 4 ? ? ? 101 ? ? ?
2009 Jun 30
1
How to wrap my (working) code in a loop or function? (loop/function newbie alert)
Dear R-helpers, I have split a dataframe into a list with five elements, with the following code: > datalist<-split(data,data$UNIT) I would now like to run some code (below) on each element of the list to extract rows from the list elements; then I would like to rbind the extracted rows into a new dataframe containing all of the extracted rows from all of the list elements. I don't
2007 Jul 06
5
Clustering nested data
Hi all, I am interested in performing a cluster analysis on ecological data from forests in Pennsylvania. I would like to develop definitions for forest types (red maple forests, upland oak forests, etc.(AH AR in attached table)) based on measured attributes in each forest type. To do this, I would like to 'draw clusters' around forest types based on information from various tree
2007 Mar 28
1
Problem with adding packages to default start-up list
After reading the help files (?Startup) and using RSiteSearch("defaultPackages"), I have been trying to add several packages to my default startup list using the following code: local({ old<-getOption("defaultPackages") options(defaultPackages=c(old,"lattice","RODBC") }) Subsequently, when I query the default list using:
2009 Aug 28
1
Plotmath, sweave and lattice graphics interaction problem
Dear List, I have hit this problem with using a plotmath expression in an axis label on a lattice plot I'm including in a Sweave document. The actual document is far too long and boring (unless you are interested in the hydrochemistry of upland lakes) to include here, but the following minimal example reproduces the problem; basically, the PDF produced by Sweave has missing characters in the
2004 Aug 06
2
legalities of streaming
Basically, to legally broadcast music you must: A) Obtain permissions from the copyright holder (usually the publisher, record label) of the *composition*. ASCAP, BMI, and SESAC offer compulsory licenses for all of the artists they represent, fees based upon roughly how many listeners your station has & how many songs in your broadcast are by artists/composers they represent. B) Obtain
2012 Apr 01
4
map and shapefile help
Hi, I want to use map("state") and have the ecoregion shape (please see link) file projected onto this. ftp://ftp.epa.gov/wed/ecoregions/cec_na/NA_CEC_Eco_Level3.zip ftp://ftp.epa.gov/wed/ecoregions/cec_na/NA_CEC_Eco_Level3.zip Could someone please show me how; I have never messed with this sort of thing. Thanks. -- View this message in context:
2004 Mar 04
0
WSEAS NEWSLETTER in MECHANICAL ENGINEERING
If you want to contact us, the Subject of your email must contains the code: WSEAS CALL FOR PAPERS -- CALL FOR REVIEWERS -- CALL FOR SPECIAL SESSIONS wseas at canada.com http://wseas.freeservers.com **************************************************************** Udine, Italy, March 25-27, 2004: IASME/WSEAS 2004 Int.Conf. on MECHANICS and MECHATRONICS
2007 Mar 22
0
Racoon ERROR: Invalid CR type 0
SuSE10.2 Linux Kernel 2.6.18 Patched, Whenever I try to establish a connection raccoon fails giving the following error. Raccoon config ################# remote 67.101.176.*** { exchange_mode main,aggressive; doi ipsec_doi; situation identity_only; my_identifier address; send_cr off; send_cert off; lifetime time 2 min;
2007 Oct 05
0
Opening Scripts with long paths causes R 2.6.0 to crash
I am running R 2.6.0 on a PC running MS Windows 2000 Professional. After upgrading to this new version of R, I have been having problems opening scripts: opening certain scripts result in R crashing. After some experimentation, I discovered that it is a problem with the number of subdirectories in the path. For example, if the script is located in c:\Documents and