[R] sorting a data.frame (df) by a vector (which is not contained in the df) - unexpected behaviour of match and factor

2011-12-29 Thread drflxms
Dear R colleagues, consider my data.frame named df with 3 columns - being level, prevalence and sensitivity - and 7 rows of data (see dump below). df - structure(list(level = structure(1:7, .Label = c(0, 1, 10, 100, 1010, 11, 110), class = factor), prevalence = structure(c(4L, 2L, 3L, 5L, 6L,

Re: [R] sorting a data.frame (df) by a vector (which is not contained in the df) - unexpected behaviour of match and factor

2011-12-29 Thread Jeff Newmiller
Your desiredOrder vector is a vector of strings. Convert it to numeric and it should work. --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.

Re: [R] sorting a data.frame (df) by a vector (which is not contained in the df) - unexpected behaviour of match and factor

2011-12-29 Thread drflxms
Jeff, thanks a lot for your quick reply and the hint! Meanwhile I found a solution that works - at least for my case ;) The code to get the job done is df[order(match(df$level,desiredOrder)),] So we seem in need of one order statement more. I found this solution doing it stepwise: ## sorting

Re: [R] sorting a data.frame (df) by a vector (which is not contained in the df) - unexpected behaviour of match and factor

2011-12-29 Thread Berend Hasselman
drflxms wrote Dear R colleagues, consider my data.frame named df with 3 columns - being level, prevalence and sensitivity - and 7 rows of data (see dump below). df - structure(list(level = structure(1:7, .Label = c(0, 1, 10, 100, 1010, 11, 110), class = factor), prevalence =

Re: [R] Contingency tables example

2011-12-29 Thread VictorDelgado
sambooth21 wrote I am having a few problems importing the data i'm running this code and the table sets up fine but all of the data values say NA: housdat- c(21, 21, 28, 14, 19, 37, 34, 22, 36, 17, 23, 401, 10, 11, 36, 3, 5, 23, 61, 23, 17, 78, 46, 43, 43, 35, 40, 48, 45, 86, 26, 18, 54,

Re: [R] Contingency tables example

2011-12-29 Thread VictorDelgado
sambooth21 wrote And I just don't know where to start, if anyone could help this would be greatly appreciated look for ?anova - Victor Delgado cedeplar.ufmg.br P.H.D. student www.fjp.mg.gov.br reseacher -- View this message in context:

[R] problem of constrOptim.nl, no hessian and convergence

2011-12-29 Thread Ravi Varadhan
Hi, Use the `auglag' function in alabama if you want to get the Hessian at convergence. This typically tends to perform better than `constrOptim.nl'. Also, `constrOptim.nl' does not compute the Hessian. You should not specify method=L-BFGS-B. The default method BFGS is better in this

Re: [R] 3d plotting alternatives. I like persp, but regret the lack of plotmath.

2011-12-29 Thread David Winsemius
I'm not sure it is entirely responsive to the request, but I did hash out a way to add axis labels to car::scatter3d plots. There a worked example on SO: http://stackoverflow.com/questions/8204972/carscatter3d-in-r-labeling-axis-better/8206320#8206320 The SO screenshot won't show that fact

Re: [R] Census ARIMA x-12 seasonal adjustment in R?

2011-12-29 Thread Tony . CTR . Choi
Thanks David and everyone for the help. I do see x12 under the RsiteSearch and will test it to see if it works for what I need to do. Happy new year! Tony From: David Winsemius dwinsem...@comcast.net To: Duncan Murdoch murdoch.dun...@gmail.com Cc: Tony CTR Choi/AWA/CNTR/FAA@FAA,

[R] Reg : Encoding information in PMML generated from R

2011-12-29 Thread Raji
Hi , I am trying to get the PMML for a Decision tree model (using rpart) . The PMML generated from R does not contain the encoding information similar to *?xml version=1.0 encoding=UTF-8 standalone=no?*. The PMML generated from R starts as PMML version=3.2 xmlns=http://www.dmg.org/PMML-3_2;

[R] 3d plotting alternatives. I like persp, but regret the lack of plotmath.

2011-12-29 Thread Paul Johnson
I have been making simple functions to display regressions in a new package called rockchalk. For 3d illustrations, my functions use persp, and I've grown to like working with it. As an example of the kind of things I like to do, you might consult my lecture on multicollinearity, which is by far

Re: [R] Contingency tables example

2011-12-29 Thread jim holtman
Without giving help on a potential homework problem, I would suggest that after each step you examine the object you are creating/modifying. This is a basic debugging technique that will help you out in the future. If you have a multi-step problem (as almost all are), then you may have to go

Re: [R] Contingency tables example

2011-12-29 Thread David Winsemius
On Dec 29, 2011, at 7:15 AM, sambooth21 wrote: I am having a few problems importing the data i'm running this code and the table sets up fine but all of the data values say NA: housdat- c(21, 21, 28, 14, 19, 37, 34, 22, 36, 17, 23, 401, 10, 11, 36, 3, 5, 23, 61, 23, 17, 78, 46, 43, 43,

Re: [R] large data set (matrix) using image()

2011-12-29 Thread Uwe Ligges
Works perfectly well with R-2.14.1 32-bit on a Windows device. Since you have not followed the posting guide and forgot to give details about your platform, there is not much we can do. Uwe Ligges On 22.12.2011 23:08, Karen Liu wrote: When I use the image() function for a relatively small

[R] Is it possible to right align text in R graphics?

2011-12-29 Thread Tal Galili
Hello all, The following line of code includes a right-to-left language text, yet the R graphics engine displays it from left to right. One problem this causes is when there are parenthesis in the test, here is a basic example? plot(1:10, main = שלום (טקסט)) Is there a way to make sure

Re: [R] folders of path - platform independent (repost)

2011-12-29 Thread Ben quant
Oops. I guess I stopped reading about the fsep param when I saw PATH and R_LIB because I'm not interested in those. I didn't get to the part I was interested in. Thanks! Ben On Wed, Dec 28, 2011 at 5:33 PM, David Winsemius dwinsem...@comcast.netwrote: On Dec 28, 2011, at 5:57 PM, Ben quant

Re: [R] Contingency tables example

2011-12-29 Thread sambooth21
I am having a few problems importing the data i'm running this code and the table sets up fine but all of the data values say NA: housdat- c(21, 21, 28, 14, 19, 37, 34, 22, 36, 17, 23, 401, 10, 11, 36, 3, 5, 23, 61, 23, 17, 78, 46, 43, 43, 35, 40, 48, 45, 86, 26, 18, 54, 15, 25, 62)

Re: [R] mtrace function

2011-12-29 Thread Uwe Ligges
This is something you should report to the maintainer. I tried to reproduce (never using that package myself), and got when trying the examples from ?mtrace: library(debug) mtrace(glm) # turns tracing on Loading required package: parser Loading required package: Rcpp Error in numbered.id[n] -

Re: [R] rJava and JRI

2011-12-29 Thread Uwe Ligges
See http://www.rforge.net/rJava/ and http://www.rforge.net/JRI/ Uwe Ligges On 29.12.2011 07:46, PermataRussiana wrote: Dear All, I am writing R code and I want to interface with JAVA using netbeans. I want to call R from JAVA. What i should pick?rJAVA or JRI? and can someone provide

Re: [R] Gale-Shapley Algorithm for R

2011-12-29 Thread VictorDelgado
VictorDelgado wrote Dear R-helpers, I'm not a speciallist in writing complex functions, and the function still very rusty (any kind of suggestions are very welcome). I want to implement Gale-Shapley algorithm for R Language. It is based on http://www.jstor.org/stable/10.2307/2312726

Re: [R] sorting a data.frame (df) by a vector (which is not contained in the df) - unexpected behaviour of match and factor

2011-12-29 Thread Berend Hasselman
drflxms wrote Jeff, thanks a lot for your quick reply and the hint! Meanwhile I found a solution that works - at least for my case ;) The code to get the job done is df[order(match(df$level,desiredOrder)),] So we seem in need of one order statement more. I found this solution

Re: [R] R Commander options

2011-12-29 Thread John Fox
Dear Michael, This ended up being more of a mess than I anticipated, but I think that I now have font selection working as advertised on both Windows and Mac OS X. I don't have a convenient Linux system to test on at the moment, but the Rcmdr should behave on Linux as on Mac OS X. (1) The

Re: [R] 3d plotting alternatives. I like persp, but regret the lack of plotmath.

2011-12-29 Thread Duncan Murdoch
On 11-12-29 1:01 PM, Paul Johnson wrote: I have been making simple functions to display regressions in a new package called rockchalk. For 3d illustrations, my functions use persp, and I've grown to like working with it. As an example of the kind of things I like to do, you might consult my

Re: [R] Custom XML Readers

2011-12-29 Thread pl.r...@gmail.com
I found the source of the error, in my XML document there are some costume tags such us response doc if I change those tags to lst the code work. One other source of error is when the text does not fit on to one line such as: str name=quot;fulltextquot; MORGANZA, La. (AP) -- Federal officials

[R] [newbie] read row from file into vector

2011-12-29 Thread Tom Roche
summary: how to read a row (not column) from a file into a vector (not a data frame)? details: I'm using $ lsb_release -ds Linux Mint Debian Edition $ uname -rv 3.0.0-1-amd64 #1 SMP Sun Jul 24 02:24:44 UTC 2011 $ R --version R version 2.14.1 (2011-12-22) I'm new to R (having previously used

Re: [R] Custom XML Readers

2011-12-29 Thread pl.r...@gmail.com
I found the source of the error, in my XML document there are some costume tags such us response doc if I change those tags to lst the code work. One other source of error is when the text does not fit on to one line such as: str name=fulltext MORGANZA, La. (AP) -- Federal officials say they are

[R] Array element is function of its position in the array

2011-12-29 Thread Asher Meir
I want to create a new array which selects values from an original array based on a function of the indices. That is: I want to create a new matrix Vnew[i,j,k]=Vold[i,j,ks] where ks is a function of the index elements i,j,k. I want to do this WITHOUT a loop. Call the function ksfunction, and the

Re: [R] [newbie] read row from file into vector

2011-12-29 Thread Duncan Murdoch
On 11-12-29 3:51 PM, Tom Roche wrote: summary: how to read a row (not column) from a file into a vector (not a data frame)? details: I'm using $ lsb_release -ds Linux Mint Debian Edition $ uname -rv 3.0.0-1-amd64 #1 SMP Sun Jul 24 02:24:44 UTC 2011 $ R --version R version 2.14.1

Re: [R] [newbie] read row from file into vector

2011-12-29 Thread William Dunlap
Look into connection objects, which let you open a file or other readable sort of thing and read it piece by piece. E.g., the following function opens your file (making a file connection), skips some lines, reads the desired line into a character object, then reads from that character object (as

Re: [R] Array element is function of its position in the array

2011-12-29 Thread Greg Snow
Does vnew - vold[,,ks] accomplish what you want? -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Asher Meir

Re: [R] [newbie] read row from file into vector

2011-12-29 Thread Greg Snow
The scan function can be used to read a single row. If your file has multiple rows you can use the skip and nlines arguments to determine which row to read. With the what argument sent to a single item (a number or string depending on which you want) it will read each element on that row into

Re: [R] Is it possible to right align text in R graphics?

2011-12-29 Thread Jean V Adams
Tal Galili wrote on 12/29/2011 10:52:55 AM: Hello all, The following line of code includes a right-to-left language text, yet the R graphics engine displays it from left to right. One problem this causes is when there are parenthesis in the test, here is a basic example? plot(1:10,

Re: [R] Is it possible to right align text in R graphics?

2011-12-29 Thread Tal Galili
Thank you for the reply Jean, but no, it would not fix it :) plot(1:10, main=rev.string(שלום (עולם))) What would fix it is if I had added a number after the parenthesis, but that is a hack, not a solution... plot(1:10, main=שלום (עולם) 1) Contact

Re: [R] Array element is function of its position in the array

2011-12-29 Thread Jean V Adams
Asher Meir wrote on 12/29/2011 02:58:00 PM: I want to create a new array which selects values from an original array based on a function of the indices. That is: I want to create a new matrix Vnew[i,j,k]=Vold[i,j,ks] where ks is a function of the index elements i,j,k. I want to do this

Re: [R] Is it possible to right align text in R graphics?

2011-12-29 Thread Bert Gunter
Tal: Does the adj argument for ?par (and also in text()) not do this for you? Incidentally, gMail (on Windows) correctly rendered the Hebrew (Shalom Olam), so it would seem that this probably is a plotting issue rather than an OS issue. However, I confess that my knees turn to jelly with

Re: [R] [newbie] read row from file into vector

2011-12-29 Thread Rui Barradas
Tom Roche wrote summary: how to read a row (not column) from a file into a vector (not a data frame)? details: I'm using $ lsb_release -ds Linux Mint Debian Edition $ uname -rv 3.0.0-1-amd64 #1 SMP Sun Jul 24 02:24:44 UTC 2011 $ R --version R version 2.14.1 (2011-12-22) I'm

Re: [R] [newbie] read row from file into vector

2011-12-29 Thread Tom Roche
Tom Roche 11-12-29 3:51 PM E.g., for a file such that $ head -n 2 ~/data/foo.csv | tail -n 1 5718,0.3,0.47,0,0,0,0,0,0,0,0,0.08,0.37,0,0,0.83,1.55,0,0,0,0,0,0,0,0,0,0.00,2.48,2.33,0.17,0,0,0,0,0,0,0.00,10.69,0.18,0,0,0,0 I'd like to be able to populate a vector 'v' s.t. v[1]=5718, ...

Re: [R] [newbie] read row from file into vector

2011-12-29 Thread Daniel Nordlund
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Tom Roche Sent: Thursday, December 29, 2011 2:08 PM To: r-help@r-project.org Subject: Re: [R] [newbie] read row from file into vector Tom Roche 11-12-29 3:51 PM E.g., for a

[R] Applyiing mode() or class() to each column of a data.frame XXXX

2011-12-29 Thread Dan Abner
Hi everyone, I am attempting to use the apply() function to obtain the mode and class of each column in a data frame, however, I am encountering unexpected results. I have the following example data: v13-1:6 v14-c(1,2,3,3,NA,1) v15-c(Good,Bad,NA,Good,Bad,Bad) f4-factor(rep(c(Blue,Red,Green),2))

Re: [R] Array element is function of its position in the array

2011-12-29 Thread Jean V Adams
Asher Meir asher.m...@gmail.com wrote on 12/29/2011 04:47:21 PM: Hello Jean. Thank you for your prompt response. I have an economic model. I start out with a list of asset levels 1:nks. For every asset level, a person has nis possible income levels and njs possible expense levels, with

Re: [R] Applyiing mode() or class() to each column of a data.frame XXXX

2011-12-29 Thread Mark Leeds
Hi Dan: The reason that happens is because apply expects a matrix as input so, since you sent in a dataframe ( which is really a list with each component the same length ), apply converts the input dataframe to a matrix but, when doing this, it needs to make conversions because a matrix needs to

Re: [R] Applyiing mode() or class() to each column of a data.frame XXXX

2011-12-29 Thread Jean V Adams
Dan Abner wrote on 12/29/2011 06:13:11 PM: Hi everyone, I am attempting to use the apply() function to obtain the mode and class of each column in a data frame, however, I am encountering unexpected results. I have the following example data: v13-1:6 v14-c(1,2,3,3,NA,1)

[R] configure can't find readline -- but it's there!

2011-12-29 Thread Cable, Sam B Civ USAF AFMC AFRL/RVBXI
Am trying to install 2.14.0 on a CentOS system. The configure script apparently can't find something to do with the readline library: Configure: error: --with-readline=yes (default) and headers/libs are not available Yes, I know I need readline 4.2 or later. yum assures me that rev 5.1

[R] Extracting Information from ctree

2011-12-29 Thread David Guy
I am trying to extract the tree information from the output of ctree. I tried using the documentation from BinaryTree Class {party} but with no success. Any help is appreciated. Thank You -- *David Guy, PhD Flemington, NJ 917-941-5890 Cell 908-237-5107 Home 908-284-0356 Fax*

Re: [R] Extracting Information from ctree

2011-12-29 Thread David Winsemius
On Dec 29, 2011, at 10:42 PM, David Guy wrote: I am trying to extract the tree information from the output of ctree. I tried using the documentation from BinaryTree Class {party} but with no success. Any help is appreciated. You cross-posted this from Stack Overflow. Crossposting is

Re: [R] configure can't find readline -- but it's there!

2011-12-29 Thread Marc Schwartz
On Dec 29, 2011, at 7:14 PM, Cable, Sam B Civ USAF AFMC AFRL/RVBXI wrote: Am trying to install 2.14.0 on a CentOS system. The configure script apparently can't find something to do with the readline library: Configure: error: --with-readline=yes (default) and headers/libs are not

Re: [R] differences between 1.7 and 1.7.1 glmnet versions

2011-12-29 Thread Trevor Hastie
I have just started using changelogs, and am clearly not disciplined enough at it. The big change that occurred was the convergence criterion, which would account for the difference. At some point will put up details of this. Trevor Hastie On Dec 26, 2011, at 11:55 PM, Damjan Krstajic wrote:

Re: [R] need help with a time series plotting problem

2011-12-29 Thread vibhava
Dear Jim and Rui, Thanks for your suggestions. i just successfully prepared my first graph :). now i will move on to more interesting figures. thank you once again for your help and time. regards vibhava -- View this message in context: