[R] comparing vectors with condition

2012-02-13 Thread arunkumar1111
Hi I have two vector x=c(10,30,40,50) total=c(20,20,0,10) Var_exceeding_total=sum(as.numeric(x total)) This will compare the vectors x and total a gives the result. if i want to compare only if the y 0 . can we apply condition in the comparison ? - Thanks in Advance Arun --

Re: [R] Reading in csv with footer

2012-02-13 Thread chuck.01
I believe this should work d - read.table(foo.csv, header=T, sep=,, comment=T) although its spitting back a warning... this used to work for me. Noah Silverman wrote Hi, I have a CSV file that is formatted well, except that the last line is a summary not is CSV format. Toy

Re: [R] comparing vectors with condition

2012-02-13 Thread chuck.01
sum(ifelse(x*total!=0, as.numeric(x total), 0)) arunkumar wrote Hi I have two vector x=c(10,30,40,50) total=c(20,20,0,10) Var_exceeding_total=sum(as.numeric(x total)) This will compare the vectors x and total a gives the result. if i want to compare only if the y 0 . can

Re: [R] Assigning a function to the 'times' argument of rep()

2012-02-13 Thread Petr Savicky
On Sun, Feb 12, 2012 at 07:56:48PM -0800, z2.0 wrote: Question: I'm trying to use paste() with rep() to reformat a series of values as zip codes. e.g., if column 1 looks like: 52775 83111 99240 4289 112 57701 20001 I want rows 4 and 5 to read, 04289 00112 My thought was

Re: [R] Writing output into a file

2012-02-13 Thread Suranga Kasthurirathne
Hi everyone, I tried writing this data into a file using the save(myList, file=test1.bin) command, but unfortunately, the numerical values seem to get garbled when I do so. The numbers in my RGui look like 0, 0.5, 0, 1 etc. etc. But when I stored it into a .bin file, and

[R] Retrieve by Id from an R list

2012-02-13 Thread Suranga Kasthurirathne
Hi everyone, I'm using the poLCA module for some analysis work. Basically, Im using the command poLCA(f, data=response,nclass=2) This returns a poLCA object (a list) From this data, I need to retrieve certain indexes, such as[[5]] as seen below. [[5]] Pr(1) Pr(2)

Re: [R] finding and describing missing data runs in a time series

2012-02-13 Thread Ted Harding
On 13-Feb-2012 Durant, James T. (ATSDR/DTEM/PRMSB) wrote: Hi - I am trying to find and describe missing data in a time series. For instance, in the library openair, there is a data frame called mydata: library(openair) head(mydata) date ws wd nox no2 o3 pm10so2 co pm25 1

[R] Release plans for 2.14.2 and 2.15.0

2012-02-13 Thread Peter Dalgaard
It is the intention of the R Core Team to release the finalized version of the 2.14.x series at the end of February, and soon thereafter to start the run-in for 2.15.0. I.e., 2.14.2 Gift-Getting Season on Feb 29 (3rd anniversary of R-1.0.0!) 2.15.0 Easter Beagle on Mar 30 (We'll see about

[R] Is it possible to run multiple instances of Tinn-R?

2012-02-13 Thread RNoob
Dear All, is there anyone using Tinn R, who knows if it's possible to run more than one instance of Tinn R on one machine? I'd like to run more than one R process (R Term) at a time from Tinn R. Any help will be appreciated. Thanks. -- View this message in context:

Re: [R] dotplots with error bars

2012-02-13 Thread Jim Lemon
On 02/13/2012 09:51 AM, Colin Wahl wrote: Does anyone have any recommendations for producing dotplots with error bars? Are there packages available for this? I searched far and wide and cannot find a suitable option. I am trying to produce publication-quality figures for my thesis results.

Re: [R] dotplots with error bars

2012-02-13 Thread Matthieu Dubois
Colin Wahl biowahl at gmail.com writes: Does anyone have any recommendations for producing dotplots with error bars? Are there packages available for this? I searched far and wide and cannot find a suitable option. Dear Colin, have a look at this page from the R wiki:

[R] see NA

2012-02-13 Thread Soheila Khodakarim
Dear All I want to chose just spacial columns in R. (read table) data1- read.table(/home/Documents/data.txt,header=F,sep = \t, as.is =F) data.2-data1[sub.data[,1],] The dimension of data.2 is correct but my data are transformed NA head(data.2) V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13

Re: [R] Retrieve by Id from an R list

2012-02-13 Thread Petr Savicky
On Mon, Feb 13, 2012 at 02:13:41PM +0530, Suranga Kasthurirathne wrote: Hi everyone, I'm using the poLCA module for some analysis work. Basically, Im using the command poLCA(f, data=response,nclass=2) This returns a poLCA object (a list) From this data, I need to retrieve certain

Re: [R] see NA

2012-02-13 Thread Uwe Ligges
GHard to tell given the file is not available nor do we see the first lines of it. Uwe Ligges On 13.02.2012 10:51, Soheila Khodakarim wrote: Dear All I want to chose just spacial columns in R. (read table) data1- read.table(/home/Documents/data.txt,header=F,sep = \t, as.is =F)

[R] logical operator for different dimensions

2012-02-13 Thread uday
I have some dataset sci.pre - 0.300.380.500.650.801.031.331.72 2.22 2.873.815.066.759.00 11.97 14.15 16.34 19.04 22.27 25.49 29.72 34.67 40.47 47.29 55.29 64.67 75.6 88.50 103.50 121.10 141.70 165.80 194.00

[R] Error from GNLS (undefined columns selected)

2012-02-13 Thread Louis Salomon
 Dear R-helpers, I'm a new R-user and I was trying to gain some experience with the GNLS function of the NLME package.  This is an extract from my dataset (it's a 432x6 data.frame) called input, in the first column I have the values that I need to fit, while the remaining columns are input

