[R] combine words and dataframe

2009-04-09 Thread Ravi S. Shankar
Hi R, I am trying to get an output like this Hi Hello 1 a b 2 a b 3 a b 4 a b 5 a b And write it as a text file cat(paste(Hi,sep='\n',Hello)) gives me Hi Hello And when I

[R] Create 2*3 Table in R

2009-04-09 Thread Tian Shen
Dear all, I have a matrix as follows: a=matrix(c(1,2,3,1,2,3,1,2,3,6,5,7,7,5,7,5,6,5,Y, N,Y,Y,N,Y, N,Y,Y),ncol=3) a [,1] [,2] [,3] [1,] 1 6 Y [2,] 2 5 N [3,] 3 7 Y [4,] 1 7 Y [5,] 2 5 N [6,] 3 7 Y [7,] 1 5 N [8,] 2 6 Y [9,] 3 5 Y [10,] 1 5 Y Here, the first

Re: [R] Create 2*3 Table in R

2009-04-09 Thread Sandrine LUNVEN
Dear Tian, You could simply try that: table(a[,1], a[,2], a[,3]) Regards, Sandrine Lunven -Message d'origine- De : r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] De la part de Tian Shen Envoyé : jeudi 9 avril 2009 09:06 À : r-help@r-project.org Objet : [R] Create 2*3

[R] Connecting to heterogenous cluster using makeSOCKcluster of SNOW-package

2009-04-09 Thread Melwin
When trying to create (a very simple) cluster using makeSOCKcluster or makeCluster I get the following error message: library(snow) cl - makeSOCKcluster(localhost) Fatal error: kann Datei '~/R/i686-suse-linux-gnu-library/2.8/snow/RSOCKnode.R' nicht öffnen: Datei oder Verzeichnis nicht

[R] R interpreter not recognized

2009-04-09 Thread Maria I. Tchalakova
Hello, I am trying to install a program based on R, but I am receiving the following error message: r...@darkstar:/home/maria/UCS# perl System/Install.perl Error: Can't run the R interpreter (/usr/local/bin/R). Please make sure that R is installed and specify the fully qualified filename of the R

[R] .Call()

