Re: [R] User input(unknown name and number of files)

2011-07-23 Thread Bansal, Vikas
can you please suggest me any book or paper or website which explains this problem because I have started using R before 3 weeks only and i will not be able to understand your whole code.so if i will study about this problem it will be very good for me.I have tried in some books and also on

[R] convert TS dataframe to evenly spaced intervals?

2011-07-23 Thread Derrick Lin
Hi R-help, I have a dataframe consisting of a time-series [t, v]. The timestamps aren't at all evenly spaced. The values are continuous. I've been able to graph this as a step function (which is what it should be) in ggplot2, using the 'step' geom. Now I would like to take the integral of the

Re: [R] R on Multicore for Linux

2011-07-23 Thread Lei Jiang
Madana, The code below may work (untested though): #above is the same as you wrote require(multicore) read.data.exmple - function(f) { dat - read.csv(f, header=FALSE, sep=\t, na.strings=,dec=., strip.white=TRUE, fill=TRUE) data_1 - sqldf(SELECT V2, V14, MIN(V16) FROM dat WHERE

Re: [R] elimination duplicate elements sampling!

2011-07-23 Thread elephann
Great! The second way really helped me! Thank you so much! -- View this message in context: http://r.789695.n4.nabble.com/elimination-duplicate-elements-sampling-tp3652791p3687613.html Sent from the R help mailing list archive at Nabble.com. __

[R] Picking returns from particular days of the month from a zoo object

2011-07-23 Thread john nicholas
Hello, I would like to implement a turn-of-the-month' trading strategy in R. Given a daily series of stock market return data as a zoo object, the strategy would go long (buy) four trading days before the end of the month, and sell the third trading day of the following month. How can I

Re: [R] summarized data set - how to use an occurs field

2011-07-23 Thread mloxton
David, thanks, I think that should work perfectly Much obliged   dfrm - expand.grid(A=1:3, B=1:3)   dfrm$counts - 1:9   xtabs(counts~A, data=dfrm) A   1  2  3 12 15 18  barplot(xtabs(counts~A, data=dfrm), xlab=Counts by A level) -- David Winsemius, MD West Hartford, CT

[R] averaging rows based on string¿?

2011-07-23 Thread alfredo
Hi Folks, Ran into something I'd really like to do in R simply/elegantly, but my R - coding skills seem surpassed. This is the thing. Imagine the following data: labs-c(abcdef,abcgg,tgthefdk,tgtijuel,tgtnjmoi,gbnt,dlift) dat-c(0.5,0.25,1,2,16,0.250,4) dframe-data.frame(labs,dat) I would like to

Re: [R] matched pairs

2011-07-23 Thread Ellen S.
Thanks everyone! I finally got some code to work (thanks to William Dunlap). -- View this message in context: http://r.789695.n4.nabble.com/matched-pairs-tp3687506p3687864.html Sent from the R help mailing list archive at Nabble.com. __

[R] Plotting compound functions--help with defining x-axis as f(x)

2011-07-23 Thread Aimee Jones
Hi all, I'm having trouble locating a script that will allow to me to create graphs that show compound functions as a function of the simple function, rather than just x (or time as it is in my case). Currently I have the following functions defined in my script: T1-function(t)

[R] library 'ts' not available?

2011-07-23 Thread cplusplus programmer
hi, When I type library(ts) (I am working on an ubuntu machine), I get the following error: library(ts) Error in library(ts) : there is no package called 'ts' I did a few google searches and it seems like ts is no longer availableis that correct? It seemed to me that I would need to

Re: [R] Lattice: place ticks only on y-axis

2011-07-23 Thread marcel
Working! Many thanks, good solutions -- View this message in context: http://r.789695.n4.nabble.com/Lattice-place-ticks-only-on-y-axis-tp3684094p3688167.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing

[R] help on panel.superpose

2011-07-23 Thread Bharath Kumar
Dear users, I am new to R and have couple of problems with xyplot. A) I am trying to use the xyplot to plot mean concentration vs time across 5 dose groups. When i use the following script xyplot(mean~time,groups=dose,type=b,panel=panel.superpose). R generates the plot, but i have no control

Re: [R] Lattice: distance of Y-axis label from plot

2011-07-23 Thread marcel
Got it working using layout.widths = list(ylab.axis.padding = 0.5))) and adjusting the print position in print(plot1, position=c(-0.018,0.221,0.741,0.466)). Thx -- View this message in context: http://r.789695.n4.nabble.com/Lattice-distance-of-Y-axis-label-from-plot-tp3686855p3688172.html

[R] Trouble getting plot to appear