Re: [R] Discrete Event Simulation problem

2012-02-13 Thread jism7690
I have made some chances and I believe now the only problem is making the system reorder. Please any help would be great test - function(seed = 123456789, maxStock= 100, minStock = 20,t.max=1100,inventory =50) { LAST = t.max START = 0 t.demand = START t.supply = START t.current = START

Re: [R] R-help Digest, Vol 108, Issue 13

2012-02-13 Thread 丁飞
dear: i want to know how to get a survival curve of the Cox proportional risk regression, thank you. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] logical operator for different dimensions

2012-02-13 Thread Petr Savicky
On Mon, Feb 13, 2012 at 02:08:52AM -0800, uday wrote: I have some dataset sci.pre - 0.300.380.500.650.801.031.331.72 2.22 2.873.815.066.759.00 11.97 14.15 16.34 19.04 22.27 25.49 29.72 34.67 40.47 47.29 55.29

Re: [R] function arrows.circular not working

2012-02-13 Thread Chosid, David (MISC)
Indeed. Thanks for the solution :) -Original Message- From: Sarah Goslee [mailto:sarah.gos...@gmail.com] Sent: Friday, February 10, 2012 1:01 PM To: Chosid, David (FWE); r-help Subject: Re: [R] function arrows.circular not working It's a good idea to acknowledge that you've found a

Re: [R] Any package for best subset selection on random effects model?

2012-02-13 Thread Ben Bolker
zbleach zt020200 at gmail.com writes: Hi Pros, I know leaps() computes the best subset selection for linear model, and the bestglm() computes the best subset selection for generalized linear model. Is there any package for best subset selection on random effects model, or mixed

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

2012-02-13 Thread Djordje Bajic
I've been investigating and I partially respond myself. I tried the packages 'bigmemory' and 'ff' and for me the latter did the work I need pretty straightforward. I create the array in filebacked form with the function ff, and it seems that the usual R indexing works well. I have yet to see the

[R] kernlab - rvm error message: Error in if (length(data) != vl)

