Re: [R] count.fields inconsistent with read.table?

2012-02-23 Thread peter dalgaard
On Feb 24, 2012, at 06:58 , Sam Steingold wrote: > Hi, > > batch is a vector of lines returned by readLines from a > NL-line-terminated file, here is the relevant section: > = > AABB CC DD EE FF > GG

[R] Searching for a pattern within a vector

2012-02-23 Thread Apoorva Gupta
Dear R users, I have a data.frame as follows a b c d e [1,] 1 1 1 0 0 [2,] 1 1 0 0 0 [3,] 1 1 0 0 0 [4,] 0 1 1 1 1 [5,] 0 1 1 1 1 [6,] 1 1 1 1 1 [7,] 1 1 1 0 1 [8,] 1 1 1 0 1 [9,] 1 1 1 0 0 [10,] 1 1 1 0 0 Within these 4 vectors, I want to choose those vectors for which I have the

[R] Missing Data in Stepwise selection of Logistic regression

2012-02-23 Thread Kawthar Alajmi
Hi all, I am running Stepwise logistic regression and i have : 1- Multiple covatiates included in each model (No missing data) 2- Genotype data (SNPs) about 500,000 . I partitioned the data to multiple files (there are missing data) I run the step by including all the covariates and one SNP at e

[R] count.fields inconsistent with read.table?

2012-02-23 Thread Sam Steingold
Hi, batch is a vector of lines returned by readLines from a NL-line-terminated file, here is the relevant section: = AA BB CC DD EE FF GG H H JJ KK LL MM

[R] Use of .C and .Call

2012-02-23 Thread Matyas Sustik
Hi All, The Writing R-extensions document says this on whether I should prefer .C or .Call: "Before you decide to use .Call or .External, you should look at other alternatives. First, consider working in interpreted R code; if this is fast enough, this is normally the best option. You should a

Re: [R] Case weighting

2012-02-23 Thread Thomas Lumley
>On Fri, Feb 24, 2012 at 9:40 AM, David Winsemius >wrote: > > On Feb 23, 2012, at 3:27 PM, Hed Bar-Nissan wrote: > >> It's really weighting - it's just that my simplified example was too >> simplified >> Here is my real weight vector: >> > sc$W_FSCHWT >>  [1]  14.8579  61.9528   3.0420   2.9929  

[R] kernel values sum 1?

2012-02-23 Thread Jorge Fernando Saraiva de Menezes
Dear list, this may be a mathematical question, but the 3d and 2d kernel density values, estimated by kde3d(){misc3d} and kde2d(){MASS} shouldn't sum 1 when multiplied by delta.x,delta.y,delta.z , as integral[kernel(x)*dx]=1? I know the above question is true as another help mail've shown out: v

Re: [R] How can I ran an R command whcih is present as the content of a character object

2012-02-23 Thread Aniruddha Mukherjee
Michael, GREAT !! It worked. Thanks a lot. Aniruddha. From: "R. Michael Weylandt" To: Aniruddha Mukherjee Cc: R-help Date: 02/23/2012 07:10 PM Subject: Re: [R] How can I ran an R command whcih is present as the content of a character object eval(parse(text = rcom)) Michael On Thu, Fe

Re: [R] Advice on exploration of sub-clusters in hierarchical dendrogram

2012-02-23 Thread R. Michael Weylandt
Inline: On Feb 23, 2012, at 6:20 PM, kosmo7 wrote: > Dear Elai, > thank you very much for your suggestion. I tried cutting the dendrogram > instead of the hclust tree with: > clusters<-cut(x, h=1.6) > > but then when I try to call/plot cluster 1 for example, with: > plot(clusters$lower[[1]]) >

Re: [R] installing the package Rcplex

2012-02-23 Thread William Dunlap
One way to set PATH on Windows is to fire up a cmd.exe ("Command Prompt") window and type something like set PATH=e:\Rtools-2.13\bin;e:\Rtools-2.13\MinGW\bin;%PATH%;e:\Program Files\R\R-2.14.1\bin Change it to reflect where you put R and Rtools. I put mine in e:\Program Files\R\R-2.14.1 and

Re: [R] Sexpr not getting expanded in Sweave

2012-02-23 Thread Marc Schwartz
On Feb 23, 2012, at 5:22 PM, Michael Kubovy wrote: > An Sweave file, 'test.Rnw': > > \documentclass{article} > \title{Sweave minimal} > \author{MK} > \begin{document} > \maketitle > We try Sweave: > <<1>>= > data(airquality) > summary(airquality) > x <- airquality[1, 1] > @ > > I try Sexpr: \Sex

[R] Sexpr not getting expanded in Sweave