2011-07-23 Thread cherron
Hello, I am currently working on a script and I output plots to pdf using pdf(...) plot(...) dev.off() then later I was trying to plot something and when I run just plot(...) nothing appears. Is there something about using plot(..) after dev.off() that does not allow the window to pop up? In

[R] Store elements in a list in a triple for loop

2011-07-23 Thread katarv
Hi, I have a triple loop that goes through all elements of a list Lst[[k]][[i,j]] and I want to pick only elements of Lst[[k]][[i,j]] 0.4 or any value. Then I want to store the values of Lst[[k]][[i,j]] together with their i,j,k values in another list. Say I have Lst[[2]][[4,7]] = 0.6, I

[R] xml2-config issues

2011-07-23 Thread Abraham Mathew
I'm trying to install the XML package on Ubuntu 10.10, and I keep getting a warning message the XML could not be found and had non-zero exit status. How can I fix this problem? install.packages() Loading Tcl/Tk interface ... done --- Please select a CRAN mirror for use in this session ---

[R] Fit elipse to xy scatter

2011-07-23 Thread DrCJones
Hi, I know there is a package 'elipse' available but I'm not sure how to use it for my specific implementation. What I would like to do is fit an elipse to two lines of identity (at right angles to each other), as indicated in the following figure:

[R] glmnet with binary logistic regression

2011-07-23 Thread fongchun
Hi all, I am using the glmnet R package to run LASSO with binary logistic regression. I have over 290 samples with outcome data (0 for alive, 1 for dead) and over 230 predictor variables. I currently using LASSO to reduce the number of predictor variables. I am using the cv.glmnet function to

[R] An infinite recursion error please explain!