2012-02-13 Thread Martin Batholdy
Hi, I am trying to perform relevance vector machines with the rvm-function from kernlab. On one dataset I get this message: Setting default kernel parameters Error in if (length(data) != vl) { : RMate stopped at line 0 of selection missing value where TRUE/FALSE needed Calls: rvm ...

[R] kernlab - error message: array(0, c(n, p)) : 'dim' specifies too large an array

2012-02-13 Thread Martin Batholdy
Hi, For another trainingset I get this error message, which again is rather cryptic to me: Setting default kernel parameters Error in array(0, c(n, p)) : 'dim' specifies too large an array RMate stopped at line 0 of selection Calls: rvm ... .local - backsolve - as.matrix - chol - diag -

Re: [R] see NA

2012-02-13 Thread David Winsemius
On Feb 13, 2012, at 4:51 AM, Soheila Khodakarim wrote: Dear All I want to chose just spacial columns in R. (read table) data1- read.table(/home/Documents/data.txt,header=F,sep = \t, as.is =F) data.2-data1[sub.data[,1],] What is sub.data? are you migrating to R from a language where

Re: [R] kernlab - error message: array(0, c(n, p)) : 'dim' specifies too large an array

2012-02-13 Thread Martin Batholdy
I am using a linear kernel (vanilladot). By switching the kernel, I actually get rid of the error message, but I would like to stick to the linear one ... On 13.02.2012, at 16:23, Martin Batholdy wrote: Hi, For another trainingset I get this error message, which again is rather cryptic

Re: [R] kernlab - error message: array(0, c(n, p)) : 'dim' specifies too large an array

2012-02-13 Thread David Winsemius
On Feb 13, 2012, at 10:23 AM, Martin Batholdy wrote: Hi, For another trainingset I get this error message, which again is rather cryptic to me: Just imagine how it seems to us! Setting default kernel parameters Error in array(0, c(n, p)) : 'dim' specifies too large an array RMate

Re: [R] R-help Digest, Vol 108, Issue 13

2012-02-13 Thread Milan Bouchet-Valat
Le lundi 13 février 2012 à 19:48 +0800, 丁飞 a écrit : dear: i want to know how to get a survival curve of the Cox proportional risk regression, thank you. See the relevant part of the Survival Task View here: http://cran.r-project.org/web/views/Survival.html And more specifically, see the

[R] multi-regression with more than 50 independent variables

2012-02-13 Thread R DF
Hi R Users, I am going to run a multiple linear regression with around 57 independent variables. Each time I run the model with just 11 variables, the results are reasonable. With increasing the number of independent variables more than 11, the coefficients will get “NA” in the output. Is there

[R] Wavelet and inverse wavelet to filter data

2012-02-13 Thread bergdepp
Dear Friends of R, I would like to filter high frequent turbulence data with wavelet analysis. Therefore i want to calculate the wavelet coefficients of the raw data. And then the inverse for a special frequency band. How can i do this in the best and easiest way? Many thanks for your answers

Re: [R] Error in apply(x2, 1, diff) : dim(X) must have a positive length

2012-02-13 Thread hithit168
Thank you for your help, David. I was trying to run bootrapping on the dataset shoes from MASS package. But I still have some problem here. as.matrix(data.frame(shoes),nrows=10,ncols=2,byrow=T) A B [1,] 13.2 14.0 [2,] 8.2 8.8 [3,] 10.9 11.2 [4,] 14.3 14.2 [5,] 10.7 11.8 [6,] 6.6 6.4 [7,] 9.5 9.8

Re: [R] Writing output into a file

2012-02-13 Thread Rui Barradas
Hello, I tried writing this data into a file using the save(myList, file=test1.bin) command, but unfortunately, the numerical values seem to get garbled when I do so. The numbers in my RGui look like 0, 0.5, 0, 1 etc. etc. But when I stored it into a .bin file, and retrieved it using

Re: [R] logical operator for different dimensions

2012-02-13 Thread uday
Hi Petr, You were correct , thats was the mistake . I am sorry for last reply. now its working. Cheers Uday -- View this message in context: http://r.789695.n4.nabble.com/logical-operator-for-different-dimensions-tp4383316p4384143.html Sent from the R help mailing list archive at

Re: [R] How to import time-series data

2012-02-13 Thread RichardSmith
Gabor Grothendieck wrote Try this xyplot.zoo lattice graph. Time series are represented in columns so we transpose the data and convert it to zoo. The screen= argument available in xyplot.zoo groups series into panels: Lines - plant,aphid,1,2,3,4

[R] non linear quantile regression - Median not plotting where it should

2012-02-13 Thread Dan Morovitz
Hi, I'm attempting to calculate the 0.25 and 0.97 quantiles for tree height (0-50 meters) against tree age (0-300 years) and I am running into some difficulty with the plotted grafic. I've run the examples in the quantreg help and can get those to work properly and by plugging in my data I

[R] Two surfaces in one plot with visibility

2012-02-13 Thread Sebastian Schubert
Hi, I would like plot two surfaces which are each given by vectors x and y, and a matrix m(x,y) representing the z coordinate. With persp() I can plot both, using par(new=TRUE) I can put it in one plot. However, I would like to have the visibility of the surfaces taken into account as if they are

[R] MCMCglmm with cross-classified random effects

2012-02-13 Thread Agostino Moro
Dear R-users, I would like to fit a glmm with cross-classified random effects with the function MCMCglmm. Something along the lines: model1-MCMCglmm(response~pred1, random=~re1+re2, data=data) where re1 and re2 should be crossed random effects. I was wondering whether you could tell me

[R] Deleting rows and columns containing NA's and only

2012-02-13 Thread syrvn
Hello, I use read.xls from the gdata package to read in xlsx files. Sometimes these data.frames contain NA columns and rows only. I know how to get rid of those ones but here is the R output of a test data set read in with read.xls t1 A B X D X.1

Re: [R] kernlab - error message: array(0, c(n, p)) : 'dim' specifies too large an array

2012-02-13 Thread Martin Batholdy
Ok, I am sorry, My trainingset consists of a 60 x 204 matrix (independent_training – 204 features). I have 60 continuous labels (dependent_training, ranging from 2.25 to 135). this is all the code I use: library(kernlab) rvm(as.matrix(independent_training), dependent_training, type=regression,

Re: [R] Writing output into a file

2012-02-13 Thread Suranga Kasthurirathne
Hi, many thanks for the reply. I really appreciate it. Since I'm still very new to R, I think I should take some time to research what you suggested. (I don't want to keep posting basic questions to the list all the time) But still, thank you so much for being helpful... On Mon, Feb 13, 2012

Re: [R] Two surfaces in one plot with visibility

2012-02-13 Thread Duncan Murdoch
On 13/02/2012 9:24 AM, Sebastian Schubert wrote: Hi, I would like plot two surfaces which are each given by vectors x and y, and a matrix m(x,y) representing the z coordinate. With persp() I can plot both, using par(new=TRUE) I can put it in one plot. However, I would like to have the

Re: [R] how to plot a nice legend?

2012-02-13 Thread William Stockhausen
Jonas, A relatively simple way to get the legend to plot beside a graph is to use the layout function to create two plot areas, create the graph in the first area and the legend in the second area. You can fool around with the location of the legend by changing the parameters to layout:

Re: [R] multi-regression with more than 50 independent variables

2012-02-13 Thread David L Carlson
You need to spend some time reading about multiple regression. In statistics there is always what is possible and what is advisable. I'm not going to address whether a regression of 57 independent variables is advisable, only possible. For your data, it is not possible. The attached data contain

Re: [R] non linear quantile regression - Median not plotting where it should

2012-02-13 Thread Roger Koenker
Dan, It is hard to say without being able to reproduce your example. If you send me the data I could try to advise something. Roger url:www.econ.uiuc.edu/~rogerRoger Koenker emailrkoen...@uiuc.eduDepartment of Economics vox: 217-333-4558

[R] Suggests/Enhances or .onLoad for S3-methods for optional package

2012-02-13 Thread Jon Olav Skoien
Hi, I am developing a package B that, among other things, also offers some extra S3-methods for functions in package A if the user has installed A. I do not want to list A under Depends of B, as the dependency list of A is rather long, and most potential users of B will not be interested in

Re: [R] kernlab - error message: array(0, c(n, p)) : 'dim' specifies too large an array

2012-02-13 Thread Steve Lianoglou
Hi, On Mon, Feb 13, 2012 at 10:53 AM, Martin Batholdy batho...@googlemail.com wrote: Ok, I am sorry, My trainingset consists of a 60 x 204 matrix (independent_training – 204 features). I have 60 continuous labels (dependent_training, ranging from 2.25 to 135). this is all the code I use:

Re: [R] kernlab - error message: array(0, c(n, p)) : 'dim' specifies too large an array

2012-02-13 Thread Steve Lianoglou
Sorry, this: options(error=utils:::dum.frames) Should be: options(error=utils:::dump.frames) -steve -- Steve Lianoglou Graduate Student: Computational Systems Biology  | Memorial Sloan-Kettering Cancer Center  | Weill Medical College of Cornell University Contact Info:

Re: [R] Two surfaces in one plot with visibility

2012-02-13 Thread Sebastian Schubert
Hi! On 13/02/12 17:15, Duncan Murdoch wrote: I would like plot two surfaces which are each given by vectors x and y, and a matrix m(x,y) representing the z coordinate. [..] I would like to have the visibility of the surfaces taken into account as if they are solid thin surfaces, so that for

Re: [R] How to import time-series data

2012-02-13 Thread Gabor Grothendieck
On Mon, Feb 13, 2012 at 8:23 AM, RichardSmith richardsmith...@gmail.com wrote: Gabor Grothendieck wrote Try this xyplot.zoo lattice graph.   Time series are represented in columns so we transpose the data and convert it to zoo.  The screen= argument available in xyplot.zoo groups series into

Re: [R] Deleting rows and columns containing NA's and only

2012-02-13 Thread Petr Savicky
On Mon, Feb 13, 2012 at 07:48:11AM -0800, syrvn wrote: Hello, I use read.xls from the gdata package to read in xlsx files. Sometimes these data.frames contain NA columns and rows only. I know how to get rid of those ones but here is the R output of a test data set read in with read.xls

Re: [R] Error in apply(x2, 1, diff) : dim(X) must have a positive length

2012-02-13 Thread R. Michael Weylandt
What package is the bootstrap() function from? There are many functions by that name My hunch is that it takes a vector at a time and puts it through dif.mns so that leads to the error in the apply() call but I can't verify. Michael On Mon, Feb 13, 2012 at 10:34 AM, hithit168

[R] Including .exe files in an R package

2012-02-13 Thread sahir bhatnagar
I am in the process of creating a package in R which calls pre-compiled C code i.e. '.exe' files In reading the manual, I came across this: A source package if possible should not contain binary executable files: they are not portable, and a security risk if they are of the appropriate

[R] pairwise comparisons with multcomp package

2012-02-13 Thread gaiarrido
Hi, I've got this model and following Hothorn et al advices, I used glht for a post hoc comparison modezqM-glm(rojos~estacion*zona3,quasipoisson,subset=(edadysexo==M)) anova(modezqM,test=F) Df Deviance Resid. Df Resid. Dev F

[R] Cumulative density (kernel smoothing)

2012-02-13 Thread francogrex
Hi, in R there is the function density which computes kernel density estimates. Is there a cumulative version of it? Something like they have in Matlab: http://www.mathworks.nl/help/toolbox/stats/ksdensity.html I know there is ecdf, but I'm not sure it's based on kernel density smoothing. Thanks

Re: [R] Deleting rows and columns containing NA's and only

2012-02-13 Thread syrvn
Hi, thanks for you suggestion. I finally solved it in a different way using apply and is.na for TRUE NA's and if(as.character(x) == NA) etc. However, I just spotted that read.xls seems to have problems reading in special characters such as or . Is there any workaround for that? -- View this

Re: [R] Including .exe files in an R package

2012-02-13 Thread Prof Brian Ripley
On 13/02/2012 17:15, sahir bhatnagar wrote: I am in the process of creating a package in R which calls pre-compiled C code i.e. '.exe' files Which are only used on Windows, so presumably you forgot to mention that OS. In reading the manual, I came across this: A source package if possible

[R] Logistic regression with non-gaussian random effects

2012-02-13 Thread Line Skotte
Hi, does anyone know of an implementation of generalized linear models with random effects, where the random effects are non-gaussian? Actually, what I need is to do a logistic regression (or binomial regression) where the linear predictor in addition to fixed effects and gaussian random

Re: [R] Error in apply(x2, 1, diff) : dim(X) must have a positive length

2012-02-13 Thread hithit168
Thanks. I use the bootstrap() function from the bootstrap package. Let me try it again to see if I get any luck :) -- View this message in context: http://r.789695.n4.nabble.com/Error-in-apply-x2-1-diff-dim-X-must-have-a-positive-length-tp4382435p4384608.html Sent from the R help mailing list

