[R] please help

2011-04-14 Thread Arnab Chowdhuri
van=function(a,x,n){ A-matrix(c(x[1]^2,x[1],1,x[2]^2,x[2],1,x[3]^2,x[3],1),byrow=T,nrow=3) for(i in 1:3){ o-x[i] for(j in sort(1:n+1,decreasing=T)){ B[i][j]-(o)^(n+1-j) } } y=vector(length=3) y-B%*%a p=vector(length=3) p-solve(A,y) return(p) } this is my function and I am getting an error

[R] area under roc curve

2011-04-14 Thread agent dunham
Dear all, I want to measure the goodness of prediction of my linear model. That's why I was thinking about the area under roc curve. I'm trying the following, but I don't know how to avoid the error. Any help would be appreciated. library(ROCR) model.lm -

Re: [R] Incremental ReadLines

2011-04-14 Thread Freds
Hi there, I am having a similar problem with reading in a large text file with around 550.000 observations with each 10 to 100 lines of description. I am trying to parse it in R but I have troubles with the size of the file. It seems like it is slowing down dramatically at some point. I would be

Re: [R] File Save As...

2011-04-14 Thread Gene Leynes
as of right now x = function(a) print(a) attr(x, srcref) returns NULL in 2.13, am I doing something wrong? (also, should I post this to a new thread, or the development thread?) About me: I like long walks on the beach, and this is my current version of R: t(as.data.frame(R.Version()))

[R] Comparison of the amount of computation

2011-04-14 Thread helin_susam
Hi dear list, I want to compare the amount of computation of two functions. For example, by using this algorithm; data - rnorm(n=100, mean=10, sd=3) output1 - list () for(i in 1:100) { data1 - sample(100, 100, replace = TRUE) statistic1 - mean(data1) output1 - c(output1, list(statistic1)) }

[R] Clearing Console; of weeks of codes!

2011-04-14 Thread YAddo
Dear All: I do see I have weeks of codes in my console when I check with my arrow up keys. I have been clearing them with Control L but it seems to clear it clear the screen temporally. I do see the previous codes again when I open R the next day, after quitting the session! Q: How do I clear

[R] setting pairwise comparisons of columns (genes)