2011-07-23 Thread mousy0815
Probability - function(N, f, w, b, y, t, q) { #N is the number of lymph nodes #f is the fraction of Dendritic cells (in the correct node) that have the antigen #w is time in terms of hours #b is the starting position (somewhere in the node or somewhere in the gap

[R] Question about output from twitteR package

2011-07-23 Thread Doug Luke
Dear R-List, I am trying to develop a tutorial on how to analyze network data from Twitter conversations for a network analysis class that I teach. I came across the twitteR package, and saw some examples of it in action on various websites. It is easy to use, and almost as easy to understand.

[R] How to solve ergodic density/distribution using R

2011-07-23 Thread Hong Yu
May I have a question on how to solve the following problem by R code? Mainly we want to solve the equation show in the attached image. The equation is a continuous version of Markov process. In the equation, we have been able to achieve two things using R code: [1] From year-2009 sample

Re: [R] help on panel.superpose

2011-07-23 Thread Duncan Mackay
I too am unsure what is required, perhaps xyplot(y~x,data,col=c(3,4),groups=id,pch=c(12,13), type= c(p,r)) a toy dataset would have helped Perhaps a perusal of http://lmdvr.r-forge.r-project.org/figures/figures.html is required Regards Duncan Mackay Department of Agronomy and Soil Science

[R] Use ks.test() or an alternative in C/C++ application

2011-07-23 Thread Jochen1980
Hi, I am looking for an opportunity to make a KS-Test in my C/C++-app. Unfortunately I am not able to find a lib or function in C or C++ which does the job. For my other numerical stuff Gnu Scientific Library was recommended to me. What to do now? I read that there are options to call R in

Re: [R] Picking returns from particular days of the month from a zoo object

2011-07-23 Thread Joshua Ulrich
On Fri, Jul 22, 2011 at 2:37 PM, john nicholas jbnich...@sbcglobal.net wrote:  Hello, I would like to implement a turn-of-the-month' trading strategy in R. Given a daily series of stock market return data as a zoo object, the strategy would go long (buy) four trading days before the end of

Re: [R] glmnet with binary logistic regression

2011-07-23 Thread Patrick Breheny
On 07/22/2011 07:51 PM, fongchun wrote: I am using the glmnet R package to run LASSO with binary logistic regression. ... What I am finding is that this optimal lambda value fluctuates everytime I run glmnet with LASSO. ... Does anyone know why there is such a fluctuation in the generation

[R] Problem with read.shape in maptools

2011-07-23 Thread Axel Urbiz
Hi, I'd like to read a shapefile into a Map object. This is exactly what read.shape{maptools} is suppoed to do, according to the documentation I found in the link below. However, this doesn't seem to work library(maptools)x - read.shape(system.file(shapes/sids.shp, package=maptools)[1])Error:

[R] sum part of a vector

2011-07-23 Thread Simon Kiss
Dear colleagues, I have a data set that looks roughly like this; mydat-data.frame(state=c(rep(Alabama, 5), rep(Delaware, 5), rep(California, 5)), news=runif(15, min=0, max=8), cum.news=rep(0, 15)) For each state, I'd like to cumulatively sum the value of news and make that put that value in

Re: [R] [R-sig-Geo] Problem with read.shape in maptools

2011-07-23 Thread Roger Bivand
On Sat, 23 Jul 2011, Axel Urbiz wrote: Hi, I'd like to read a shapefile into a Map object. This is exactly what read.shape{maptools} is suppoed to do, according to the documentation I found in the link below. Do search the archives properly; the second hit on googling list:R-sig-geo

Re: [R] xml2-config issues

2011-07-23 Thread Mike Marchywka
Date: Fri, 22 Jul 2011 20:06:34 -0600 From: abmathe...@gmail.com To: r-help@r-project.org Subject: [R] xml2-config issues I'm trying to install the XML package on Ubuntu 10.10, and I keep getting a warning message the XML could not be found

Re: [R] sum part of a vector

2011-07-23 Thread Weidong Gu
Hi Simon, Is this what you want? mydat$cum.news-unlist(tapply(mydat$news,mydat$state,FUN=cumsum)) Weidong Gu On Sat, Jul 23, 2011 at 7:11 AM, Simon Kiss sjk...@gmail.com wrote: Dear colleagues, I have a data set that looks roughly like this; mydat-data.frame(state=c(rep(Alabama, 5),

Re: [R] xml2-config issues

2011-07-23 Thread Prof Brian Ripley
On Fri, 22 Jul 2011, Abraham Mathew wrote: I'm trying to install the XML package on Ubuntu 10.10, and I keep getting a warning message the XML could not be found No, that is not the *error* message you quote below. and had non-zero exit status. How can I fix this problem? Install libxml2

Re: [R] sum part of a vector

2011-07-23 Thread peter dalgaard
On Jul 23, 2011, at 13:11 , Simon Kiss wrote: Dear colleagues, I have a data set that looks roughly like this; mydat-data.frame(state=c(rep(Alabama, 5), rep(Delaware, 5), rep(California, 5)), news=runif(15, min=0, max=8), cum.news=rep(0, 15)) For each state, I'd like to cumulatively sum

Re: [R] Picking returns from particular days of the month from a zoo object

2011-07-23 Thread Gabor Grothendieck
On Fri, Jul 22, 2011 at 3:37 PM, john nicholas jbnich...@sbcglobal.net wrote:  Hello, I would like to implement a turn-of-the-month' trading strategy in R. Given a daily series of stock market return data as a zoo object, the strategy would go long (buy) four trading days before the end of

[R] graphic problem: transparent window when starting mtrace() from package debug

2011-07-23 Thread Jannis
Deal R , when I use the package debug, mark a function with mtrace() and enter into the browser like mechanism of debug a window displaying the code of the marked function with the current line highlighted usually appears. When I use GUIs other than ess or the standard R console sometimes

[R] determining system time for sequence of commands

2011-07-23 Thread Jannis
Dear list members, I am trying to figure out how much CPU time individual commands inside one of my functions consume. Is it possible to obtain the CPU times of a whole sequence of commands inside a function? I know how to use system.time() but this would only give me the time consumed by

Re: [R] averaging rows based on string¿?

2011-07-23 Thread Dennis Murphy
Hi: Try this: labs - c(abcdef,abcgg,tgthefdk,tgtijuel,tgtnjmoi,gbnt,dlift) dat - c(0.5,0.25,1,2,16,0.250,4) dframe - data.frame(labs, dat, stringsAsFactors = FALSE) dframe$lab2 - factor(substr(dframe$lab, 1, 3)) aggregate(dat ~ lab2, data = dframe, FUN = mean) lab2 dat 1 abc 0.375000 2

[R] Achieving 'reverse-Vech' of a matrix

2011-07-23 Thread Megh Dal
Let say i have a square matrix and applied the 'vech' operator to stack the lower triangular elements into a vector: Mat - matrix(1:25, 5) Mat      [,1] [,2] [,3] [,4] [,5] [1,]    1    6   11   16   21 [2,]    2    7   12   17   22 [3,]    3    8   13   18   23 [4,]    4    9   14   19   24

Re: [R] inside p value 'e'

2011-07-23 Thread Dieter Menne
xy wrote: I have like 5.075e-12 , 3.207e-05, 7.438e-07 and 9.393e-08 *** , i dont know what number they are http://en.wikipedia.org/wiki/Floating_point -- View this message in context: http://r.789695.n4.nabble.com/inside-p-value-e-tp3688961p3689167.html Sent from the R help mailing

Re: [R] determining system time for sequence of commands

2011-07-23 Thread Dieter Menne
jannis-2 wrote: I am trying to figure out how much CPU time individual commands inside one of my functions consume. Is it possible to obtain the CPU times of a whole sequence of commands inside a function? See the example under proc.time() Dieter -- View this message in context:

Re: [R] R on Android, at least on DOS

2011-07-23 Thread Dieter Menne
zcatav wrote: If this isn't, a DOS version may be helpfull to run on Android under dosbox. Wow, a mind boggling bummer! Dieter -- View this message in context: http://r.789695.n4.nabble.com/R-on-Android-at-least-on-DOS-tp3688847p3689176.html Sent from the R help mailing list archive

Re: [R] Use ks.test() or an alternative in C/C++ application

2011-07-23 Thread Dieter Menne
Jochen1980 wrote: I am looking for an opportunity to make a KS-Test in my C/C++-app. Unfortunately I am not able to find a lib or function in C or C++ which does the job. For my other numerical stuff Gnu Scientific Library was recommended to me. What to do now? I read that there are

Re: [R] Achieving 'reverse-Vech' of a matrix

2011-07-23 Thread Ted Harding
On 23-Jul-11 17:12:09, Megh Dal wrote: Let say i have a square matrix and applied the 'vech' operator to stack the lower triangular elements into a vector: Mat - matrix(1:25, 5) Mat _ _ _[,1] [,2] [,3] [,4] [,5] [1,] _ _1 _ _6 _ 11 _ 16 _ 21 [2,] _ _2 _ _7 _ 12 _ 17 _ 22 [3,] _ _3 _ _8 _

[R] Testing two independent samples for null of same skewness and kurtosis?

2011-07-23 Thread Eduardo M. A. M.Mendes
Hello I wonder whether there is an r tool or package available for testing for the null of same skewness or kurtosis of two independent samples. It semes that nsRFA package uses L-moments for soothing similar but I could not get how to use the package for the above test. Any pointers,

Re: [R] analizing .txt file with R or an other program

2011-07-23 Thread Daniel Malter
Hi, The blunt answer is: by learning R. In particular, you will need pattern matching techniques as in ?grep and (somewhat advanced, some would call it basic) knowledge of R. So if you aren't familiar with either, I would suggest an introductory manual or one of the many websites you find online

Re: [R] An infinite recursion error please explain!

2011-07-23 Thread Carl Witthoft
Not sure, but I played a little with the progression of w and m, and it appears that it doesn't take long for their values to converge (i.e. they don't change any more). Once that happens, D is not going to change. Further, unless I'm misreading the if {...} indents, you appear to be

Re: [R] Extend my code to run several data at once.

2011-07-23 Thread Daniel Malter
If you just want to apply the function over successive columns of a data frame use apply(name.of.data.frame, 2 , llik) Daniel EdBo wrote: Hi I have a code that calculate maximisation using optimx and it is working just fine. I want to extend the code to run several colomns of R_j where

Re: [R] score test for logistic regression

2011-07-23 Thread Thomas Lumley
On Fri, Jul 22, 2011 at 8:00 PM, peter dalgaard pda...@gmail.com wrote: On Jul 21, 2011, at 23:11 , David Winsemius wrote: On Jul 21, 2011, at 3:38 PM, zlu wrote: Hi Peter, I'm not sure how many people still have 9 month old postings on their mail client and will know that Peter

Re: [R] score test for logistic regression

2011-07-23 Thread peter dalgaard
On Jul 24, 2011, at 00:20 , Thomas Lumley wrote: On Fri, Jul 22, 2011 at 8:00 PM, peter dalgaard pda...@gmail.com wrote: On Jul 21, 2011, at 23:11 , David Winsemius wrote: On Jul 21, 2011, at 3:38 PM, zlu wrote: Hi Peter, I'm not sure how many people still have 9 month old

Re: [R] squared pie chart - is there such a thing?

2011-07-23 Thread Thomas Levine
How about just a stacked bar plot? barplot(matrix(c(3,5,3),3,1),horiz=T,beside=F) Tom On Fri, Jul 22, 2011 at 7:14 AM, Naomi Robbins nbrgra...@optonline.net wrote: Hello! It's a shoot in the dark, but I'll try. If one has a total of 100 (e.g., %), and three components of the total, e.g.,

Re: [R] Extracting components from a 'boot' class output in R

2011-07-23 Thread Tim Hesterberg
Do names(bootObj) to find out what the components are, and use $ or [[ to extract components. Do help(boot) for a description of components of the object (look in the Value section). That is general advice in R, applying to all kinds of objects - boot, and many other functions such as lm(),