Re: [R] non-isomorphic sequences

2012-02-13 Thread zheng wei
Dear All, Sorry for the typoes earlier, let me repost the question. Suppose I want to generate sequences of length 3 from two symbols {1,2}, we get the following 8 sequences 1 1 1 1 1 2 1 2 1 1 2 2 2 1 1 2 1 2 2 2 1 2 2 2 However, I do not want all these 8 sequences. I call two sequencs to be

Re: [R] best subset selection on random effects model

2012-02-13 Thread ilai
The question is where do your models come from? Passing nested models to ?anova.lme in nlme package or lme4 results in a likelihood ratio test. Are you looking for something else/more ? On Sun, Feb 12, 2012 at 8:02 PM, Tao Zhang zt020...@gmail.com wrote: Hi,     I know leaps() computes the

Re: [R] Cumulative density (kernel smoothing)

2012-02-13 Thread David Winsemius
On Feb 13, 2012, at 1:01 PM, francogrex wrote: Hi, in R there is the function density which computes kernel density estimates. Is there a cumulative version of it? Something like they have in Matlab: I'm not aware of one, but you could use `integrate`. You will need to limit your range

[R] for loop

2012-02-13 Thread eddie smith
Hi guys, This is a very beginner question. Anybody willing to help? for(i in 1:1000) x=29.5 + i/500 y=2x plot(y,x) The idea is to produce 1000 values of x and y then plot them. Cheers, Eddie [[alternative HTML version deleted]] __