2009-04-09 Thread wudd wudd
Hi guys, I want to transfer the following code from R into .Call compatible form. How can i do that? Thanks!!! INT sim; for(i in 1:sim){ if(i2) genemat - genemat[,sample(1:ncol(genemat))] ranklist[,1] - apply(genemat, 1, function(x){

Re: [R] Constrined dependent optimization.

2009-04-09 Thread Hans W. Borchers
Kevin, sorry I don't understand this sentence: It has been suggested that I do a cluster analysis. Wouldn't this bet mepart way there? Let your products be numbered 1, ..., n, and let p(i) be the location where product i is stored (assigned to) in the warehouse. Then p is a permutation of the

[R] Invoking bond_prices function of termstrc package

2009-04-09 Thread Chirantan Kundu
Hi, I'm trying to invoke the function bond_prices from termstrc package. Here is the code snippet: library(termstrc) data(eurobonds) b - matrix(rep(c(0,0,0, 1),1),nrow=1,byrow=TRUE) group-c(GERMANY) colnames(b) - c(beta0,beta1,beta2,tau1) germaturities-create_maturities_matrix(eurobonds$GERMANY)

Re: [R] Genstat into R - Randomisation test

2009-04-09 Thread Tom Backer Johnsen
Peter Dalgaard wrote: Mike Lawrence wrote: Looks like that code implements a non-exhaustive variant of the randomization test, sometimes called a permutation test. Isn't it the other way around? (Permutation tests can be exhaustive by looking at all permutations, if a randomization test did

[R] problem with creating a netcdf file under script sh

2009-04-09 Thread Tu Anh Tran
Hi everyone, I try to make a netcdf file which disposes a difference between 2 variables of 2netcdf files same dimension When I programmed under R, everything is ok but when I put the code under EOF of a sh script, an error occurs: Error, passed variable has a dim that is NOT of class

Re: [R] combine words and dataframe

2009-04-09 Thread Dieter Menne
Ravi S. Shankar ravis at ambaresearch.com writes: I am trying to get an output like this Hi Hello 1 a b # The easy way: good for logging of results, but commands print too, # depending how you run it df = data.frame(a=rep(a,3),b=rep(b,3)) sink(file=a.txt) cat(Hello\n)

[R] arima on defined lags

2009-04-09 Thread Gerard M. Keogh
Dear all, The standard call to ARIMA in the base package such as arima(y,c(5,0,0),include.mean=FALSE) gives a full 5th order lag polynomial model with for example coeffs Coefficients: ar1ar2 ar3 ar4 ar5 0.4715 0.067 -0.1772

[R] Does R support [:punct:] in regexps?

2009-04-09 Thread Daniel Brewer
Hello does R support [:punct:] in regular expressions? I am trying to strip all regular expressions for a vector of strings. x - c(yoda-yoda,billy!) gsub(/[:punct:]/,,x) [1] yoda-yoda billy! Thanks Dan -- ** Daniel Brewer, Ph.D.

[R] Multiple Hexbinplots in 2 columns with a Single Categorical Variable

2009-04-09 Thread Stuart Reece
Dear Ladies and Gentlemen, I have a fairly large database (N=13,000) and a single main categorical discriminator between the groups. I want to look at the time course of a number of continuous biochemical variables over chronologic age. Therefore I believe I need to prepare hexbinplots in

[R] failed when merging two dataframes, why

2009-04-09 Thread Mao Jianfeng
Hi, R-listers, Failed, when I tried to merge df1 and df2 by codetot in df1 and codetoto in df2. I want to know the reason and how to merge them together. Data frames and codes I have used were listed as followed. Thanks a lot in advance. df1: popcode codetot p3need BCPy01-01 BCPy01-01-1

Re: [R] Does R support [:punct:] in regexps?

2009-04-09 Thread Duncan Murdoch
On 09/04/2009 7:10 AM, Daniel Brewer wrote: Hello does R support [:punct:] in regular expressions? I am trying to strip all regular expressions for a vector of strings. It does, but remember that the [] chars are part of the character class; you need extra [] brackets around the whole thing,

Re: [R] R File I/O Capability - Writing output to specific lines of existing file

2009-04-09 Thread jim holtman
With only 600 lines, it is relatively easy to read it in and replace some lines. For example (untested) is you wanted to replace lines 150:250 with your data, you would do input - readLines('filename') input - c(input[1:149], newData, input[251:length(input)]) writeLines(input, file='filename')

[R] problems with integrate ... arguments

2009-04-09 Thread Richard Morey
Hi everyone, I saw this problem dealt with here: http://markmail.org/search/list:r-project?q=integrate#query:list%3Ar-project%20integrate+page:1+mid:qczmyzr676pgmaaw+state:results but no one answered that request that I can tell. I'm having the same problem. I'm having problems passing arguments

Re: [R] Template Engine Package for R?

2009-04-09 Thread Barry Rowlingson
On Thu, Apr 9, 2009 at 12:42 PM, Jason Rupert jasonkrup...@yahoo.com wrote: Related to the posting below, by any chance is there a Template Engine package for R? http://en.wikipedia.org/wiki/Template_processor This may make this type of editing much easier?  Maybe... Have you tried the

Re: [R] Biexponential Fit

2009-04-09 Thread Peter Dalgaard
Jonas Weickert wrote: Hi, I want to do a biexponential Fit, i.e. y ~ A1*exp(k1*x) + A2*exp(k2*x) Is this possible? I tried nls() but it stopped with several (different) errors. I'm using y and x as simple vectors and the formula for nls() exactly as mentioned above. Yes, it is possible,

Re: [R] change default output size when using Sweave

2009-04-09 Thread Franzini, Gabriele [Nervianoms]
Hi, I had a similar problem, and I took the direction of squeezing the output into a minipage, e.g.: ... @ \begin{minipage}[c]{0.6\textwidth} fig=TRUE, echo=FALSE= plot(...) abline(...) @ \end{minipage} ... HTH, Gabriele Franzini ICT Applications Manager Nerviano Medical Sciences SRL

[R] reading an image and adding a legend

2009-04-09 Thread Simon Pickett
Hi all, I would like to 1. Read in an arcmap image into R (I can export pretty much any type of image jpeg, bitmap etc from arcmap) 2. Use R to create a nice colour legend in the plot First of all, Is this possible? So far I'm stuck on point 1. I have tried read.pnm() from pixmap and

[R] Biexponential Fit

2009-04-09 Thread Jonas Weickert
Hi, I want to do a biexponential Fit, i.e. y ~ A1*exp(k1*x) + A2*exp(k2*x) Is this possible? I tried nls() but it stopped with several (different) errors. I'm using y and x as simple vectors and the formula for nls() exactly as mentioned above. Thanks a lot! Jonas

Re: [R] failed when merging two dataframes, why

2009-04-09 Thread jim holtman
try this: merge(df1, df2, by.x='codetot',by.y='codetoto', all=TRUE) codetot popcode.x p3need popcode.y areasec 1 BCPy01-01-1 BCPy01-01 100. BCPy01-01 0.5089434 2 BCPy01-01-2 BCPy01-01 100. BCPy01-01 0.6246381 3 BCPy01-01-3 BCPy01-01 100. BCPy01-01 0.4370059 4

[R] Template Engine Package for R?

2009-04-09 Thread Jason Rupert
Related to the posting below, by any chance is there a Template Engine package for R? http://en.wikipedia.org/wiki/Template_processor This may make this type of editing much easier? Maybe... Thanks again. --- On Wed, 4/8/09, Jason Rupert jasonkrup...@yahoo.com wrote: From: Jason Rupert

Re: [R] R interpreter not recognized

2009-04-09 Thread Paul Smith
On Thu, Apr 9, 2009 at 9:01 AM, Maria I. Tchalakova maria.tchalak...@gmail.com wrote: I am trying to install a program based on R, but I am receiving the following error message: r...@darkstar:/home/maria/UCS# perl System/Install.perl Error: Can't run the R interpreter (/usr/local/bin/R).

Re: [R] Template Engine Package for R?

2009-04-09 Thread Jeffrey Horner
Jason Rupert wrote: Related to the posting below, by any chance is there a Template Engine package for R? Indeed there is. It's called brew: http://cran.r-project.org/web/packages/brew/index.html Jeff http://en.wikipedia.org/wiki/Template_processor This may make this type of editing much

Re: [R] Biexponential Fit

2009-04-09 Thread Jonas Weickert
Thank you! Now it's working. Peter Dalgaard schrieb: Jonas Weickert wrote: Hi, I want to do a biexponential Fit, i.e. y ~ A1*exp(k1*x) + A2*exp(k2*x) Is this possible? I tried nls() but it stopped with several (different) errors. I'm using y and x as simple vectors and the formula for

[R] Find a zero of a composition of functions

2009-04-09 Thread enrico.fosco...@libero.it
Good morning to all, I should find the zero of a specific function, func(x,f. me,c,t)=x+f.me*c-t where 'c' and 't' are constants and 'f.me' is an other function of 'x'. Actually, I am interested in considering 'f.me' as an expression(). Namely, uniroot.me-function(f.me,c,t){

Re: [R] R interpreter not recognized

2009-04-09 Thread Maria I. Tchalakova
Hi Paul, I am using Slackware 12.0.0. Maria On Thu, Apr 9, 2009 at 2:35 PM, Paul Smith phh...@gmail.com wrote: On Thu, Apr 9, 2009 at 9:01 AM, Maria I. Tchalakova maria.tchalak...@gmail.com wrote: I am trying to install a program based on R, but I am receiving the following error message:

Re: [R] problems with integrate ... arguments

2009-04-09 Thread Duncan Murdoch
On 09/04/2009 8:07 AM, Richard Morey wrote: Hi everyone, I saw this problem dealt with here: http://markmail.org/search/list:r-project?q=integrate#query:list%3Ar-project%20integrate+page:1+mid:qczmyzr676pgmaaw+state:results but no one answered that request that I can tell. I'm having the same

Re: [R] Sweave problem, with multicolumn tables from R to LaTeX

2009-04-09 Thread Ista Zahn
Hi Christian, I've been having this problem as well. There are bug reports about this (one of them mine): http://biostat.mc.vanderbilt.edu/trac/Hmisc/ticket/25 http://biostat.mc.vanderbilt.edu/trac/Hmisc/ticket/28 so hopefully the developers are aware of the problem and will address it in the next

[R] data.fram zero's

2009-04-09 Thread Duijvesteijn, Naomi
Hi all, A simple question which I don’t seem to be able to solve: I want to make a data.frame of 360 rows and 94228 column with only zero’s without having to type all these zero’s ;-) What is the easiest method? Thanks, Naomi Disclaimer: De

Re: [R] reading an image and adding a legend

2009-04-09 Thread Dieter Menne
Simon Pickett simon.pickett at bto.org writes: But my code returns an error x-read.pnm(C:/Documents and Settings/simonp/My Documents/Simon BTO/RELU/GIS data/ten km areas in analysis.bmp) Error in pm.readmagicnumber(con) : Not a PNM format file Error message seems quite clear: bmp a

Re: [R] Sweave problem, with multicolumn tables from R to LaTeX

2009-04-09 Thread Christian Salas
hi Ista, i did load xtable() before because i was comparing if using it was any different, but still i got the same problem. I hope somebody can give us a solution or some tips soon! thanks c --- Christian Salas

Re: [R] data.fram zero's

2009-04-09 Thread Dimitris Rizopoulos
well, you can first create a matrix and then turn into a data frame, e.g., mat - matrix(0, 5, 10) as.data.frame(mat) I hope it helps. Best, Dimitris Duijvesteijn, Naomi wrote: Hi all, A simple question which I don’t seem to be able to solve: I want to make a data.frame of

Re: [R] Help with biOps loading

2009-04-09 Thread Matias Bordese
Hi Bob, I have tried several times to load biOps package after reading the posts in this archive regarding the necessity of placing these two libs in the PATH (libjpeg62.dll and libtiff3.dll).  I have tried locating the libs in several directories that should have worked, but I still get

[R] Cross-platforms solution to export R graphs

2009-04-09 Thread Philippe Grosjean
Hello Rusers, I have worked on a R Wiki page for solutions in exporting R graphs, especially, the often-asked questions: - How can I export R graphs in vectorized format (EMF) for inclusion in MS Word or OpenOffice outside of Windows? - What is the best solution(s) for

[R] seemingly unrelated regression

2009-04-09 Thread livia
Hello, I am working on the model of seemingly unrelated regression. I came across with the error message: Log determinant of residual covariance: NA Warning messages: NAs generated in: log(x) I have three linear models which contain 21 explanatory variables and there are about 300 data

Re: [R] R segfaulting with glmnet on some data, not other

2009-04-09 Thread Kamalic Dan
Thanks, Gad. Lisa's professor knows the glmnet authors, so we will forward this request directly to them. Take care! Dan From: Gad Abraham gabra...@csse.unimelb.edu.au Cc: r-help@r-project.org; lp...@bu.edu Sent: Tuesday, April 7, 2009 10:26:26 PM Subject:

Re: [R] seemingly unrelated regression

2009-04-09 Thread Ben Bolker
livia wrote: Hello, I am working on the model of seemingly unrelated regression. I came across with the error message: Log determinant of residual covariance: NA Warning messages: NAs generated in: log(x) I have three linear models which contain 21 explanatory variables and

[R] CFA in R/sem package

2009-04-09 Thread Iuri Gavronski
Hi, I am not sure if R-help is the right forum for my question. If not, please let me know. I have to do some discriminant validity tests with some constructs. I am using the method of doing a CFA constraining the correlation of a pair of the constructs to 1 and comparing the chi-square of this

Re: [R] Maple and R

2009-04-09 Thread JLucke
You can export the Maple code to C or Fortran. I actually found it easier to export it to Fortran and then use a text editor to change Fortran's assignment ='s to R's -. After additional tweaks for R, you can convert the script into an R function. Joseph F. Lucke Senior Statistician

[R] better way of recoding factors in data frame?

2009-04-09 Thread mohinder_datta
Hi all, I apologize in advance for the length of this post, but I wanted to make sure I was clear. I am trying to merge two dataframes that share a number of rows (but some are unique to each data frame). Each row represents a subject in a study. The problem is that sex is coded differently

Re: [R] better way of recoding factors in data frame?

2009-04-09 Thread Thomas Lumley
On Thu, 9 Apr 2009 mohinder_da...@yahoo.com wrote: Hi all, I apologize in advance for the length of this post, but I wanted to make sure I was clear. Good strategy. I tried this: myFrame2$newSex - ifelse(myFrame2$newSex ==1 || myFrame2$newSex == 2, myFrame2$newSex, 0) First, you

Re: [R] Maple and R

2009-04-09 Thread JLucke
I forgot. You can get the Bessel functions from Robin Hankin's GSL package. R. K. S. Hankin 2006. Introducing gsl, a wrapper for the Gnu Scientific Library. Rnews 6(4):24-26 Joseph F. Lucke Senior Statistician Research Institute on Addictions University at Buffalo State University of New

Re: [R] failed when merging two dataframes, why

2009-04-09 Thread Jun Shen
I would suggest use the same column names for the common columns. Say, use codetot for both df1 and df2. Then you don't even have to specify by.x or by.y, merge will do it automatically. merge(df1,df2, all=TRUE). Otherwise you have to

Re: [R] Biexponential Fit

2009-04-09 Thread Katharine Mullen
Using algorithm=plinear as shown by example below makes sum-of-exponentials fitting problems better conditioned. A1 - 1 A2 - 2 k1 - -.5 k2 - -2 x - seq(1,10,length=200) y - A1*exp(k1*x) + A2*exp(k2*x) + .001*rnorm(200) aa - nls(y~cbind(exp(k1*x), exp(k2*x)), algorithm=plinear,

[R] xmlEventParse returning trimmed content?

2009-04-09 Thread Johannes Graumann
Hello, I wrote the function below and have the problem, that the text bit returns only a trimmed version (686 chars as far as I can see) of the content under the fetchPeaks condition. Any hunches why that might be? Thanks for pointer, Joh xmlEventParse(fileName, list(

Re: [R] problems with integrate ... arguments

2009-04-09 Thread Ravi Varadhan
Richard, Your function f() is already vectorized, and it works well (see below). Therefore, you don't need to create f2(). f = function(x, const) 2^x + const testval = 2 integrate(f, 0.5, 1, const=testval) 1.845111 with absolute error 2.0e-14 Ravi.

Re: [R] better way of recoding factors in data frame?

2009-04-09 Thread Mohinder Datta
Thank you for your help! --- On Thu, 4/9/09, Thomas Lumley tlum...@u.washington.edu wrote: From: Thomas Lumley tlum...@u.washington.edu Subject: Re: [R] better way of recoding factors in data frame? To: mohinder_da...@yahoo.com Cc: r-help@r-project.org Date: Thursday, April 9, 2009, 2:10

Re: [R] Anova interaction not tested

2009-04-09 Thread Bert Gunter
Gabe: Don't be silly. lme is not appropriate here --you have only one stratum!. Use lm and you'll see what's going on. It also looks like you should do some reading up on linear models. VR's MASS or Peter Dalgaard's INTRO to Statistics with R might be places to start. Incidentallyy, Version

Re: [R] problems with integrate ... arguments

2009-04-09 Thread Ravi Varadhan
Richard, I didn't read the last part of your email that you do want to Vectorize your function. Sorry about that. Here is a solution using sapply to vectorize your function. f - function(x, const) 2^x + const f2 - function(x, ...) sapply(x, function(x) f(x, ...) ) integrate(f2, 0.5, 1,

[R] request: maximum depth reached problem

2009-04-09 Thread Muhammad Azam
Dear R community Hope all of you are fine. I have a question regarding the an error message. Actually, I am trying to generate classification trees using tree package. It works well but for some datasets e.g., wine, yeast, boston housing etc. it gives an error message. Error in tree(V14 ~ .,

[R] HELP to cbind several data.frame with a LOOP

2009-04-09 Thread Alessandro
Dear R users, thank for help. SORRY I am seeing in google a maillist but I didn't find a solution for my problem I have several txt file (with the same number of column and HEADER) to merge together, this is an example: Tableanalysis_firenze_10.txt Tableanalysis_firenze_20.txt

Re: [R] problems with integrate ... arguments

2009-04-09 Thread Duncan Murdoch
On 09/04/2009 10:19 AM, Ravi Varadhan wrote: Richard, Your function f() is already vectorized, and it works well (see below). Therefore, you don't need to create f2(). He did say that this was a simplified example. The problem appears to be in Vectorize, which uses match.call() to get

Re: [R] HELP to cbind several data.frame with a LOOP

2009-04-09 Thread jim holtman
I would use 'lapply' to create a list of the matrices: result - lapply(c(10,20,30,40,50), function(.num){ do.call(cbind, lapply(c('Tableanalysis_firenze', 'Tableanalysis_siena', 'Tableanalysis_lucca'), function(.file){ read.table(sprintf(%s_%d.txt, .file, .num), header=TRUE) }))

Re: [R] Convert data frame containing time stamps to time series

2009-04-09 Thread amvds
What is zoo? I cannot find anything about zoo int he documentation. I did try as.ts() see below. Thank you, Alex van der Spek have you tried using zoo and then using the function as.ts() On Wed, Apr 8, 2009 at 11:56 AM, am...@xs4all.nl wrote: Converting dates is getting stranger still. I

Re: [R] Genstat into R - Randomisation test

2009-04-09 Thread Robert A LaBudde
At 04:43 AM 4/9/2009, Tom Backer Johnsen wrote: Peter Dalgaard wrote: Mike Lawrence wrote: Looks like that code implements a non-exhaustive variant of the randomization test, sometimes called a permutation test. Isn't it the other way around? (Permutation tests can be exhaustive by looking

[R] re siduals

2009-04-09 Thread kayj
Hi All, I am trying to fit a linear regression between the tool speed and the tool type ( type A, Type B , Type C) where the response is the tool speed and the regressor is the tool type. I introduced two dummy variables X1 and X2 as follows X1 X2 Tool A 0 0 Tool B 0 1

Re: [R] Cross-platforms solution to export R graphs

2009-04-09 Thread HBaize
Thank you Philippe. That is very helpful. Philippe Grosjean wrote: Hello Rusers, I have worked on a R Wiki page for solutions in exporting R graphs, especially, the often-asked questions: - How can I export R graphs in vectorized format (EMF) for inclusion in MS Word or

Re: [R] .Call()

2009-04-09 Thread Martin Morgan
HI Wudd Wudd -- not really answering your question, but it might pay to refactor some of your R code first. For instance for(j in 2:nrow(ranklist)){ phit - sum(rep(1/Ns, sum(ranklist[1:j,2]==1))) pmiss - sum(rep(1/(N-Ns), sum(ranklist[1:j,2]==0))) if((phit-pmiss)score[i])

Re: [R] xmlEventParse returning trimmed content?

2009-04-09 Thread Duncan Temple Lang
Hi Johannes I would guess that the trimming of the text occurs because you do not specify trim = FALSE in the call to xmlEventParse(). If you specify this, you might well get the results you expect. If not, can you post the actual file you are reading so we can reproduce your results. D.

[R] Error in saveLog(currentLogFileName

2009-04-09 Thread Prew, Paul
Hello, very basic question from a user who is baffled by the workings of computers in general When logging off R, a dialog box asked if I wanted to save my log, I chose yes. Then I noticed that the following message appeared in the Command Window Error in saveLog(currentLogFileName) :

[R] running a .r script and saving the output to a file

2009-04-09 Thread Gagan Pabla
Hello, I want to run the following commands as a script(.r or .bat) and save the output in an external file through Windows OS. data-read.csv(file=wgatever.csv, head=TRUE, sep=,) summary(data$SQFT) hist(data$STAMP) hist(data$STAMP, col='blue') hist(data$SHIP, col='blue') How could I do

Re: [R] Error in saveLog(currentLogFileName

2009-04-09 Thread David Winsemius
This is just two suggestions and a guess. a) When you desire the information from sessionInfo ,you need to type : sessionInfo() # not sessionInfo ... results come from function calls and all you got was the sessionInfo code produced by the implicit print function to which you gave the

Re: [R] running a .r script and saving the output to a file

2009-04-09 Thread David Winsemius
If you just entered sink(), it would turn *off* sink-ing. You need to tell R where to write the output that would otherwise go to the console. (Or if you did something like that then you need to tell us exactly what you did try.) ?sink # e.g. sink(file=... /test.txt) with correct path

[R] numbers not behaving as expected

2009-04-09 Thread Steve_Friedman
If someone can explain this odd behavior I'd appreciate it. I have a data.frame Cell.ave (attached and created via dput(Cell.ave, Cell.ave) which contains three columns of parameters year, month and AveRain. I need to subset the data.frame by months such that DrySeaonMonths are 1,2,3,4, 11,

Re: [R] numbers not behaving as expected

2009-04-09 Thread Stavros Macrakis
On Thu, Apr 9, 2009 at 1:39 PM, steve_fried...@nps.gov wrote: I have a data.frame Cell.ave (attached and created via dput(Cell.ave, Cell.ave) I'm afraid your attachment didn't make it into the r-help mail. Mailing list policy forbids binary attachments other than PS and PDF, but should be

Re: [R] numbers not behaving as expected

2009-04-09 Thread Uwe Ligges
steve_fried...@nps.gov wrote: If someone can explain this odd behavior I'd appreciate it. I have a data.frame Cell.ave (attached and created via dput(Cell.ave, Cell.ave) which contains three columns of parameters year, month and AveRain. I need to subset the data.frame by months such that

Re: [R] R interpreter not recognized

2009-04-09 Thread Stefan Evert
Dear Maria, this is quite probably my faul, in some way. The UCS software has been abandoned a bit recently, as I'm planning to rewrite it into a pure R package. On the other hand, I still use the software occasionally, so it should work with recent R versions. I am trying to install

Re: [R] request: maximum depth reached problem

2009-04-09 Thread Uwe Ligges
Muhammad Azam wrote: Dear R community Hope all of you are fine. I have a question regarding the an error message. Actually, I am trying to generate classification trees using tree package. It works well but for some datasets e.g., wine, yeast, boston housing etc. it gives an error message.

Re: [R] numbers not behaving as expected

2009-04-09 Thread Steve_Friedman
My apologies for sending a binary file. I was following advice from someone (from this list) who insisted I send data via dput. I guess that is frown upon. Anyway. here is a Cellave.txt file. Stavros, here is the output following your suggestion. WetMonths - Cell.ave[Cell.ave$month = 5

Re: [R] CFA in R/sem package

2009-04-09 Thread Jarrett Byrnes
Ivan, I recently put together the sem.additions package over at R forge in part for just such a multiple model problem. THere are a variety of methods that make it easy to add/delete links that could be automated with a for loop and something from the combn package, I think.

Re: [R] Error in saveLog(currentLogFileName

2009-04-09 Thread Prew, Paul
David, thank you for your helpful reply. a) The sessionInfo goof is actually kind of enlightening. I'm assuming that the purpose of adding the () symbols is to tell R that sessionInfo is a function to be invoked, and leaving () empty says to use default arguments? b) In the R GUI, I end my

[R] running a .r script and saving the output to a file

2009-04-09 Thread Gagan Pabla
I first I saved the following commands in a whatever.r file. data-read.csv(file=whatever.csv, head=TRUE, sep=,) summary(data$SQFT) hist(data$STAMP) hist(data$STAMP, col='blue') hist(data$SHIP, col='blue') then I clicked File Menu- source and chose whatever.r, it runs the commands and produces

Re: [R] numbers not behaving as expected

2009-04-09 Thread Stavros Macrakis
On Thu, Apr 9, 2009 at 2:05 PM, steve_fried...@nps.gov wrote: WetMonths - Cell.ave[Cell.ave$month  = 5 and Cell.ave$month = 11,] Error: unexpected symbol in WetMonths - Cell.ave[Cell.ave$month  = 5 and  Cell.ave$month = 11,] a) you are comparing with the *string* 5, not the *number* 5 (as I

Re: [R] running a .r script and saving the output to a file

2009-04-09 Thread David Winsemius
On Apr 9, 2009, at 2:21 PM, Gagan Pabla wrote: I first I saved the following commands in a whatever.r file. data-read.csv(file=whatever.csv, head=TRUE, sep=,) #this is where you put the first sink: sink(comm.docx) # but it is not going to be in .docx format, but in text format.

Re: [R] numbers not behaving as expected

2009-04-09 Thread Thomas Lumley
On Thu, 9 Apr 2009 steve_fried...@nps.gov wrote: My apologies for sending a binary file. I was following advice from someone (from this list) who insisted I send data via dput. I guess that is frown upon. dput() creates a text file, not a binary file. The problem is probably that your

Re: [R] Error in saveLog(currentLogFileName

2009-04-09 Thread David Winsemius
On Apr 9, 2009, at 2:17 PM, Prew, Paul wrote: David, thank you for your helpful reply. a) The sessionInfo goof is actually kind of enlightening. I'm assuming that the purpose of adding the () symbols is to tell R that sessionInfo is a function to be invoked, and leaving () empty says

[R] Random Cluster Generation Question

2009-04-09 Thread Jason L. Simms
Hello, I am fairly new to R, but I am not new to programming at all. I want to generate random clusters in a 1,000x1,000 box such that I end up with a total of about 2,000 points. Once done, I need to export the X,Y coordinates of the points. I have looked around, and it seems that the

[R] Convert bits to numbers in base 10

2009-04-09 Thread Gang Chen
I have some bits stored like the following variable nn (nn - c(1, 0, 0, 1, 0, 1,0)) [1] 1 0 0 1 0 1 0 not in the format of 1001010 and I need to convert them to numbers in base 10. What's an easy way to do it? TIA, Gang __ R-help@r-project.org

Re: [R] Convert bits to numbers in base 10

2009-04-09 Thread Jorge Ivan Velez
Dear Gang, Try this: nn - c(1, 0, 0, 1, 0, 1,0) paste(nn,sep=,collapse=) See ?paste for more information. HTH, Jorge On Thu, Apr 9, 2009 at 5:23 PM, Gang Chen gangch...@gmail.com wrote: I have some bits stored like the following variable nn (nn - c(1, 0, 0, 1, 0, 1,0)) [1] 1 0 0 1 0 1 0

Re: [R] Convert bits to numbers in base 10

2009-04-09 Thread Marc Schwartz
I suspect that Gang was looking for something along the lines of: sum(2 ^ (which(as.logical(rev(nn))) - 1)) [1] 74 You might also want to look at the digitsBase() function in Martin's sfsmisc package on CRAN. HTH, Marc Schwartz On Apr 9, 2009, at 4:34 PM, Jorge Ivan Velez wrote: Dear

Re: [R] Convert bits to numbers in base 10

2009-04-09 Thread Michael Conklin
Alternatively (nn - c(1, 0, 0, 1, 0, 1,0)) [1] 1 0 0 1 0 1 0 sum(2^(0:(length(nn)-1))*nn) but of course it depends if your bits are stored big-endian or little-endian so you might want sum(2^((length(nn)-1):0)*nn) I like Marc's approach better (certainly more elegant). If you have the

Re: [R] Convert bits to numbers in base 10

2009-04-09 Thread Gang Chen
Yes, such a concise and elegant solution! Thanks a lot! Gang On Thu, Apr 9, 2009 at 5:51 PM, Marc Schwartz marc_schwa...@me.com wrote: I suspect that Gang was looking for something along the lines of: sum(2 ^ (which(as.logical(rev(nn))) - 1)) [1] 74 You might also want to look at the

[R] how to automatically select certain columns using for loop in dataframe

2009-04-09 Thread Ferry
Hi, I am trying to display / print certain columns in my data frame that share certain condition (for example, part of the column name). I am using for loop, as follow: # below is the sample data structure all.data - data.frame( NUM_A = 1:5, NAME_A = c(Andy, Andrew, Angus, Alex, Argo),

Re: [R] Cross-platforms solution to export R graphs

2009-04-09 Thread Emmanuel Charpentier
Le jeudi 09 avril 2009 à 15:04 +0200, Philippe Grosjean a écrit : Hello Rusers, I have worked on a R Wiki page for solutions in exporting R graphs, especially, the often-asked questions: - How can I export R graphs in vectorized format (EMF) for inclusion in MS Word or OpenOffice

Re: [R] arima on defined lags

2009-04-09 Thread Gad Abraham
Gerard M. Keogh wrote: Dear all, The standard call to ARIMA in the base package such as arima(y,c(5,0,0),include.mean=FALSE) gives a full 5th order lag polynomial model with for example coeffs Coefficients: ar1ar2 ar3 ar4 ar5

[R] puzzling lm.fit errors

2009-04-09 Thread Brendan Morse
Hi everyone, I am running a monte carlo and am getting an error that I haven't the slightest clue where to begin figuring it out. The error is as follows: Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : 0 (non-NA) cases In addition: Warning message: In ltm.fit(X,

Re: [R] Random Cluster Generation Question

2009-04-09 Thread David Winsemius
On Apr 9, 2009, at 5:01 PM, Jason L. Simms wrote: Hello, I am fairly new to R, but I am not new to programming at all. I want to generate random clusters in a 1,000x1,000 box such that I end up with a total of about 2,000 points. Once done, I need to export the X,Y coordinates of the

Re: [R] CFA in R/sem package

2009-04-09 Thread Iuri Gavronski
Jarret, Look: install.packages(sem.additions, repos=http://R-Forge.R-project.org;) Warning message: package ‘sem.additions’ is not available Best, Iuri. On Thu, Apr 9, 2009 at 3:10 PM, Jarrett Byrnes byr...@msi.ucsb.edu wrote: Ivan, I recently put together the sem.additions package over

Re: [R] CFA in R/sem package

2009-04-09 Thread Jarrett Byrnes
install.packages(sem-additions,repos=http://R-Forge.R-project.org;) Sorry, it's sem-additions on r-forge. Not sem.additions, which is what I had originally called it. But they won't take . in the name of a package. On Apr 9, 2009, at 4:07 PM, Iuri Gavronski wrote: Jarret, Look:

Re: [R] puzzling lm.fit errors

2009-04-09 Thread Ted Harding
On 09-Apr-09 22:53:51, Brendan Morse wrote: Hi everyone, I am running a monte carlo and am getting an error that I haven't the slightest clue where to begin figuring it out. The error is as follows: Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : 0 (non-NA)

Re: [R] CFA in R/sem package

2009-04-09 Thread Iuri Gavronski
Jarret, I've donwloaded the zip file and installed, but maybe have lost some pre-req check. I have manually installed sna. Anyway, which would be the approach you suggest? Making (using my example) 4 different models, one for each construct, then use combine.models and add.to.models to create

Re: [R] Random Cluster Generation Question

2009-04-09 Thread Jason L. Simms
Hello, Thanks for your note. I recognize that the points per cluster is random, and also that it is possible to set the mean number of points per cluster through the function. What I was hoping was that I could specify a maximum number of points overall across all clusters, but conceptually I

Re: [R] CFA in R/sem package

2009-04-09 Thread Jarrett Byrnes
Sure, something like that. Store each model as an element of a list, and then use something like for(i in 1:4){ indices-combn(1:4, i) for (j in 1:length(indices[1,])){ new.model-combine.models(model.pieces[ indices[,j] ] ) #code for analysis } }

[R] Los Angeles area R users group's first meeting

2009-04-09 Thread Szilard Pafka
We would like to invite you to the Los Angeles area R user group's first meeting. This group is aimed to bring together practitioners (from industry and academia alike) in order to exchange knowledge and experience in solving data analysis/statistical problems by using R. More information about

Re: [R] Random Cluster Generation Question

2009-04-09 Thread David Winsemius
Try: clust - rMatClust(10, 0.05, 50) plot(clust) Y - rThomas(10, 0.05, 50) plot(Y) On Apr 9, 2009, at 7:28 PM, Jason L. Simms wrote: Hello, Thanks for your note. I recognize that the points per cluster is random, and also that it is possible to set the mean number of points per cluster

[R] Subset a data frame for plotting

2009-04-09 Thread Paul Warren Simonin
Hello, I have a question regarding how to subset/select parts of a data frame (matrix) in order to plot data associated only with this subset. Specifically I have a large data frame in which one column contains ID values (dates), and other columns contain data I would like to plot

  1   2   >