2012-02-23 Thread Michael Kubovy
An Sweave file, 'test.Rnw': \documentclass{article} \title{Sweave minimal} \author{MK} \begin{document} \maketitle We try Sweave: <<1>>= data(airquality) summary(airquality) x <- airquality[1, 1] @ I try Sexpr: \Sexpr{x} We plot: \begin{center} <<2, fig=TRUE, echo=FALSE >>= boxplot(Ozone ~ Month

[R] multhist weird behavior/ xlabels wrong

2012-02-23 Thread Laura Matrajt
Hi, I found some weird behavior of the function multhist in the plotrix package and I would like to ask you about it: so, it works well to put two histograms next to each other, but I don't understand the breaks… so for example, library(plotrix) mh <- list(rnorm(200, mean=100, sd=10), rnorm(20

Re: [R] installing the package Rcplex

2012-02-23 Thread zheng wei
I appreciate all your help.   But I think it is not fair to blame me for not knowing enough about R.   You kept telling me to read the R installation manual, and I have read it through for several times and it is not easy for a beginner. It is even hard for a windows user since the whole manual

Re: [R] Advice on exploration of sub-clusters in hierarchical dendrogram

2012-02-23 Thread kosmo7
Dear Elai, thank you very much for your suggestion. I tried cutting the dendrogram instead of the hclust tree with: clusters<-cut(x, h=1.6) but then when I try to call/plot cluster 1 for example, with: plot(clusters$lower[[1]]) I get only 2 members that are joined together at distance=0 (cluster

Re: [R] gamlss results for EXP and LNO seem to have reversed AIC scores

2012-02-23 Thread RdR
Thank you. I was obviously mis-interpreting the AIC results. RdR -- View this message in context: http://r.789695.n4.nabble.com/gamlss-results-for-EXP-and-LNO-seem-to-have-reversed-AIC-scores-tp4413702p4415275.html Sent from the R help mailing list archive at Nabble.com. __

[R] how to draw crossing circles to show relationship?

2012-02-23 Thread Guang Dai
Dear list, To make it easier, let me start with an example. Say I have 20 different cookies. Dave likes 7 of them, Evan likes 14 of them and Torri likes 11 of them. The data is cookies<-cbind(c(1:20), c(1,0,0,1,0,1,0,0,0,0,1,1,1,0,0,0,1,0,0,0), c(1,1,1,0,0,1,1,1,1,1,0,1,1,0,1,0,1,0,1,1), c(1,1,0

[R] error in optim: initial value in 'vmmin' is not finite

2012-02-23 Thread garciap
Dear r-helpers, I'm experiencing some problems in fitting a maximum likelihood binomial model to some of my data. The error is in optim, which founds: Error in optim(par = c(0.2, 0.5), fn = function (p) : initial value in 'vmmin' is not finite Yes, I know it's a common problem, and I've caref

[R] help filtering points from a scatterplot

2012-02-23 Thread Vining, Kelly
Dear useRs, I'm having trouble with what is likely a very simple issue with a simple graph. I have data in the format pasted below - total from which this is a subset is > 3 million rows. I'm plotting "Window" on the x axis, and either of the other two columns on the y axis. In both the second a

Re: [R] cor() on sets of vectors

2012-02-23 Thread William Dunlap
> ## sapply is a good solution (the only one I could think of too), but > not always worth it: Also look at vapply(). It is like sapply() but you have to tell it what type and size of output you expect FUN to return. E.g., change sapply(1:n, FUN=function(i) cor(x[,i],y[,i])) to vapply(1:n,

Re: [R] using shapefiles in adehabitat/ converting shapefile to spatial pixel data frame

2012-02-23 Thread Michael Sumner
The error you are getting says that the coordinates provided do not define a regular grid (within the tolerance allowed). Are the points in your CSV file really a regular grid, or do they represent a surface by way of irregular points? You could check this manually by plotting: depth<-read.csv("d

Re: [R] perform t.test by rows and columns in data frame

2012-02-23 Thread Brian Diggs
See comments inline On 2/23/2012 3:27 PM, Kara Przeczek wrote: Sorry. I forgot to note that I am using R version 2.8.0. That's a rather old version; 2.8.0 came out in October 2008; maybe you don't have control over that, though. From: r-help-boun...

[R] Colloc Infer: some further explanation due?

2012-02-23 Thread Vassily Shvets
Hello, I've been working with Colloc Infer. Having set up an analysis for a data set, the response to my 'outeropt' input is Error in more$fn(times, devals, pars, more$more) : argument "more" is missing, with no default Having double (or more) checked the other elements of the analysis, usi

Re: [R] cor() on sets of vectors

2012-02-23 Thread Bert Gunter
Elai: Thank you.You make an excellent point. cor() is implemented at the C level (via a .internal call) whereas sapply implements an interpreted loop that has to issue the call each time through the loop (with some shortcuts/tricks to reduce overhead). So the operations count of the original poste

Re: [R] perform t.test by rows and columns in data frame

2012-02-23 Thread Kara Przeczek
Sorry. I forgot to note that I am using R version 2.8.0. From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] on behalf of Kara Przeczek [przec...@unbc.ca] Sent: February 23, 2012 3:13 PM To: r-help@r-project.org Subject: [R] perform t.test by

[R] perform t.test by rows and columns in data frame

2012-02-23 Thread Kara Przeczek
Dear R Help, I have been struggling with this problem without making much headway. I am attempting to avoid using a loop, and would appreciate any suggestions you may have. I am not well versed in R and apologize in advance if I have missed something obvious. I have a data set with multiple

Re: [R] cor() on sets of vectors

2012-02-23 Thread ilai
On Thu, Feb 23, 2012 at 3:24 PM, Bert Gunter wrote: > Use 1:n as an index. > > e.g. > sapply(1:n, function(i) cor(x[,i],y[,i])) ## sapply is a good solution (the only one I could think of too), but not always worth it: # for 100 x 1000 x <- data.frame(matrix(rnorm(10),nc=1000)) y <- data.f

Re: [R] TRAMO/SEATS and x12 in R

2012-02-23 Thread John C Frain
Have a look at the gretl econometric package. This has a simplified interface to X12 and integrates well with R. Best Regards John On Thursday, 23 February 2012, Victor wrote: > I have a Mac OS X system. To deal with a long monthly electricity demand > time-series I use the procedures TRAMO/SE

Re: [R] TRAMO/SEATS and x12 in R

2012-02-23 Thread John C Frain
Have a look at the gretl econometric package. This has a simplified interface to X12 and integrates well with R. Best Regards John On Thursday, 23 February 2012, Victor wrote: > I have a Mac OS X system. To deal with a long monthly electricity demand > time-series I use the procedures TRAMO/SE

Re: [R] cor() on sets of vectors

2012-02-23 Thread Bert Gunter
Use 1:n as an index. e.g. sapply(1:n, function(i) cor(x[,i],y[,i])) -- Bert On Thu, Feb 23, 2012 at 2:10 PM, Sam Steingold wrote: > suppose I have two sets of vectors: x1,x2,...,xN and y1,y2,...,yN. > I want N correlations: cor(x1,y1), cor(x2,y2), ..., cor(xN,yN). > my sets of vectors are arr

Re: [R] cor() on sets of vectors

2012-02-23 Thread R. Michael Weylandt
sapply(1:NCOL(x), function(n) cor(x[n], y[n])) is a quick and dirty way, though probably not optimal. Michael On Thu, Feb 23, 2012 at 5:10 PM, Sam Steingold wrote: > suppose I have two sets of vectors: x1,x2,...,xN and y1,y2,...,yN. > I want N correlations: cor(x1,y1), cor(x2,y2), ..., cor(xN,yN

[R] cor() on sets of vectors

2012-02-23 Thread Sam Steingold
suppose I have two sets of vectors: x1,x2,...,xN and y1,y2,...,yN. I want N correlations: cor(x1,y1), cor(x2,y2), ..., cor(xN,yN). my sets of vectors are arranged as data frames x & y (vector=column): x <- data.frame(a=rnorm(10),b=rnorm(10),c=rnorm(10)) y <- data.frame(d=rnorm(10),e=rnorm(10),f=

Re: [R] Case weighting

2012-02-23 Thread Daniel Nordlund
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Hed Bar-Nissan > Sent: Thursday, February 23, 2012 12:27 PM > To: David Winsemius > Cc: r-help@r-project.org > Subject: Re: [R] Case weighting > > It's really weighting - it's jus

Re: [R] help - history()

2012-02-23 Thread Jeff Newmiller
No. But there is nothing preventing you from editing the file once your session is complete. --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go...

Re: [R] Case weighting

2012-02-23 Thread David Winsemius
On Feb 23, 2012, at 3:27 PM, Hed Bar-Nissan wrote: It's really weighting - it's just that my simplified example was too simplified Here is my real weight vector: > sc$W_FSCHWT [1] 14.8579 61.9528 3.0420 2.9929 5.1239 14.7507 2.7535 2.2693 3.6658 8.6179 2.5926 2.5390

Re: [R] R CMD INSTALL with configure args

2012-02-23 Thread R. Michael Weylandt
Please cc the list. I'm not a debian user so any suggestions I make will be guesses based on similarities with Mac OS X. There's also a R-SIG-Debian list that might be appropriate. That said, if you plan on doing this repeatedly, perhaps you can make an alias in your bash profile (or whatever shel

Re: [R] Case weighting

2012-02-23 Thread Hed Bar-Nissan
It's really weighting - it's just that my simplified example was too simplified Here is my real weight vector: > sc$W_FSCHWT [1] 14.8579 61.9528 3.0420 2.9929 5.1239 14.7507 2.7535 2.2693 3.6658 8.6179 2.5926 2.5390 1.7354 2.9767 9.0477 2.6589 3.4040 3.0519 And

Re: [R] convert zoo object to "standard" R object so I can plot and output to csv file

2012-02-23 Thread R. Michael Weylandt
If you could just construct the zoo object you want to plot and then use dput() on it to create a plain-text representation (safe for emailing) that'd make it easiest for us to help you. We can't do much right now since we don't have the text file in question. Michael On Thu, Feb 23, 2012 at 3:21

Re: [R] convert zoo object to "standard" R object so I can plot and output to csv file

2012-02-23 Thread Gabor Grothendieck
On Thu, Feb 23, 2012 at 3:06 PM, Henry wrote: > Another simple question - trying to specify xlim in a zoo plot and getting > error > my plot line is > plot(z1, > ylim=c(-100,3000),xlim=c(chron("10/30/2011","00:00:00"),chron("10/30/2011","00:20:00")),type="b",xlab="",ylab="1 > Minute Fit",cex.lab=1

Re: [R] Problems with Cosine Similarity using library(lsa)

2012-02-23 Thread Dallas
The as.matrix (and as.table or as. vector or as.numeric ...) command takes the object that you wish to convert as an argument. So the code below will actually perform the conversion from table to matrix. > newmatrix<- as.matrix(matrix_v3) A way to see what form your data are taking is to use the

Re: [R] convert zoo object to "standard" R object so I can plot and output to csv file

2012-02-23 Thread Henry
Another simple question - trying to specify xlim in a zoo plot and getting error my plot line is plot(z1, ylim=c(-100,3000),xlim=c(chron("10/30/2011","00:00:00"),chron("10/30/2011","00:20:00")),type="b",xlab="",ylab="1 Minute Fit",cex.lab=1.3) Error in substring(paste("0", v$day, sep = ""), first =

Re: [R] I'm sure I'm missing something with formatC() or sprintf()

2012-02-23 Thread Ted Harding
On 23-Feb-2012 z2.0 wrote: > I have a four-digit string I want to convert to five digits. Take the > following frame: > > zip > 2108 > 60321 > 60321 > 22030 > 91910 > > I need row 1 to read '02108'. This forum directed me to formatC previously > (thanks!) That usually works but, for some reason,

Re: [R] I'm sure I'm missing something with formatC() or sprintf()

2012-02-23 Thread Sarah Goslee
You said that the values are already character - that's the key. Compare: > sprintf("%05s", "2018") [1] " 2018" > sprintf("%05d", 2018) [1] "02018" Since they are already character, though, here's another option: x <- c("2108", "60321", "22030") # part of your data ifelse(nchar(x) == 4, paste("0"

Re: [R] I'm sure I'm missing something with formatC() or sprintf()

2012-02-23 Thread William Dunlap
sprintf's "%s" format descriptor ignores initial 0's in , in C's sprintf and in R's. Here are 2 ways to do it: > z <- c("5", "45", "345", "2345", "12345") > sprintf("%05d", as.integer(z)) [1] "5" "00045" "00345" "02345" "12345" > gsub(" ", "0", sprintf("%5s", z)) [1] "5" "00045"

[R] I'm sure I'm missing something with formatC() or sprintf()

2012-02-23 Thread z2.0
I have a four-digit string I want to convert to five digits. Take the following frame: zip 2108 60321 60321 22030 91910 I need row 1 to read '02108'. This forum directed me to formatC previously (thanks!) That usually works but, for some reason, it's not in this instance. Neither of the syntaxes

Re: [R] help with winbugs glm

2012-02-23 Thread ilai
Adan, How many levels does Depth have? my wild guess: 3 and your bugs model is not identifiable. Second, I think you may have a critical error in the way you formatted the data for the bugs model. From your code it looks like you are just using the factor Depth and not a design matrix of dummy var

Re: [R] Survival analysis and comparing survival curves

2012-02-23 Thread David Winsemius
On Feb 23, 2012, at 11:12 AM, R-girl wrote: Hei, I have a one simple question which does not seem to be that simple as I cannot find any solution/answer: Is it possible to compare multiple survival curves in R with survdiff-function when there is interaction term involved in predictor vari

Re: [R] Aggregate with Function List ?

2012-02-23 Thread David Winsemius
On Feb 23, 2012, at 1:41 PM, Michael Karol wrote: R Experts I wish to tabulate into one data frame statistics summarizing concentration data. The summary is to include mean, standard deviation, median, min and max. I wish to have summaries by Dose, Day and Time. I can do this by callin

Re: [R] Good and modern Kernel Regression package in R with auto-bandwidth?

2012-02-23 Thread Michael
Thanks Andy. I am reading the "locfit" document... but not sure how to do the CV and bandwidth selection... Here is a quote about the function "regband": it doesn't seem to be usable? Basically I am looking for a "locfit" that comes with an automatic bandwidth selection so that I am essentially

[R] Help with Matrix code optimization

2012-02-23 Thread Matt Shotwell
The chol and solve methods for dpoMatrix (Matrix package) are much faster than the default methods. But, the time required to coerce a regular matrix to dpoMatrix swamps the advantage. Hence, I have the following problem, where use of dpoMatrix is worse than a regular matrix. library(Matrix) x <

Re: [R] Using R to read Nortek Aquadopp Profiler

2012-02-23 Thread Brian Diggs
On 2/22/2012 4:53 PM, Vinny Moriarty wrote: Hello, I have current data from a nortek ADP, which is basically current speed and direction data in a 3 dimensional X Y Z format http://www.nortekusa.com/usa/products/current-profilers/aquadopp-profiler-1 The instrument logs data in a complex wa

[R] Aggregate with Function List ?

2012-02-23 Thread Michael Karol
R Experts I wish to tabulate into one data frame statistics summarizing concentration data. The summary is to include mean, standard deviation, median, min and max. I wish to have summaries by Dose, Day and Time. I can do this by calling aggregate once for each of the statistics (mean, s

Re: [R] Survival analysis and comparing survival curves

2012-02-23 Thread Bert Gunter
DEAR R-girl: On Thu, Feb 23, 2012 at 8:12 AM, R-girl wrote: > Hei, > > I have a one simple question which does not seem to be that simple as I > cannot find any solution/answer: > > Is it possible to compare multiple survival curves in R with > survdiff-function when there is interaction term inv

[R] help with winbugs glm

2012-02-23 Thread Adan Jordan-Garza
Hi, I am running a model with count data and one categorical predictor (simple model for me to understand it fully), I did in R a glm like this: glm(Recruitment~Depth, family=poisson). I get the coefficientes and confidence intervals and all is ok. But then I want to do the same model with Bayesian

Re: [R] installing the package Rcplex

2012-02-23 Thread zheng wei
You can tell me what do you mean by add R's bin directory to path.   Thanks From: Uwe Ligges Cc: David Winsemius ; "r-help@r-project.org" Sent: Thursday, February 23, 2012 9:29 AM Subject: Re: [R] installing the package Rcplex I give up. Uwe Ligges On 23

[R] Survival analysis and comparing survival curves

2012-02-23 Thread R-girl
Hei, I have a one simple question which does not seem to be that simple as I cannot find any solution/answer: Is it possible to compare multiple survival curves in R with survdiff-function when there is interaction term involved in predictor variables (and this interaction is significant)? Examp

[R] nlme Fixed Variance Function

2012-02-23 Thread Agostino Moro
Dear R users, I am trying to fit a gls model and weight my data points using a VarFixed structure. I have found many examples, but I do not understand the difference between the following models with varFixed specified in a different way: mod<-gls(y~x,weights=varFixed(~1/invsigma) mod<-gls(y~x,w

Re: [R] Advice on exploration of sub-clusters in hierarchical dendrogram

2012-02-23 Thread ilai
See inline On Thu, Feb 23, 2012 at 8:54 AM, kosmo7 wrote: > Dear R user, > In other words, I am trying to obtain/read the sub-clusters of a specific > cluster in the dendrogram, by isolating a specific node and exploring > locally its lower hierarchy. To explore or "zoom in" on elements of z yo

[R] R CMD INSTALL with configure args

2012-02-23 Thread Erin Hodgess
Dear R People: I have a question, please: I want to install a package from R CMD INSTALL and I have a boatload of configure args. I want to put them into a file. How do I point the R CMD INSTALL to that file, please? Thanks, Erin -- Erin Hodgess Associate Professor Department of Computer an

Re: [R] Case weighting

2012-02-23 Thread David Winsemius
On Feb 23, 2012, at 10:49 AM, Hed Bar-Nissan wrote: The need comes from the PISA data. (http://www.pisa.oecd.org) In the data there are many cases and each of them carries a numeric variable that signifies it's weight. In SPSS the command would be "WEIGHT BY" In simpler words here is an R sam

Re: [R] Calculating Pseudo R-squared from nlme

2012-02-23 Thread Bert Gunter
I saw no reply to this yet, so herewith a few comments. 1. Best recommendation: Post to r-sig-mixed-models instead. Miscellaneous comments. R-squared as "an overall summary of the total outcome variability explained" is practically useless and generally misleading. Why? Short answer: Because no

Re: [R] FW: NaN from function

2012-02-23 Thread Petr Savicky
On Thu, Feb 23, 2012 at 04:40:07PM -, Ted Harding wrote: [...] > A basic solution for this special case would be > > zt=function(x){ > if (sd(x) == 0) return(0*x) else return( (x-mean(x))/sd(x) ) > } > > This should cover the case where length(table(x))==1 (see also below). > > I'm n

[R] data frame colnames through ddply

2012-02-23 Thread Arnaud Gaboury
Dear list, I am trying to pass data frame colnames through ddply without sucess. Here is my command: >exportfile<-ddply(exportfile,c("Product","Price"),summarise,Nbr.Lots=sum(Filled.Qty)) exportfile is a df. I want to apply summarise to Product and Price columns and sum the Filled.Qty column a

Re: [R] best option for big 3D arrays?

2012-02-23 Thread steven mosher
Did you have to use a particular filename? or extension. I created a similar file but then could not read it back in Steve On Mon, Feb 13, 2012 at 6:45 AM, Djordje Bajic wrote: > I've been investigating and I partially respond myself. I tried the > packages 'bigmemory' and 'ff' and for me the

[R] help - history()

2012-02-23 Thread Gian Maria Niccolò Benucci
Hi Members, Do exist the possibility to delete a command line into the history? Fo example. If I' ve typed a line code that is wrong, Can I delete it from the hostory in reason to do not save it in the .Rhistory file? Thanks for helping, Gian [[alternative HTML version deleted]] ___

[R] segfault when using data.table package in conjunction with foreach

2012-02-23 Thread Matthew Keller
Hi all, I'm trying to use the package read.table within a foreach loop. I'm grabbing 500M rows of data at a time from two different files and then doing an aggregate/tapply like function in read.table after that. I had planned on doing a foreach loop 39 times at once for the 39 files I have, but o

Re: [R] FW: NaN from function

2012-02-23 Thread Ted Harding
On 23-Feb-2012 Jonathan Williams wrote: > Dear Helpers, > I wrote a simple function to standardise variables if they > contain more than one value. If the elements of the variable > are all identical, then I want the function to return zero. > > When I submit variables whose elements are all ident

Re: [R] tapply for enormous (>2^31 row) matrices

2012-02-23 Thread Matthew Keller
Thank you all very much for your help (on both the r-help and the bioconductor listserves). Benilton - I couldn't get sqldf to install on the server I'm using (error is: Error : package 'gsubfn' does not have a name space). I think this was a problem for R 2.13, and I'm trying to get the admin's t

Re: [R] Good and modern Kernel Regression package in R with auto-bandwidth?

2012-02-23 Thread Liaw, Andy
If that's the kind of framework you'd like to work in, use locfit, which has the predict() method for evaluating new data. There are several different handwidth selectors in that package for your choosing. Kernel smoothers don't really fit the framework of "creating a model object, followed by

Re: [R] DCC-GARCH model

2012-02-23 Thread John Kerpel
Also see the most excellent rmgarch package from A*lexios Ghalanos *available here: https://r-forge.r-project.org/R/?group_id=339 On Thu, Feb 23, 2012 at 9:41 AM, vnatanel wrote: > Dear Marcin, > > > This document should clarify your questions: > > http://www.google.be/url?sa=t&rct=j&q=ccgar

Re: [R] saving all data in r object

2012-02-23 Thread uday
Michael , the first error which I got is "number of items to replace is not a multiple of replacement length" sorry last time it did not copied whole thing -- View this message in context: http://r.789695.n4.nabble.com/saving-all-data-in-r-object-tp4413092p4414058.html Sent from the R help ma

Re: [R] saving all data in r object

2012-02-23 Thread uday
Thanks for reply Michael the error which I got is as follows : Error in gzfile(file, "wb") : cannot open the connection In addition: Warning message: In gzfile(file, "wb") : cannot open compressed file 'data.RData', probable reason 'Permission denied' -- View this message in context: http://

Re: [R] installing the package Rcplex

2012-02-23 Thread zheng wei
Thanks.   I do not understand item 2, what do you mean by add R's bin directory to path?   While directly use to c:\temp and type the commands, it says 'R' is not recognized as an internal or external command.   While I use previous approach by going into the bin directory and type R CMD INSTALL

[R] Advice on exploration of sub-clusters in hierarchical dendrogram

2012-02-23 Thread kosmo7
Dear R user, I am a biochemist/bioinformatician, at the moment working on protein clusterings by conformation similarity. I only started seriously working with R about a couple of months ago. I have been able so far to read my way through tutorials and set-up my hierarchical clusterings. My probl

[R] Case weighting

2012-02-23 Thread Hed Bar-Nissan
The need comes from the PISA data. (http://www.pisa.oecd.org) In the data there are many cases and each of them carries a numeric variable that signifies it's weight. In SPSS the command would be "WEIGHT BY" In simpler words here is an R sample ( What is get VS what i want to get ) > data.rec

Re: [R] changing time span

2012-02-23 Thread phillen
muchas gracias! Exactly what I was looking for, very helpful. Best regards, Philipp -- View this message in context: http://r.789695.n4.nabble.com/changing-time-span-tp4413672p4414007.html Sent from the R help mailing list archive at Nabble.com. __ R-

Re: [R] DCC-GARCH model

2012-02-23 Thread vnatanel
Dear Marcin, This document should clarify your questions: http://www.google.be/url?sa=t&rct=j&q=ccgarch%3A%20an%20r%20package%20for%20building%20multivariate%20garch&source=web&cd=1&ved=0CCMQFjAA&url=http%3A%2F%2Fhhs.diva-portal.org%2Fsmash%2Fget%2Fdiva2%3A320449%2FFULLTEXT02&ei=8V1GT_uDDcLq8QOW

[R] FW: NaN from function

2012-02-23 Thread Jonathan Williams
Dear Helpers, I wrote a simple function to standardise variables if they contain more than one value. If the elements of the variable are all identical, then I want the function to return zero. When I submit variables whose elements are all identical to the function, it returns not zero, but

[R] solnp inversed-Hessian problem

2012-02-23 Thread Diogo Alagador
Dear all, I am tryng to solve a nonlinear optimization probel using the solnp function. I have different datasets. For the smaller I get full solutions, for the bigger I got an error message stating: Iter: 1 fn: 101.8017 Pars: 0.21000 0.21000 0.21

Re: [R] extract subset of data.frame

2012-02-23 Thread R. Michael Weylandt
df[value %in% v, ] Michael On Thu, Feb 23, 2012 at 10:48 AM, syrvn wrote: > Hello, > > > consider the following data.frame df and vector v > > df <- data.frame(group = c("A","B","C","D"), value = c(1,2,3,4)) > v <- c(2,3) > > How can I return a sub data.frame which has only the rows left where v

Re: [R] extract subset of data.frame

2012-02-23 Thread Sarah Goslee
> df[df$value %in% v,] group value 2 B 2 3 C 3 df is a function; you're better off not using that name for your dataframe. Sarah On Thu, Feb 23, 2012 at 10:48 AM, syrvn wrote: > Hello, > > > consider the following data.frame df and vector v > > df <- data.frame(group = c("A",

[R] extract subset of data.frame

2012-02-23 Thread syrvn
Hello, consider the following data.frame df and vector v df <- data.frame(group = c("A","B","C","D"), value = c(1,2,3,4)) v <- c(2,3) How can I return a sub data.frame which has only the rows left where value matches v df: group value B 2 C 3 Cheers -- View this message in context: http:/

[R] TRAMO/SEATS and x12 in R

2012-02-23 Thread Victor
I have a Mac OS X system. To deal with a long monthly electricity demand time-series I use the procedures TRAMO/SEATS with the MS-windows only Demetra programme and X12 under R resorting to the awkward - as far as the output is concerned - x12 R package running the relating Fortran code. I won

Re: [R] Good and modern Kernel Regression package in R with auto-bandwidth?

2012-02-23 Thread Michael
Thank you Andy! I went thru KernSmooth package but I don't see a way to use the fitted function to do the "predict" part... data=data.frame(z=z, x=x) datanew=data.frame(z=z, x=x) lmfit=lm(z~x, data=data) lmforecast=predict(lmfit, newdata=datanew) Am I missing anything here? Thanks! 2012/2/2

Re: [R] (no subject)

2012-02-23 Thread Petr PIKAL
Hi > > Hi, > > The parentheses are in the wrong places in the two if() statements. > > Look here: > > (length(table(x)>1)) > ^^ > (length(table(x)==1)) > ^ ^ > > In both cases you're checking whether > the length of the comparison (table

Re: [R] Good and modern Kernel Regression package in R with auto-bandwidth?

2012-02-23 Thread Liaw, Andy
In short, pick your poison... Is there any particular reason why the tools that shipped with R itself (e.g., kernSmooth) are inadequate for you? I like using the locfit package because it has many tools, including the ones that the author didn't think were optimal. You may need the book to get

Re: [R] installing the package Rcplex

2012-02-23 Thread Uwe Ligges
I give up. Uwe Ligges On 23.02.2012 15:01, zheng wei wrote: Thanks. I do not understand item 2, what do you mean by add R's bin directory to path? While directly use to c:\temp and type the commands, it says 'R' is not recognized as an internal or external command. While I use previous ap

Re: [R] (no subject)

2012-02-23 Thread Sarah Goslee
Hi, The parentheses are in the wrong places in the two if() statements. Look here: (length(table(x)>1)) ^^ (length(table(x)==1)) ^ ^ In both cases you're checking whether the length of the comparison (table(x) > 1) or (table(x) == 1) is 1,

[R] (no subject)

2012-02-23 Thread Jonathan Williams
Dear Helpers, I wrote a simple function to standardise variables if they contain more than one value. If the elements of the variable are all identical, then I want the function to return zero. When I submit variables whose elements are all identical to the function, it returns not zero, but N

Re: [R] changing time span

2012-02-23 Thread Gabor Grothendieck
On Thu, Feb 23, 2012 at 7:09 AM, phillen wrote: > hi there! > i am desperately in need for help. > > i have read in data: > qthm=read.csv("qthm.csv",sep=";",header=TRUE) >  then created time series ie > m2=ts(log(qthm$m2), start=c(1959, 1), frequency=4) > transformed these time series in zoo varia

Re: [R] How can I ran an R command whcih is present as the content of a character object

2012-02-23 Thread R. Michael Weylandt
eval(parse(text = rcom)) Michael On Thu, Feb 23, 2012 at 8:30 AM, Aniruddha Mukherjee wrote: > I have an object called rcom which was created by the command rcom > <-"mean(mat_rix$COL_1)". Also the data-frame mat_rix is well defined with > numeric values in its column 1 and its name is "COL_1".

Re: [R] mgcv: Smoothing matrix

2012-02-23 Thread Simon Wood
There's no function for extracting this directly, as almost anything that you want to do with the smoother matrix can be done in a much more efficient way without computing it explicitly, but here's an example of how to compute it explicitly in the unweighted additive case... library(mgcv) set

[R] How can I ran an R command whcih is present as the content of a character object

2012-02-23 Thread Aniruddha Mukherjee
I have an object called rcom which was created by the command rcom <-"mean(mat_rix$COL_1)". Also the data-frame mat_rix is well defined with numeric values in its column 1 and its name is "COL_1". My question is how to extract (or do something with) the content of rcom so that it provides the m

Re: [R] multiple gsub

2012-02-23 Thread Gabor Grothendieck
On Thu, Feb 23, 2012 at 5:28 AM, TwistedSkies wrote: > Hi Guys, > > I am relatively new to R and was wondering if I could next my gsub command > in identifying one object > > I have data which looks like this:  Taiwan_250km > I want it to look like this:                 Taiwan_250km > > So essenti

Re: [R] How do I save the current session?

2012-02-23 Thread David Winsemius
On Feb 23, 2012, at 2:04 AM, Petr PIKAL wrote: Hi [R] How do I save the current session? savehistory() gives me the option of saving the executable lines only. I'd like to save everything. Using save is not enough? I'm guessing the OP wanted to do what I accomplish in my MacGUI ses

Re: [R] changing time span

2012-02-23 Thread R. Michael Weylandt
? window Michael On Thu, Feb 23, 2012 at 7:09 AM, phillen wrote: > hi there! > i am desperately in need for help. > > i have read in data: > qthm=read.csv("qthm.csv",sep=";",header=TRUE) >  then created time series ie > m2=ts(log(qthm$m2), start=c(1959, 1), frequency=4) > transformed these time

[R] Calculating Pseudo R-squared from nlme

2012-02-23 Thread dadrivr
I am fitting individual growth models using nlme (multilevel models with repeated measurements nested within the individual), and I am trying to calculate the Pseudo R-squared for the models (an overall summary of the total outcome variability explained). Singer and Willett (2003) recommend calcul

Re: [R] Improving performance of split-apply problem

2012-02-23 Thread R. Michael Weylandt
It looks like what you are doing is reasonably efficient: I do think there's a residuals element to the object returned by lm() so you could just call that directly (which will be just a little more efficient). The bulk of the time is probably being taken up in the lm() call, which has alot of ove

[R] non-finite finite-difference value

2012-02-23 Thread Martin Spindler
Dear all, when applying the optim function the following error occured "non-finite finite-difference value" Therefore I would like to ask how one can try to handle such a problem and which strategies have proven useful. (There is only litte guidance on the help list for this kind of problem.)

[R] changing time span

2012-02-23 Thread phillen
hi there! i am desperately in need for help. i have read in data: qthm=read.csv("qthm.csv",sep=";",header=TRUE) then created time series ie m2=ts(log(qthm$m2), start=c(1959, 1), frequency=4) transformed these time series in zoo variables qthmz=merge.zoo(diff(mbase),diff(m2),diff(cpi),diff(rgdp))

  1   2   >