Re: [R] for loop

2012-02-13 Thread jim holtman
x - 29.5 + (1:1000)/500 y - 2 * x plot(y,x) On Mon, Feb 13, 2012 at 1:34 PM, eddie smith eddie...@gmail.com wrote: Hi guys, This is a very beginner question. Anybody willing to help? for(i in 1:1000) x=29.5 + i/500 y=2x plot(y,x) The idea is to produce 1000 values of x and y then plot

Re: [R] Deleting rows and columns containing NA's and only

2012-02-13 Thread David Winsemius
On Feb 13, 2012, at 1:05 PM, syrvn wrote: Hi, thanks for you suggestion. I finally solved it in a different way using apply and is.na for TRUE NA's and if(as.character(x) == NA) etc. However, I just spotted that read.xls seems to have problems reading in special characters such as or

[R] meboot - can it handle outliers and missing values?

2012-02-13 Thread isabella
Hi everyone, I would like to use your meboot package in R in a power simulation study, where meboot stands for Maximum Entropy Bootstrap. In this study, each time series that will be bootstrapped includes both missing values and outliers. Can meboot

[R] only 0s may be mixed with negative subscripts

2012-02-13 Thread Hasan Diwan
I'd like to get the sum of every other row in a data.frame. When I actually set about doing this, I get the error in the subject line of this message. A sample of my data is below, followed by the function call that should give me the results I want: dput(head(sens2)) structure(list(Time =