2011-04-14 Thread Louis Plough
Hi, I have a number of genes (columns) for which I want to examine pairwise associations of genotypes (each row is an individual)...For example (see data below), I would like to compare M1 to M2, M2 to M3, and M1 to M3 (i.e. does ac from M1 tend to be found with bc from M2 more often than

[R] mixed model random interaction term log likelihood ratio test

2011-04-14 Thread seatales
Hello, I am using the following model model1=lmer(PairFrequency~MatingPair+(1|DrugPair)+(1|DrugPair:MatingPair), data=MateChoice, REML=F) 1. After reading around through the R help, I have learned that the above code is the right way to analyze a mixed model with the MatingPair as the fixed

[R] Loading a package shared lib works in 2.12 but not 2.11

2011-04-14 Thread Von Der Hirschheydt, Juergen
Hi, I have a problem with an external library on a previous R version. We've created our own package containing a mixture of C++ as well as R code which works fine under R 2.12.1. However, trying to install the very same package ZIP file on R 2.11.1 will issue an error when loading a library:

[R] setting pairwise comparisons of columns

2011-04-14 Thread Louis Plough
Hi, I have a number of genes (columns) for which I want to examine pairwise associations of genotypes (each row is an individual)...For example (see data below), I would like to compare M1 to M2, M2 to M3, and M1 to M3 (i.e. does ac from M1 tend to be found with bc from M2 more often than

[R] if (cond) expr1 expr2 ??

2011-04-14 Thread Mohammad Tanvir Ahamed
hi , this can be done easily if (cond) expr ex:  for (i in 1: 4)+ {+ if(i==2) print(a)+ if(i==2) print(b)+ } output : [1] a[1] b but i want this  if (cond) expr1 expr 2 i tried this :  for (i in 1: 4)+ {+ if(i==2) (print(b) print(a))+ } output : [1] bError in print(b) print(a) : invalid 'x'

[R] predict()

2011-04-14 Thread Ivo Shterev
Hi, I am experimenting with the function predict() in two versions of R and the R extension package survival. library(survival) set.seed(123) testdat=data.frame(otime=rexp(10),event=rep(0:1,each=5),x=rnorm(10)) testfm=as.formula('Surv(otime,event)~x') testfun=function(dat,fm) {

[R] zooreg and window

2011-04-14 Thread Katrina Bennett
Hello, I have a following time series data head(mend.dat) ID PARAM Year Month Day Value SYM 1 15052500 1 1965 5 15 128 A 2 15052500 1 1965 5 16 135 A 3 15052500 1 1965 5 17 157 A 4 15052500 1 1965 5 18 176 A 5 15052500 1 1965 5 19

[R] extract p-value from mixed model in kinship package

2011-04-14 Thread Ram H. Sharma
Dear R experts I was using kinship package to fit mixed model with kinship matrix. The package looks like lme4, but I could find a way to extract p-value out of it. I need to extract is as I need to analyse large number of variables ( 1). Please help me: require(kinship) Generating random

[R] Clearing Console- rm(list=ls(all=TRUE)) not working for me

2011-04-14 Thread YAddo
Dear all again: I have been trying to clear weeks of codes in my R console, even after quitting and coming back another day!. One of you out there graciously suggested this rm(list=ls(all=TRUE)). I tried this but no dice. Codes tried. Ctrl +L , clears for the time... and the the latest i

[R] Overlaying images at nodes of phylogenetic tree

2011-04-14 Thread Ryan Doherty
Can you recommend an R library that will help me create a diagram of a phylogenetic tree on which specific images are placed at appropriate nodes of the tree? For example, I have specific image files associated with each member of the phylogenetic tree, and I would like to automate the display

[R] Extracting selected rows from a matrix to a submatix

2011-04-14 Thread pankaj borah
I have a matrix M dim(M) [1] 30380   561 I have another list L contains , that contains some row names of matrix M str (L)  chr [1:21037] Now I want to extract the submatrix subM (21037    ,    561)  from the matrix M by matching the rownames (M) to the 21037 rownames o f L How do I do that

Re: [R] Clearing Console; of weeks of codes!

2011-04-14 Thread 1Rnwb
click in console window and type rm(list=ls(all=TRUE)), everything will be gone -- View this message in context: http://r.789695.n4.nabble.com/Clearing-Console-of-weeks-of-codes-tp3447506p3448041.html Sent from the R help mailing list archive at Nabble.com.

[R] error for ttest

2011-04-14 Thread 1Rnwb
Hello all, I have arranged my data as per Dennis's suggestion in this post http://www.mail-archive.com/r-help@r-project.org/msg107156.html. the posted code works fine but when I try to apply it to my data, i get u2 - ddply(xxm, .(plateid, cytokine), as.data.frame.function(f)) Error in

[R] Time data

2011-04-14 Thread Gregory Pierce
Hello fellow R-users, I have a data set that includes times in the hh:mm format. I am uncertain how to tell R that it is time data. Currently when I try to calculate a mean with this time subset, I get an error message: mean(mar2011stats$TT) [1] NA Warning message: In

[R] [R-pkgs] tikzDevice 0.6.0

2011-04-14 Thread Charlie Sharpsteen
Cameron and I are pleased to announce version 0.6.0 of the tikzDevice package which should be available shortly at your local CRAN mirror! The tikzDevice makes it possible to export R graphics as LaTeX code that can be included in other documents or compiled into stand alone figures. The full

[R] Hash table...

2011-04-14 Thread Worik R
To improve the efficiency of a process I am writing I would like to cache results. So I would like a data structure like a hash table. So if I call Z - f(Y) I can cache Z associated with Y: CACHE[Y] - Z I am stumped. I expected to be able to use a list for this but I cannot figure how

Re: [R] Clearing Console- rm(list=ls(all=TRUE)) not working for me

2011-04-14 Thread Rolf Turner
On 14/04/11 15:21, YAddo wrote: Dear all again: I have been trying to clear weeks of codes in my R console, even after quitting and coming back another day!. One of you out there graciously suggested this rm(list=ls(all=TRUE)). I tried this but no dice. Codes tried. Ctrl +L , clears for the

Re: [R] Comparison of the amount of computation

2011-04-14 Thread Petr Savicky
On Wed, Apr 13, 2011 at 04:12:39PM -0700, helin_susam wrote: Hi dear list, I want to compare the amount of computation of two functions. For example, by using this algorithm; data - rnorm(n=100, mean=10, sd=3) output1 - list () for(i in 1:100) { data1 - sample(100, 100, replace =

Re: [R] MLE where loglikelihood function is a function of numerical solutions

2011-04-14 Thread Kristian Lind
HI Berend, Thank you for your reply. 2011/4/13 Berend Hasselman b...@xs4all.nl Questions: 1. why are you defining Bo within a loop? 2. Why are you doing library(nleqslv) within the loop? Yes, I see what you mean. There's no reason for defining that within the loop. Doing both those

Re: [R] Previously attainable fisher's exact test

2011-04-14 Thread peter dalgaard
On Apr 14, 2011, at 01:29 , (Ted Harding) wrote: On 13-Apr-11 17:40:53, Jim Silverton wrote: I have a matrix say, 1 4 23 30 and I want to find the previously attainable fisher's exact test p-value. Is there a way to do this in R? -- Thanks, Jim. I do not understand what you

Re: [R] setting pairwise comparisons of columns

2011-04-14 Thread Tal Galili
Hi Louis, You pose an interesting question. Bellow is my take on a solution. It is a function named compare.all.column.pairs which gets as input the original data (as a data.frame or a matrix, with all the columns you'd want to compare). And also the function you would like to use on each pair

[R] Automatic splitting/combining nested categorical variable in glm

2011-04-14 Thread Jan van der Laan
I have a categorical variable with a nested structure. For example, region: a country is split into parts, which in turn contain provinces, which contain municipalities: Part - Province - Municipality North Province A Municipality 1 Municipality 2 Municipality 3

[R] Krylov subspace computations of matrix exponentials

2011-04-14 Thread Niels Richard Hansen
I use the very nice expm functions available from the expm and Matrix packages. My understanding is that for large sparse matrices the currently best methods available are Krylov subspace methods, but they are as far as I can tell not implemented in either of the packages mentioned, nor in any

Re: [R] Krylov subspace computations of matrix exponentials

2011-04-14 Thread Mario Valle
Look at ExpoKit (http://www.maths.uq.edu.au/expokit/) It implement Krylov methods and is really fast. Unfortunately no R wrapper that I know yet. If you plan to implement it, I can provide my testing code. Ciao! mario On 14-Apr-11 10:16, Niels Richard Hansen wrote: I use

Re: [R] zooreg and window

2011-04-14 Thread Achim Zeileis
On Wed, 13 Apr 2011, Katrina Bennett wrote: Hello, I have a following time series data head(mend.dat) ID PARAM Year Month Day Value SYM 1 15052500 1 1965 5 15 128 A 2 15052500 1 1965 5 16 135 A 3 15052500 1 1965 5 17 157 A 4 15052500 1 1965 5 18

Re: [R] Clearing Console; of weeks of codes!

2011-04-14 Thread Philipp Pagel
I do see I have weeks of codes in my console when I check with my arrow up keys. I have been clearing them with Control L but it seems to clear it clear the screen temporally. CTRL-L simply clears the screen and not the history. I do see the previous codes again when I open R the next day,

Re: [R] setting pairwise comparisons of columns

2011-04-14 Thread peter dalgaard
On Apr 13, 2011, at 21:32 , Louis Plough wrote: Hi, I have a number of genes (columns) for which I want to examine pairwise associations of genotypes (each row is an individual)...For example (see data below), I would like to compare M1 to M2, M2 to M3, and M1 to M3 (i.e. does ac from M1

Re: [R] Comparison of the amount of computation

2011-04-14 Thread helin_susam
Hi Petr, Your idea looks like logically. So, can we say this with your idea; the expected number of computation in unique(sample(...)) is fewer than sample(...). Because, the expected length is 63.39677 in unique case, while the expected length is 100 in non-unique case ? Thanks for reply,

[R] Question about Autoarima and predict function

2011-04-14 Thread Jeela Mohammadian
Hi, I am trying to use autoarima function to make prediction of more than 1 items ( each has 100 values so it is 1x100 dimension matrix) with frequency 52(weekly forecast). The problem is that some of fitted arimas have drift and some not. It gives this error and stop processing Best

[R] Create matrices for time series

2011-04-14 Thread mathijsdevaan
Hi list, I would like to use the following data.frame to generate matrices over a 3 year moving window: DF = data.frame(read.table(textConnection( A B C 80 8025 1995 80 8026 1995 80 8029 1995 81 8026 1996 82 8025 1997 82 8026 1997 83 8025 1997 83 8027 1997 84 8026 1999 84

Re: [R] FW: [r] how to enclose two xyplot

2011-04-14 Thread Francesco Nutini
Did you mean this? http://rgm2.lab.nig.ac.jp/RGM2/func.php?rd_id=latticeExtra:c.trellis In fact I'm already using latticeExtra package because my xyplot is little bit complicated... So, I'm tring, thanks fro tricks baptiste! Francesco Date: Thu, 14 Apr 2011 08:52:45 +1200 Subject: Re: [R]

Re: [R] latex, eps graphics and transparent colors

2011-04-14 Thread Jim Lemon
On 04/14/2011 03:30 AM, Michael Friendly wrote: I have a diagram to be included in latex, where all my figures are .eps graphics (so pdflatex is not an option) and I want to achieve something like the following: three concentric filled circles varying in lightness or saturation. It is easiest to

Re: [R] Hash table...

2011-04-14 Thread Philipp Pagel
On Thu, Apr 14, 2011 at 06:44:53PM +1200, Worik R wrote: To improve the efficiency of a process I am writing I would like to cache results. So I would like a data structure like a hash table. So if I call Z - f(Y) I can cache Z associated with Y: CACHE[Y] - Z I am stumped. I expected to

Re: [R] for loop performance

2011-04-14 Thread Philipp Pagel
I am running some simulations in R involving reading in several hundred datasets, performing some statistics and outputting those statistics to file. I have noticed that it seems that the time it takes to process of a dataset (or, say, a set of 100 datasets) seems to take longer as the

Re: [R] Krylov subspace computations of matrix exponentials

2011-04-14 Thread peter dalgaard
On Apr 14, 2011, at 10:16 , Niels Richard Hansen wrote: A third question. There exists a Fortran implementation called Expokit with an ad hoc license stating that Permission to use, copy, modify, and distribute EXPOKIT and its supporting documentation for non-commercial purposes, is

Re: [R] Clearing Console; of weeks of codes!

2011-04-14 Thread Philipp Pagel
Please reply to the list, so the OP and otheres following the thread can see your contributions. I'm taking this back to r-help. On Thu, Apr 14, 2011 at 01:43:31AM -0700, Mohammad Tanvir Ahamed wrote: you can try it ... rm(list=ls()) No - this has been suggested before and saying it gain

[R] Identify period length of time series automatically?

2011-04-14 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi I have 10.000 simulations for a sensitivity analysis. I have done a few sensitivity analysis for different response variables already, but now, as most of the simulations (if not all) show some cyclic behaviour, see how the independent input

[R] Problem with R 2.13.0 Task Views (on Mac)

2011-04-14 Thread Michael Kubovy
Dear R-users, After upgrading to the recent version of R, I'm having a problem updating task views: sessionInfo() R version 2.13.0 (2011-04-13) Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) locale: [1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1]

Re: [R] Identify period length of time series automatically?

2011-04-14 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 14/04/11 11:57, Mike Marchywka wrote: Date: Thu, 14 Apr 2011 11:29:23 +0200 From: r.m.k...@gmail.com To: r-help@r-project.org Subject: [R] Identify period length of time series

Re: [R] Hash table...

2011-04-14 Thread Duncan Murdoch
On 11-04-14 4:48 AM, Philipp Pagel wrote: On Thu, Apr 14, 2011 at 06:44:53PM +1200, Worik R wrote: To improve the efficiency of a process I am writing I would like to cache results. So I would like a data structure like a hash table. So if I call Z- f(Y) I can cache Z associated with Y:

[R] plotting line graphs for output from crosstabs function

2011-04-14 Thread taby gathoni
Hi R-users, This is a generic question, is there a way to plot a line graph for the output from crosstable function? one of the inputs to the crosstab function is categorical. Taby -- [[alternative HTML version deleted]] __

[R] StructTS fitting problem - can anyone help?

2011-04-14 Thread John Stollberg
I have seen a couple of posts about this, but no solutions. The problem is fitting the Basic Structural Model (BSM) to the AirPassengers time series using StructTS.  For this particular time series, if the length is reduced below 140 months, the BSM fits are bad.  The following illustrates the

Re: [R] Time data

2011-04-14 Thread jim holtman
It depends on how you want to work with the data. Here is an example of converting both to POSIXct and a numeric value: x - c('1:24', '13:46') # convert to POSIXct x.POSIXct - as.POSIXct(x, format = '%H:%M') x.POSIXct [1] 2011-04-14 01:24:00 EDT 2011-04-14 13:46:00 EDT # to get a numeric

[R] loop question

2011-04-14 Thread Thomas
Dear all, I am trying to implement the following in a loop: g - cbind(c(1, 2, 3), c(1, 2, 3)) h - cbind(c(1, 2, 3), c(1, 2, 3)) c - cbind(g[,1]*h[,1], g[,2]*h[,2]) g-rowSums(c) My attempt looks like this but does not produce the desired results as above. for (i in 1:2) {g-

[R] obtain the probability distribution of the slope coefficient

2011-04-14 Thread Enrico R. Crema
Dear All, #I have the following data: primate-log(c(100,95,90,85,80,75,60,40,20,10)) rank-log(1:10) #from which I can compute a linear regression, and obtain the confidence interval for the slope coefficient as follows: res-lm(primate~rank) confint(res,level=0.9)[2,] #Now, what I would like

Re: [R] for loop performance

2011-04-14 Thread Barth B. Riley
Thank you Phillip for your post. I am reading in: 1. a 3 x 100 item parameter file (floating point and integer data) 2. a 100 x 1000 item response file (integer data) 3. a 6 x 1000 person parameter file (contains simulation condition information, person measures) 4. I am then computing several

Re: [R] if (cond) expr1 expr2 ??

2011-04-14 Thread Ista Zahn
Hi Tanvir, Line breaks matter in R. If I understand correctly you want for (i in 1: 4){ if(i == 2){ print(a) print(b) } } Best, Ista On Wed, Apr 13, 2011 at 10:07 PM, Mohammad Tanvir Ahamed mashra...@yahoo.com wrote: hi , this can be done easily if (cond) expr ex: for (i in 1:

Re: [R] add names to data frame

2011-04-14 Thread Henrique Dallazuanna
The matrix is generated by print.dist function ( getS3method(print, dist) ). You could try this: d - as.matrix(dist(matrix(rnorm(27), 9), diag = TRUE, upper = TRUE)) colnames(d) - letters[1:9] On Wed, Apr 13, 2011 at 1:29 PM, Radhouane Aniba arad...@gmail.com wrote: Hi, I have a vector V

Re: [R] Create matrices for time series

2011-04-14 Thread Gabor Grothendieck
On Thu, Apr 14, 2011 at 3:51 AM, mathijsdevaan mathijsdev...@gmail.com wrote: Hi list, I would like to use the following data.frame to generate matrices over a 3 year moving window: DF = data.frame(read.table(textConnection(  A  B  C 80  8025  1995 80  8026  1995 80  8029  1995 81  8026  

Re: [R] Extracting selected rows from a matrix to a submatix

2011-04-14 Thread Dennis Murphy
Hi: Here's an example: m - as.data.frame(matrix(rnorm(1), nrow = 100)) dim(m) [1] 100 100 # Assign rownames to rows of m rownames(m) - paste('A', 1:100, sep = '') # Select a random subset of the rownames vn - sample(rownames(m), 50) # Subset m by selecting the rownames from vn m2 -

Re: [R] predict()

2011-04-14 Thread Terry Therneau
--- begin included message --- I am experimenting with the function predict() in two versions of R and the R extension package survival. library(survival) set.seed(123) testdat=data.frame(otime=rexp(10),event=rep(0:1,each=5),x=rnorm(10)) testfm=as.formula('Surv(otime,event)~x')

Re: [R] [SOLVED] loop question

2011-04-14 Thread Thomas
Many thanks for all the quick replies... On 14/04/2011 13:37, Hao Wu wrote: you can use this instead, apply(g*h,1,sum) On Thu, Apr 14, 2011 at 7:28 PM, Thomas thomas.tri...@cantab.net mailto:thomas.tri...@cantab.net wrote: Dear all, I am trying to implement the following in a

Re: [R] for loop performance

2011-04-14 Thread Philipp Pagel
On Thu, Apr 14, 2011 at 06:50:56AM -0500, Barth B. Riley wrote: Thank you Phillip for your post. I am reading in: 1. a 3 x 100 item parameter file (floating point and integer data) 2. a 100 x 1000 item response file (integer data) 3. a 6 x 1000 person parameter file (contains simulation

Re: [R] Comparison of the amount of computation

2011-04-14 Thread Petr Savicky
On Thu, Apr 14, 2011 at 12:40:53AM -0700, helin_susam wrote: Hi Petr, Your idea looks like logically. So, can we say this with your idea; the expected number of computation in unique(sample(...)) is fewer than sample(...). Because, the expected length is 63.39677 in unique case, while the

Re: [R] error for ttest

2011-04-14 Thread Dennis Murphy
Hi: It's hard to diagnose the problem without an illustrative example. Perhaps the following might help: (1) When writing a function to use in ddply(), make a generic data frame the input argument to the function and refer to the variables within the function either with the $ notation

Re: [R] for loop performance

2011-04-14 Thread Martin Morgan
On 04/13/2011 02:55 PM, Barth B. Riley wrote: Dear list I am running some simulations in R involving reading in several hundred datasets, performing some statistics and outputting those statistics to file. I have noticed that it seems that the time it takes to process of a dataset (or, say, a

Re: [R] MLE where loglikelihood function is a function of numerical solutions

2011-04-14 Thread Berend Hasselman
On 14-04-2011, at 09:00, Kristian Lind wrote: HI Berend, Thank you for your reply. .. Finally the likelihood function at the end of your code #Maximum likelihood estimation using mle package library(stats4) #defining loglikelighood function #T - length(v) #minuslogLik -

[R] how to code a restriction matrix with the following restrictions

2011-04-14 Thread sébastien saegesser
Dear list members, I need to fit a regression with two inequality constraints. I look up in the literature and R archive and found some ways to do it, for example using the ic.infer package. However I do not know how to write in R my constraints. In the package help, it is told that I

Re: [R] Problem with R 2.13.0 Task Views (on Mac)

2011-04-14 Thread peter dalgaard
On Apr 14, 2011, at 11:45 , Michael Kubovy wrote: Dear R-users, After upgrading to the recent version of R, I'm having a problem updating task views: Yes, a bug in the ctv package needs fixing... sessionInfo() R version 2.13.0 (2011-04-13) Platform: x86_64-apple-darwin9.8.0/x86_64

Re: [R] Previously attainable fisher's exact test

2011-04-14 Thread Jim Silverton
What Ted and Peter did were Fisher's exact test, To get the previous attainable p-value, what you do is the the fisher exact test p-values of ALL the possible tables with margins fixed and choose the p-value that is just below the one for fisher's exact test of the original table. n Thu, Apr 14,

[R] help on compare two ranks

2011-04-14 Thread Baoqiang Cao
Hi, I have to one set of inputs and their observed true values of each input. Now I have a model takes the input and predict a value. I only consider the ranks based on either the observed true values or the predicted values. My question is how do I compare this two rank in R? That is, how close

Re: [R] Using help in Windows version of R with disabled browser [SOLVED]

2011-04-14 Thread Ranjan Maitra
Hi, Just wanted to mention that this worked perfectly. Many thanks again and best wishes, Ranjan On Tue, 12 Apr 2011 13:04:14 -0500 Jonathan P Daily jda...@usgs.gov wrote: try: options(help_type = 'text') ?options If this works, you can create a site profile (A default is created

[R] appending to a vector

2011-04-14 Thread dirknbr
Which one is more efficient? x2=c() for (i in 1:length(x)) { x2=c(x2,func(x[i])) } or x2=x for (i in 1:length(x)) { x2=func(x[i]) } where func is any function? Dirk -- View this message in context: http://r.789695.n4.nabble.com/appending-to-a-vector-tp3449109p3449109.html Sent from the

[R] Error is assocplot

2011-04-14 Thread suparna mitra
Hello, I have a contingency table showing relation between two datasets. I tried to see association among them with the assocplot, but it shows error. mosaicplot of the same data worked perfectly. Can anyone please help me. Con.table=as.matrix(Con.table) dim(Con.table) [1] 27 27

Re: [R] question about optim

2011-04-14 Thread chirine wolley
thank you very much for your response! But I have now another problem: optim( ) gives me the exactly same initial values for the 4 parameters. I have tried many initial values, and it always didnt change them. opt$convergence = 1. I increased the number of iterations, but the problem is

Re: [R] Identify period length of time series automatically?

2011-04-14 Thread Mike Marchywka
Date: Thu, 14 Apr 2011 11:29:23 +0200 From: r.m.k...@gmail.com To: r-help@r-project.org Subject: [R] Identify period length of time series automatically? -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi I have 10.000 simulations for a

Re: [R] Incremental ReadLines

2011-04-14 Thread Mike Marchywka
Date: Wed, 13 Apr 2011 10:57:58 -0700 From: frederikl...@gmail.com To: r-help@r-project.org Subject: Re: [R] Incremental ReadLines Hi there, I am having a similar problem with reading in a large text file with around 550.000 observations with

[R] Rcpp segmentation faults on the simplest code

2011-04-14 Thread didu
Hi all, I'm new to R and Rcpp, and I'm trying to learn Rcpp with the simplest code possible. My goal is to be able to call R functions from C++. The code I'm trying to run is: #include #include #include #include int main(int argc, char* argv[]) { Rcpp::NumericVector v(1);

[R] Return Level Confidence Intervals

2011-04-14 Thread Champion, Adrian
Hi I'm trying to plot several return level plots on the same axes to compare the return levels from different data sets. To do this I am having to manually plot the return levels for return periods. The problem is when I try to plot the automatically calculated confidence intervals as the

[R] Lm.fit extracting r-squared

2011-04-14 Thread jhn_nolan
Dear list, I am running a fama macbeth regression using the lm.fit function and am having problems extracting the rsquareds from each of the cross sectional regressions (second stage) I have estimated. I can obtain the coefficients using cfit = lm.fit(t(bhat[-1,]), t(q))$coefficients However I

Re: [R] error for ttest: solved

2011-04-14 Thread 1Rnwb
I knew that the NA's in my data were the root cause of the trouble, but did not find out how to get rid of them. Untill I found your another post mentioning to use 'na.omit' to remove the lines containing 'NA's and the problem got fixed after that. Thanks for the help and all the trouble you have

[R] problem with library tseriesChaos

2011-04-14 Thread mike1989
Hi R-Users I need to estimate Lyapunov exponent of my time series. After reading description of all functions available I still don't know how to determine time delay. My time series length is 4200. Is it possible to determine time delay with other function's output or I can choose any random

Re: [R] Clearing Console; of weeks of codes!

2011-04-14 Thread 1Rnwb
Thanks, I thought that removing the list would take care of it. the question is I do not see a .Rhistory file in my current working directory, so where it is stored. it is not visible in C:\Program files\R either. Serarching the C;\ and D:\ drives shows some old .Rhistory files but not the recent

Re: [R] question about optim‏

2011-04-14 Thread chirine wolley
thank you very much for your response! But I have now another problem: optim( ) gives me the exactly same initial values for the 4 parameters. I have tried many initial values, and it always didnt change them. opt$convergence = 1. I increased the number of iterations, but the problem is

Re: [R] predict()

2011-04-14 Thread Ivo Shterev
Dear Dr. Therneau, Thank you for your response. Just to point out that we didn't experience any problems with the lm() function under R version 2.12.2 (2011-02-25): set.seed(123) testdat=data.frame(y=rexp(10),event=rep(0:1,each=5),x=rnorm(10)) testfm=as.formula('y~x')

Re: [R] Clearing Console; of weeks of codes!

2011-04-14 Thread B77S
If you don't want your history, why not just do this. q() Save workspace image? [y/n/c]: n ?? Am I missing something? 1Rnwb wrote: Thanks, I thought that removing the list would take care of it. the question is I do not see a .Rhistory file in my current working directory, so where it

Re: [R] Comparison of the amount of computation

2011-04-14 Thread helin_susam
Dear Pert, Many thanks to your reply. Fully you are right! Best wishes, Helin. -- View this message in context: http://r.789695.n4.nabble.com/Comparison-of-the-amount-of-computation-tp3448436p3449722.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Wilcoxon rank sum in unbalanced design

2011-04-14 Thread netrunner
Dear Peter, thank you for your reply. It works very well! I have an additional question: what about the Wilcoxon test in case of unequal paired samples with ties? thank you! net -- View this message in context:

Re: [R] appending to a vector

2011-04-14 Thread Sarah Goslee
Hi Dirk, On Thu, Apr 14, 2011 at 4:59 AM, dirknbr dirk...@gmail.com wrote: Which one is more efficient? x2=c() for (i in 1:length(x)) {  x2=c(x2,func(x[i])) } or x2=x for (i in 1:length(x)) {  x2=func(x[i]) } where func is any function? This one. Creating a

Re: [R] Previously attainable fisher's exact test

2011-04-14 Thread peter dalgaard
On Apr 14, 2011, at 16:55 , Jim Silverton wrote: What Ted and Peter did were Fisher's exact test, To get the previous attainable p-value, what you do is the the fisher exact test p-values of ALL the possible tables with margins fixed and choose the p-value that is just below the one for

Re: [R] Previously attainable fisher's exact test

2011-04-14 Thread Ted Harding
Thanks for the clarification, Jim. The terminology previous was not self-explanatory! The following implements (in a somewhat crude way, but explicit) a solution to your question: M - matrix(c(1, 4, 23, 30), byrow=TRUE, ncol=2) M # [,1] [,2] # [1,]14 # [2,] 23 30

Re: [R] how to enclose two xyplot

2011-04-14 Thread Francesco Nutini
ok ?c.trellis works well. But I still have a problem. One of my plot is a combination of two xyplot on different scales: a-xyplot(NDVI_P10~dek_num | Year, type=a, data=data, xlim=c(1,37), ylim=c(0.1,0.8), as.table = TRUE, layout = c(13,1), aspect = 2, col=darkgrey, col.axis=black, lwd=3,

Re: [R] appending to a vector

2011-04-14 Thread Jonathan P Daily
Neither is the fastest method. The best way would be to vectorize func so that it accepts and returns a vector. Many builtin R functions do this and say so in their documentation. The slower way would be to use one of the apply functions, such as: ?lapply x2 - lapply(x, func) If you must use

Re: [R] Identify period length of time series automatically?

2011-04-14 Thread Mike Marchywka
Date: Thu, 14 Apr 2011 12:42:28 +0200 From: r.m.k...@gmail.com To: marchy...@hotmail.com CC: r-help@r-project.org Subject: Re: [R] Identify period length of time series automatically? -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On

Re: [R] Categorical bubble plot

2011-04-14 Thread Ben Bolker
Jurgens de Bruin debruinjj at gmail.com writes: Hi, I do not have much R experience just the basics, so please excuse any obvious questions. I would like to create bubble plot that have Categorical data on the x and y axis and then the diameter if the bubble the value related to x and

Re: [R] for loop performance

2011-04-14 Thread Barth B. Riley
Thanks Martin, this is very helpful. Barth -Original Message- From: Martin Morgan [mailto:mtmor...@fhcrc.org] Sent: Thursday, April 14, 2011 11:04 AM To: Barth B. Riley Subject: Re: [R] for loop performance On 04/14/2011 07:12 AM, Barth B. Riley wrote: Hi Martin Question--when

[R] How to see a R code from a package?

2011-04-14 Thread Soyeon Kim
Dear R users, Hi. I want know R code of a function: predict.cv.glmnet (which is included in glmnet package). Could you let me know how I can see the R code of the function? Thank you, Soyeon Kim __ R-help@r-project.org mailing list

[R] trouble with \SweaveOpts{grdevice=...}

2011-04-14 Thread Liviu Andronic
Dear all I've just tried the brand new 'grdevice' option in Sweave but couldn't make it work. When I declare \SweaveOpts{grdevice=pdf} or \SweaveOpts{grdevice=cairo_pdf} trying to plot something simple fig=T, echo=T= plot(1:10,1:10,main='Some title') @ would result in an Sweave error:

Re: [R] Incremental ReadLines

2011-04-14 Thread William Dunlap
I have two suggestions to speed up your code, if you must use a loop. First, don't grow your output dataset at each iteration. Instead of cases - 0 output - numeric(cases) while(length(line - readLines(input, n=1))==1) { cases - cases + 1 output[cases] -

Re: [R] How to see a R code from a package?

2011-04-14 Thread Kevin Wright
See help for getAnywhere() Kevin On Thu, Apr 14, 2011 at 11:24 AM, Soyeon Kim yunni0...@gmail.com wrote: Dear R users, Hi. I want know R code of a function: predict.cv.glmnet (which is included in glmnet package). Could you let me know how I can see the R code of the function? Thank

Re: [R] How to see a R code from a package?

2011-04-14 Thread Steve Lianoglou
You could also just download the source package from CRAN and look through it. The thing is, the predict.cv.glmnet function isn't exported by the package (via its namespace file) -- so it's somehow protected. You could still see it using `:::`, like so: R glmnet:::predict.cv.glmnet

[R] Reshaping and plotting tabular data

2011-04-14 Thread tsippel
Hi- Tabular data have been provided to me within .csv files. I need to transform the data from tabular format into a dataframe with three columns. The columns need to be the table row id, table column id, and the tabulated variable. An example dataset can be downloaded here:

[R] Automatically extract info from Granger causality output

2011-04-14 Thread ivan
Dear Community, this is my first programming in R and I am stuck with a problem. I have the following code which automatically calculates Granger causalities from a variable, say e.g. bs as below, to all other variables in the data frame: log.returns-as.data.frame( lapply(daten, function(x)

[R] saving a regression model to a file

2011-04-14 Thread Alison Callahan
Hello all, First off, I am using R version 2.13.0 in Ubuntu. I have read previous posts in the R mailing list on saving models for later use, and the responses indicate using the R save() function to save a model and then using load() to load it is one way to go. However, when I use the save()

  1   2   >