Re: [R] Getting codebook data into R

2012-02-13 Thread rmailbox
This is how I get a whole SPSS data files into R. You specifically asked about the codebook, so this may not be exactly what you are after. spssFileInfo - spss.system.file ( file = path to my SPSS file ) spssDataSet - as.data.set ( spssFileInfo) spssDataFrame - as.data.frame ( spssDataSet )

Re: [R] Deleting rows and columns containing NA's and only

2012-02-13 Thread syrvn
Hi David, I am using read.xls not read.table. -- View this message in context: http://r.789695.n4.nabble.com/Deleting-rows-and-columns-containing-NA-s-and-only-tp4384173p4384866.html Sent from the R help mailing list archive at Nabble.com. __

[R] Puzzling... puzzling... puzzling...

2012-02-13 Thread Michael
Hi all, I made sure that it's env$sRes1$nPositionsOptimizedM that's correct... not the env$sRes1$nPositionsOptimized... But it seems both point to the same memory area... This is very dangerous because I have used naming conventions such as: MyLongVariableNameForA MyLongVariableNameForB

Re: [R] Deleting rows and columns containing NA's and only

2012-02-13 Thread David Winsemius
On Feb 13, 2012, at 1:57 PM, syrvn wrote: Hi David, I am using read.xls not read.table. Please read the help page for read.xls more carefully. -- View this message in context: http://r.789695.n4.nabble.com/Deleting-rows-and-columns-containing-NA-s-and-only-tp4384173p4384866.html Sent

Re: [R] for loop

2012-02-13 Thread Ted Harding
In addition to Jim's neat solution (see also below), some comments on your original code. Your for loop executes x=29.5 + i/500 100 times, producing a single value each time and replacing the previous value which was in x. So, at the end of the loop, you have a single value of x. Then you compute

Re: [R] Puzzling... puzzling... puzzling...

2012-02-13 Thread Duncan Murdoch
On 13/02/2012 2:00 PM, Michael wrote: Hi all, I made sure that it's env$sRes1$nPositionsOptimizedM that's correct... not the env$sRes1$nPositionsOptimized... But it seems both point to the same memory area... How did you determine that? The test below just shows that they contain the

[R] R's AIC values differ from published values

2012-02-13 Thread david hamer
Using the Cement hardening data in Anderson (2008) Model Based Inference in the Life Sciences. A Primer on Evidence, and working with the best model which is lm ( y ~ x1 + x2,data = cement ) the AIC value from R is model-lm ( formula = y ~ x1 + x2 ,

[R] Question scatterplot axis cut point

2012-02-13 Thread Michael Methlagl
Hi everybody, i made a scatterplot using the command plot (datafile1, xlim=c(0,10), ylim=c(0.001, 1), log=y, xlab=x Achse, ylab=y Achse, frame.plot=FALSE, axes = TRUE). Now i have a problem. There is a gap between the x and the y axis. I want that the x and y axis cut at 0 and 0.001 without

Re: [R] R's AIC values differ from published values

2012-02-13 Thread Bert Gunter
This is answered in ?AIC. Have you read it? -- Bert On Mon, Feb 13, 2012 at 10:22 AM, david hamer j.david.ha...@gmail.com wrote: Using the Cement hardening data in Anderson (2008) Model Based Inference in the Life Sciences. A Primer on Evidence, and working with the best model which is    lm

Re: [R] Puzzling... puzzling... puzzling...

2012-02-13 Thread William Dunlap
Replace the syntax List$Name with List[[Name]] and see if things work better. '[[' does not do the partial matching that '$' does. E.g., x - list(AB=10, BC=20, CD=30) x$A # returns 10 because A is the initial part of exactly one name in x, AB x[[A]] # returns NULL However, if you have

Re: [R] R's AIC values differ from published values

2012-02-13 Thread Mark Leeds
hi: the definition of AIC can vary a lot from paper to paper and textbook to textbook because some people keep the multiplicative constants and other's don't. all that matters when using AIC is COMPARISON. the value itself means nothing. So, you'll be fine no matter what you use as long as you're

Re: [R] nice report generator?

2012-02-13 Thread Duncan Murdoch
On 06/02/2012 4:12 PM, Hadley Wickham wrote: 2. It's more flexible to construct the language object as a language object, rather than pasting something together and parsing it. For one thing, that allows non-syntactic variable names; I think it's also easier to read. So your code

Re: [R] non-isomorphic sequences

2012-02-13 Thread Petr Savicky
On Mon, Feb 13, 2012 at 10:05:02AM -0800, zheng wei wrote: Dear All, Sorry for the typoes earlier, let me repost the question. Suppose I want to generate sequences of length 3 from two symbols {1,2}, we get the following 8 sequences 1 1 1 1 1 2 1 2 1 1 2 2 2 1 1 2 1 2 2 2 1 2 2 2

[R] Singling out observations

2012-02-13 Thread Kurt_Helf
Greetings I am attempting to plot observations of a cave aquatic invertebrate dating from 1901-2004. I can come up with a nice lattice plot of the eight sites from which I have data easily enough. However, I'd like to be able to highlight the 0 observations on the plots, i.e., attempts to

[R] access R basic libraries

2012-02-13 Thread nitin kumar
Hello Everyone, I am trying to access all R basic C/Fotran libraries to see how some functions are written in fotran or C so that in case I need to change some stuff I can do that. Any help would be great, nitin [[alternative HTML version deleted]]

Re: [R] MCMCglmm with cross-classified random effects

2012-02-13 Thread Ben Bolker
Agostino Moro agostino.moro99 at gmail.com writes: I would like to fit a glmm with cross-classified random effects with the function MCMCglmm. Something along the lines: model1-MCMCglmm(response~pred1, random=~re1+re2, data=data) where re1 and re2 should be crossed random effects.

Re: [R] access R basic libraries

2012-02-13 Thread Berend Hasselman
On 13-02-2012, at 21:47, nitin kumar wrote: Hello Everyone, I am trying to access all R basic C/Fotran libraries to see how some functions are written in fotran or C so that in case I need to change some stuff I can do that. BTW; it's fortran. Well, goto CRAN (http://cran.r-project.org/)

[R] entropy package: how to compute mutual information?

2012-02-13 Thread Sam Steingold
suppose I have two factor vectors: x - as.factor(c(a,b,a,c,b,c)) y - as.factor(c(b,a,a,c,c,b)) I can compute their entropies: entropy(table(x)) [1] 1.098612 using library(entropy) but it is not clear how to compute their mutual information directly. I can compute the joint entropy as

Re: [R] for loop

2012-02-13 Thread eddie smith
Dear Ted, Thank you very much for your details explanation! Cheers. On Mon, Feb 13, 2012 at 7:12 PM, Ted Harding ted.hard...@wlandres.netwrote: In addition to Jim's neat solution (see also below), some comments on your original code. Your for loop executes x=29.5 + i/500 100 times,

Re: [R] entropy package: how to compute mutual information?

2012-02-13 Thread Sam Steingold
* Sam Steingold f...@tah.bet [2012-02-13 16:14:36 -0500]: suppose I have two factor vectors: x - as.factor(c(a,b,a,c,b,c)) y - as.factor(c(b,a,a,c,c,b)) I can compute their entropies: entropy(table(x)) [1] 1.098612 using library(entropy) but it is not clear how to compute their

[R] Writing R-scripts

2012-02-13 Thread Cem Girit
Hello, This is my first attempt to write a script in R. The program below is intended to do some parametric tests on group data. There are subroutines for each type of test. The call to the parametric.tests, routine sets the argument testtype for the test to be used. How can I transfer

[R] Change dataframe-structure

2012-02-13 Thread David Studer
Hello everybody, I have the following problem and have no idea how to solve it: In my dataframe I have six columns representing six societal problems (p1, p2, ..., p6). The values are ranks between 1 (worst problem) and 6 (best problem) p1 p2 p3 p4 p5 p6 1 3 2 5 4 6 2 3 1 6

[R] Error Message Comes from the Vuong Function

2012-02-13 Thread mikezhaow
I want to compare the poisson and the zero-inflated poisson distribution on describing the data. So, after using the GLM and the ZEROINFL function, I used the Voung function to compare them. Here is my code: library(pscl) glm1 - glm(nmer9_1[, 1] ~ 1, family = poisson) zip - zeroinfl(nmer9_1[,

[R] If (x 0)

2012-02-13 Thread Schmidt, Michael
Hi, I am new to R. I was trying to get a very simple program to run. Take one number from the command line. If the number 0 return -1. If number 0 return 1 and if the number == 0 return 0. The code is in a file called test1.R The code: #useage: R --no-save --args 5 test1.R args =

Re: [R] non-isomorphic sequences

2012-02-13 Thread zheng wei
Dear Petr,   This is fantastic!   I have one more question, when p=4, tt=4. We have 15 non-isomorphic sequences as you have generated. Among these 15, I selected 2 sequences. How do I recover all the members of the equivalent classes corresponding to these 2 sequences? For example,

Re: [R] non-isomorphic sequences

2012-02-13 Thread Petr Savicky
On Mon, Feb 13, 2012 at 02:04:51PM -0800, zheng wei wrote: Dear Petr,   This is fantastic!   I have one more question, when p=4, tt=4. We have 15 non-isomorphic sequences as you have generated. Among these 15, I selected 2 sequences. How do I recover all the members of the equivalent

[R] matrix subsetting

2012-02-13 Thread Sam Steingold
if I have a vector, I can find the indexes which satisfy a condition: x - rnorm(10) [1] 0.4751132 -0.5442322 -0.1979854 -0.2455521 0.8349336 -0.4283345 [7] 0.6108130 2.0576160 1.1251716 -1.3933637 x[x0] [1] 0.4751132 0.8349336 0.6108130 2.0576160 1.1251716 (1:10)[x0] [1] 1 5 7 8 9 how

Re: [R] Change dataframe-structure

2012-02-13 Thread Gabor Grothendieck
On Mon, Feb 13, 2012 at 5:07 PM, David Studer stude...@gmail.com wrote: Hello everybody, I have the following problem and have no idea how to solve it: In my dataframe I have six columns representing six societal problems (p1, p2, ..., p6). The values are ranks between 1 (worst problem) and

Re: [R] Change dataframe-structure

2012-02-13 Thread Bert Gunter
P - paste(P,1:6,sep=) t(apply(yourdataframe,1,function(x)P[order(x)])) ## result is a mtrix, though. -- Bert On Mon, Feb 13, 2012 at 2:07 PM, David Studer stude...@gmail.com wrote: Hello everybody, I have the following problem and have no idea how to solve it: In my dataframe I have six

Re: [R] Change dataframe-structure

2012-02-13 Thread Justin Haynes
There is probably a more ellegant way, but: df - data.frame(p1=c(1,2,1),p2=c(3,3,2),p3=c(2,1,3),p4=c(5,6,4),p5=c(4,4,6),p6=c(6,5,5)) as.data.frame(t(apply(df,1,function(x) names(x)[match(1:6,x)]))) V1 V2 V3 V4 V5 V6 1 p1 p3 p2 p5 p4 p6 2 p3 p1 p2 p5 p6 p4 3 p1 p2 p3 p4 p6 p5 On Mon, Feb

[R] survey package svystat objects from predict()

2012-02-13 Thread Kieran Healy
Hello, I'm running R 2.14.1 on OS X (x86_64-apple-darwin9.8.0/x86_64 (64-bit)), with version 3.28 of Thomas Lumley's survey package. I was using predict() from svyglm(). E.g.: data(api) dstrat-svydesign(id=~1,strata=~stype, weights=~pw, data=apistrat, fpc=~fpc) out -

Re: [R] only 0s may be mixed with negative subscripts

2012-02-13 Thread ilai
The function you posted runs without error (on these 6 lines), but does not return anything that looks remotely like a sum, or cumsum of anything. Can you clarify what you are trying to do? I assume by sum of every other row you don't mean summing Time, X and Y for rows 1,3,5,..., ? For the sum

Re: [R] matrix subsetting

2012-02-13 Thread R. Michael Weylandt michael.weyla...@gmail.com
which(x0) or which(x0, arr.ind=TRUE) depending on your application. Michael On Feb 13, 2012, at 5:38 PM, Sam Steingold s...@gnu.org wrote: if I have a vector, I can find the indexes which satisfy a condition: x - rnorm(10) [1] 0.4751132 -0.5442322 -0.1979854 -0.2455521 0.8349336

Re: [R] only 0s may be mixed with negative subscripts

2012-02-13 Thread Hasan Diwan
On 13 February 2012 14:46, ilai ke...@math.montana.edu wrote: The function you posted runs without error (on these 6 lines), but does not return anything that looks remotely like a sum, or cumsum of anything. Can you clarify what you are trying to do? I assume by sum of every other row you

  1   2   >