Re: [R] outer() or some other function for regression prediction with 2 IVs

2012-07-09 Thread peter dalgaard
On Jul 10, 2012, at 05:35 , Joseph Clark wrote: > > Thanks. I was able to get what I wanted by doing this: > > > > predxn <- function(s,d) { coef(m3)[1] + coef(m3)[2]*s + coef(m3)[3]*s^2 + > coef(m3)[4]*d + coef(m3)[5]*d^2 } > > > But it's not very elegant... > You didn't take Michael's

Re: [R] How to add marker in Stacked bar plot?

2012-07-09 Thread Jorge I Velez
Hi Manish, See ?arrows, e.g., DF <- structure(list(names = structure(c(5L, 2L, 1L, 3L, 4L), .Label = c("cabbage", "potato", "sukuma-wiki", "terere", "tomato"), class = "factor"), freq = c(7, 4, 5, 8, 20)), .Names = c("names", "freq"), row.names = c(NA, -5L), class = "data.frame") barplot(as.m

[R] info about R arulesSequences

2012-07-09 Thread Jennifer Maldonado
Hi all, I'm new with R, recently I began to use the package "arulesSequences" but the algorithm cspade give me this error: Error en makebin(data, file) : 'sid' invalid when I did executed this script, x = read_baskets("transactions.basket",sep=",",info=c( "eventID", "sequenceID","SIZE")) s <-

[R] How to add marker in Stacked bar plot?

2012-07-09 Thread Manish Gupta
Hi, I am working on stacked bar plot and want to add marker(arrow) in stacked bar plot. DF=data.frame(names=c("tomato", "potato", "cabbage", "sukuma-wiki", "terere"), freq=c(7,4,5,8,20)) barplot(as.matrix(DF[,2]), col=heat.colors(length(DF[,2])), legend=DF[,1], xlim=c(0,9), width=2) http://r

Re: [R] unique vs duplicate problem

2012-07-09 Thread arun
Hi Peter, Thanks for testing it and notifying.  I didn't test it to other situtations. Probably this should give similar results as Rui's #Test 1: x<-c(1,2,3,3,3,4,4,5) func1<-function(x) !is.na(match(x,x[duplicated(x)])) func1(x) #[1] FALSE FALSE  TRUE  TRUE  TRUE  TRUE  TRUE FALSE x[!func1(x)

[R] Read vector as multi-dimensional data in R by row

2012-07-09 Thread HJ YAN
Dear R users Say I wanted to read a vector into R as multi-dimensional array by row, e.g. a<-c(1:20) > b<-array(a,dim=c(2,5,2)) > b , , 1 [,1] [,2] [,3] [,4] [,5] [1,]13579 [2,]2468 10 , , 2 [,1] [,2] [,3] [,4] [,5] [1,] 11 13 15 17 1

[R] Why 95% "quantile" empty in R or why 95% "quantile" = 1 with data values between 0 and 1?

2012-07-09 Thread Angelr
I am calling quantiles as follows. I don't understand why sometimes the columns (data values) above 95% are returned as "NULL"!! When I drop the percentile down to 92%, I see colums appearing. Why would any quantile be empty? I see sometimes that 95% percentile is being chosen as "1" for my data be

Re: [R] how to make plot lines thicker

2012-07-09 Thread peziza
Thanks, that worked! -- View this message in context: http://r.789695.n4.nabble.com/how-to-make-plot-lines-thicker-tp4635875p4635929.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch

Re: [R] linearHypothesis and factors

2012-07-09 Thread Waikato_alex
Dear John, Thank you very much for your help - I really appreciate it. Sorry the questions was obviously rather basic, I did consult the ?linearHypothesis file but haven't worked with matchCoefs() before so didn't quite see how I could use it. Anyway, many thanks and much appreciated, Alex -- V

[R] Problem in plm package

2012-07-09 Thread tomas.krehlik
Hello everyone, I am working with plm package and I have problem with random and within models, which are giving errors which says "empty model". However, the model is not empty. In the source code for plm.fit, where the error originates it says something like (writing from the top of my head...)

Re: [R] Package 'MASS' (polr): Error in svd(X) : infinite or missing values in 'x'

2012-07-09 Thread Jeremy Little
Hi Jessica, thank you for your prompt response. Yes I had deduced it had to do with the Hessian. However, I am not clear what "all columns having range the order of one" actually means and what this means for my data. Does this mean removing decimals (ie by shifting the decimal place)? I would h

Re: [R] outer() or some other function for regression prediction with 2 IVs

2012-07-09 Thread Joseph Clark
Thanks. I was able to get what I wanted by doing this: predxn <- function(s,d) { coef(m3)[1] + coef(m3)[2]*s + coef(m3)[3]*s^2 + coef(m3)[4]*d + coef(m3)[5]*d^2 } But it's not very elegant... // joseph w. clark , phd candidate \\ usc marshall school of business

Re: [R] outer() or some other function for regression prediction with 2 IVs

2012-07-09 Thread Michael Weylandt
Your problem is the sum() call -- it's not vectorized (in the regular sense) so it breaks some of the internal assumptions of outer(). Easiest way is probably to do matrix multiplication (%*%) directly here Michael On Jul 9, 2012, at 10:19 PM, Joseph Clark wrote: > > Hi there, I'm trying to

Re: [R] cbind and cbind.data.frame

2012-07-09 Thread Michael Weylandt
Short answer: there is a default method used here which returns a matrix. It's defined at the C-level for speed so you don't see it with methods() Longer: cbind() isn't a regular S3 generic since it has no UseMethod(). Look at WRE and R-Internals (internal generics) for more info. Best (and go

[R] cbind and cbind.data.frame

2012-07-09 Thread James Long
## Hi, I'm having trouble understanding how the cbind function decides what method to apply to its arguments. Easy cut and paste code below. > > > > ## create two columns > c1 <- c("A","A","B","B") > c2 <- 1:4 > > ## cbind outputs a matrix with elements that are characters, seems reasonable

[R] outer() or some other function for regression prediction with 2 IVs

2012-07-09 Thread Joseph Clark
Hi there, I'm trying to prep some data for a persp() surface plot representing the predictions from a regression with two inddependent variables. The regression model "m3" has an intercept, 2 linear terms, and 2 squared terms. The coefficients are given by coef(m3). My approach to generati

Re: [R] is it possible to insert a figure into into another new figure by r script

2012-07-09 Thread Mikhail Titov
Jie Tang writes: > hi R-users >Now I have a figure in emf or png or tiff format that have been drawn > by other tool and I want to insert this figure into > my new figure by R script. I wonder if is possible ? This [1] might be relevant. [1] http://addictedtor.free.fr/graphiques/RGraphGal

[R] is it possible to insert a figure into into another new figure by r script

2012-07-09 Thread Jie Tang
hi R-users Now I have a figure in emf or png or tiff format that have been drawn by other tool and I want to insert this figure into my new figure by R script. I wonder if is possible ? -- TANG Jie Email: totang...@gmail.com Tel: 0086-2154896104 Shanghai Typhoon Institute,China [[al

Re: [R] Re : Matrix package loading problem "Error : object ‘kronecker’ is not exported by 'namespace:methods'"

2012-07-09 Thread RobMusk
Hi Bert, The version of Matrix that ships with base worked for me. The cran version of Matrix was the problem. To get it working I reinstalled R and did NOT update Matrix. Thanks to the package developers for their quick help on this one. Regards, Dr Robert Musk Senior Forest Biometrici

Re: [R] Re : Matrix package loading problem "Error : object ‘kronecker’ is not exported by 'namespace:methods'"

2012-07-09 Thread RobMusk
Hi Bert, The version of Matrix that ships with base worked for me. The cran version of Matrix was the problem. To get it working I reinstalled R and did NOT update Matrix. Regards, Dr Robert Musk Senior Forest Biometrician Management Research Forestry Tasmania 79 Melville St Hobart Austr

Re: [R] Type II ANOVA for user-defined contrasts with covariates

2012-07-09 Thread John Fox
Dear Jordan, Oddly, essentially the same question was posed by someone else three days ago. Because groups enters the model additively, the proper test for each contrast is just the t-test for the corresponding coefficient in the summary() for the model. I hope this helps, John

Re: [R] mfrow and centering plots when there's an odd number

2012-07-09 Thread Dustin Fife
That's perfect! Thanks for the help. For those in the future who may have a similar question, here's how I did it: nf <- layout(matrix(c(1,1,2,2,3,3,0,4,4,5,5,0), 2, 6, byrow=TRUE), respect=FALSE) for (i in 1:5){ x = rnorm(100) y = .5*x + rnorm(100, 0, sqrt(1-.5^2)) plot(x,y) } On

Re: [R] mfrow and centering plots when there's an odd number

2012-07-09 Thread R. Michael Weylandt
Take a look at ?layout Michael On Jul 9, 2012, at 5:15 PM, Dustin Fife wrote: > Let me start with an example: > > par(mfrow=c(2,3)) > for (i in 1:5){ >x = rnorm(100) >y = .5*x + rnorm(100, 0, sqrt(1-.5^2)) >plot(x,y) > } > > Note that there's five plots and six spaces for those pl

Re: [R] mfrow and centering plots when there's an odd number

2012-07-09 Thread Highland Statistics Ltd
Let me start with an example: par(mfrow=c(2,3)) for (i in 1:5){ x = rnorm(100) y = .5*x + rnorm(100, 0, sqrt(1-.5^2)) plot(x,y) } Note that there's five plots and six spaces for those plots via mfrow, leaving one row empty. Is there a way to have the bottom two plots centered? I th

[R] mfrow and centering plots when there's an odd number

2012-07-09 Thread Dustin Fife
Let me start with an example: par(mfrow=c(2,3)) for (i in 1:5){ x = rnorm(100) y = .5*x + rnorm(100, 0, sqrt(1-.5^2)) plot(x,y) } Note that there's five plots and six spaces for those plots via mfrow, leaving one row empty. Is there a way to have the bottom two plots centered? I think

Re: [R] differences between survival models between STATA and R

2012-07-09 Thread jthetzel
Be sure you reply or forward your message to me to the r-help listhost. I might not have time to review it tonight, while others might. Jeremy On Mon, Jul 9, 2012 at 2:38 PM, JPF [via R] < ml-node+s789695n4635888...@n4.nabble.com> wrote: > Please, find an example with a data set here. > > The d

Re: [R] Plotting rpart trees with long list of class members

2012-07-09 Thread MarkBeauchene
Here is some sample code. It generates a class (list_var) that is used in rpart. list_val is the dependant variable. The plot shows all the values of the class, which is a mess and makes the plot unuseable. I'd like to either suppress the list entirely or replace it with something like "Group 1

Re: [R] returning multiple values

2012-07-09 Thread arun
Hello, Try this:  meanfevs<-c(3.5,4.25,6.5)  meanfevns<-c(4.7,3.23,7.6)  pfevs<-c(1.2,2.8,3.2)  pfevns<-c(4.2,3.2,8.2) listret<-list(a=meanfevs,b=meanfevns,c=pfevs,d=pfevns) listret $a [1] 3.50 4.25 6.50 $b [1] 4.70 3.23 7.60 $c [1] 1.2 2.8 3.2 $d [1] 4.2 3.2 8.2 #To access the elements store

Re: [R] Correcting for overdispersion

2012-07-09 Thread Lawrence, Adaku
Hello, Thanks for getting back to me. I was of the impression that once the res. var. is larger than the df then the data was overdispersed and as such the model was not a best fit. Is this true? Here is an example of the output from R: Call: glm(formula = y ~ log(conc), family = binomial) Devian

[R] Type II ANOVA for user-defined contrasts with covariates

2012-07-09 Thread Jordan Ramsey
I'm wondering if anyone would be able to help me out. I'm trying to use a type II ANOVA for a model with user-specified contrasts and covariates. I have two treatment groups and a control group. I'm comparing average treatment to controls and also between the two treatment groups, but I'm also loo

[R] firth's penalized likelihood bias reduction approach

2012-07-09 Thread Yue
hi all, I have a binary data set and am now confronted with a "separation" issue. I have two predictors, mood (neutral and sad) and game type (fair and non-fair). By "separation", I mean that in the non-fair game, whereas 20% (4/20) of sad-mood participants presented a positive response (coded as

[R] exact logistic regression with correlated data?

2012-07-09 Thread Yue
hi all, does anyone know if R can do exact logistic regression with correlated binary data? Thanks!! Yue -- View this message in context: http://r.789695.n4.nabble.com/exact-logistic-regression-with-correlated-data-tp4635900.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] how do I shut down "Hit to see next plot:" when plotting to pdf file?

2012-07-09 Thread Sarah Goslee
Maybe read the help for avPlots, especially the part about the ask argument: ask If TRUE, ask the user before drawing the next plot; if FALSE don't ask. Sarah On Mon, Jul 9, 2012 at 5:16 PM, Michael wrote: > Hi all, > > I am using "avPlots"... and it has the following: > > "Hit to see next

Re: [R] Predicted values for zero-inflated Poisson

2012-07-09 Thread Highland Statistics Ltd
Laura Lee laura.lee at ncdenr.gov Mon Jul 9 22:51:40 CEST 2012 Previous message: [R] Predicted values for zero-inflated Poisson Next message: [R] Lavaan Package - How to Extract Residuals in Data Values Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] Thanks for your

[R] how do I shut down "Hit to see next plot:" when plotting to pdf file?

2012-07-09 Thread Michael
Hi all, I am using "avPlots"... and it has the following: "Hit to see next plot:" But I just wanted to everything to be saved into a pdf file... How to skip these Returns? Thanks a lot! [[alternative HTML version deleted]] __ R-help@r-pro

Re: [R] number of shared species between sites (VEGAN or RICH?)

2012-07-09 Thread Rui Barradas
Ouch! Rui Barradas Em 09-07-2012 21:39, peter dalgaard escreveu: On Jul 9, 2012, at 21:26 , Rui Barradas wrote: Hello, So you want to split data.frame 'dat' by the values of the first column, named 'site', and return the other columns. lapply(split(dat, dat[[ 1 ]]), function(x) x[-1])

Re: [R] Predicted values for zero-inflated Poisson

2012-07-09 Thread Laura Lee
Thanks for your reply. I do have a copy of "Zero Inflated Models and Generalized Linear Mixed Models with R" and have been using that as a guide. I applied the predict function (type="count") to the dataset for which I built the model to compare the predicted bycatch numbers to the observed to ensu

Re: [R] number of shared species between sites (VEGAN or RICH?)

2012-07-09 Thread peter dalgaard
On Jul 9, 2012, at 21:26 , Rui Barradas wrote: > Hello, > > So you want to split data.frame 'dat' by the values of the first column, > named 'site', and return the other columns. > > > lapply(split(dat, dat[[ 1 ]]), function(x) x[-1]) > Got to be easier to split(dat[-1], dat[[1]]), no? -pd

Re: [R] Correcting for overdispersion

2012-07-09 Thread peter dalgaard
On Jul 9, 2012, at 21:08 , Lawrence, Adaku wrote: > Hello, > Thanks for getting back to me. I was of the impression that once the res. > var. is larger than the df then the data was overdispersed and as such the > model was not a best fit. Is this true? Not without qualification. There are var

Re: [R] number of decimal places in a number?

2012-07-09 Thread Petr Savicky
On Mon, Jul 09, 2012 at 07:52:18AM -0500, Jim Plante wrote: > I don't know how significant this is, but WolframAlpha's value of pi > disagrees with R's at about the 16th decimal: > > Wpi->3.141592653589793238462643383279502884197169399375105 > ..^ > Rpi->3.1415926535897931159

Re: [R] unique vs duplicate problem

2012-07-09 Thread Peter Ehlers
On 2012-07-09 11:07, arun wrote: Hi, Try this: #Duplicated: x<-c(1:3,3) x==x[duplicated(x)] #[1] FALSE FALSE TRUE TRUE #Unique: x[!x==x[duplicated(x)]] #[1] 1 2 A.K. Try the above approach with x <- c(1,2,3,3,3,4,4,5) I think Rui's solution is preferable. Peter Ehlers - O

Re: [R] heatmaps and layouts

2012-07-09 Thread Joseph Clark
With base graphics, you could use par(mfrow) or par(mfcol) to define a simple layout. I don't know anything about heatmap.2, but I have used image() to make heatmaps and have laid them out with par(mfrow). Two ways to get a 2 row by 3 column layout, for example: par(mfrow = c(3,2)) # 3

[R] boxplot with "cut"

2012-07-09 Thread Vining, Kelly
Dear UseRs, I'm making box plots from a data set that looks like this: Chr Start End GeneDensity ReadCount_Explant ReadCount_Callus ReadCount_Regen 1 1 1 1 107.82 1.2431.047 1.496 2 1 10001 2 202.50 0.8350.869

Re: [R] axis.Date language

2012-07-09 Thread Mikkel Grum
Thanks Prof, I needed one more step on my system: sudo locale-gen es_ES.UTF-8 Mikkel From: Prof Brian Ripley Cc: R Help Sent: Monday, July 9, 2012 7:01 AM Subject: Re: [R] axis.Date language On 09/07/12 01:43, Mikkel Grum wrote: > Dear useRs > > I need to d

[R] heatmaps and layouts

2012-07-09 Thread Tanu Soni
I'm using R to create a heatmap from a matrix using heatmap.2 - and i want to group these images into one big image - What i usually use to achieve this is layout() - but this doesn't work, as heatmap.2 uses layout, and apparently layout does not work recursively. Does anyone have any suggestions

Re: [R] number of shared species between sites (VEGAN or RICH?)

2012-07-09 Thread Rui Barradas
Hello, So you want to split data.frame 'dat' by the values of the first column, named 'site', and return the other columns. lapply(split(dat, dat[[ 1 ]]), function(x) x[-1]) Hope this helps, Rui Barradas Em 09-07-2012 13:27, elpape escreveu: Dear all I'm trying to calculate the number o

Re: [R] install.packages

2012-07-09 Thread Hui Du
Thanks Sarah. I realized it as well and tried to run install.packages("plyr", lib = .Library) as root. It works now. Thanks again. HXD -Original Message- From: Sarah Goslee [mailto:sarah.gos...@gmail.com] Sent: Monday, July 09, 2012 12:06 PM To: Hui Du Cc: r-help@r-project.org Subject

Re: [R] install.packages

2012-07-09 Thread Sarah Goslee
Hi, On Mon, Jul 9, 2012 at 2:30 PM, Hui Du wrote: > > Hi All, > > I have two questions regarding install.packages(). > > Q1: may I run it in non-interactive mode, which means just install the > packages I want rather than letting me to choose which mirror etc? Sure. If you read ?install.package

Re: [R] Correcting for overdispersion

2012-07-09 Thread peter dalgaard
On Jul 9, 2012, at 20:23 , Lawrence, Adaku wrote: > Hello, > > I am trying to determine LD50 and LD95 using dose.p in MASS however some of > the Residual variance is larger than the degrees of freedom. Please can > anyone help with any advice as to how i can correct for this? Er, in what sens

Re: [R] how to make plot lines thicker

2012-07-09 Thread R. Michael Weylandt
These sorts of parameters are all documented under ?par, but it's a bit of a beast to read. The one you are looking for is lwd= To wit layout(1:2) plot(1:5, type = "l") plot(1:5, type = "l", lwd = 3) Best, Michael On Mon, Jul 9, 2012 at 12:11 PM, peziza wrote: > I am trying to make the lines t

Re: [R] Predicted values for zero-inflated Poisson

2012-07-09 Thread Alain Zuur
Lee, Laura wrote > > Hi all- > > I fit a zero-inflated Poisson model to model bycatch rates using an offset > term for effort. I need to apply the fitted model to a datasets of varying > levels of effort to predict the associated levels of bycatch. I am seeking > assistance as to the correct way

Re: [R] Extracting arithmetic mean for specific values from multiple .txt-files

2012-07-09 Thread jim holtman
I think the real problem is the first data line: 2 1 1 3 27 0 6 1.200.995 Notice the two periods in the value. The previous solution was getting rid of all the periods. If you leave out this value, you get 339.5. if you change it to 1200.995, you get 34

[R] install.packages

2012-07-09 Thread Hui Du
Hi All, I have two questions regarding install.packages(). Q1: may I run it in non-interactive mode, which means just install the packages I want rather than letting me to choose which mirror etc? Q2: I ran a R code in batch mode, for example, R CMD BATCH a.r In a.r, I have some statements li

Re: [R] Extracting arithmetic mean for specific values from multiple .txt-files

2012-07-09 Thread Rui Barradas
Hello, There must be a difference in the file you are processing and in the one excel and I are: > fun <- function(x){ + dat <- read.table(x, skip=14) + dat[ , 8] <- as.numeric(gsub("\\.", "", dat[, 8])) + mean(dat[, 8]) + } > > sapply(list.files(pattern="XYZ.*\\.txt"), fun) XYZ_34.txt 3452

Re: [R] how to make plot lines thicker

2012-07-09 Thread John Kane
?par and have a look at lwd John Kane Kingston ON Canada > -Original Message- > From: jenkere...@gmail.com > Sent: Mon, 9 Jul 2012 10:11:32 -0700 (PDT) > To: r-help@r-project.org > Subject: [R] how to make plot lines thicker > > I am trying to make the lines thicker in a graph (for a pp

[R] Correcting for overdispersion

2012-07-09 Thread Lawrence, Adaku
Hello, I am trying to determine LD50 and LD95 using dose.p in MASS however some of the Residual variance is larger than the degrees of freedom. Please can anyone help with any advice as to how i can correct for this? Here is the model as inputted into R y<-cbind(dead,n-dead) model<-glm(y~lo

Re: [R] Re : Matrix package loading problem "Error : object ‘kronecker’ is not exported by 'namespace:methods'"

2012-07-09 Thread Bert Gunter
?":::" -- Bert On Mon, Jul 9, 2012 at 10:45 AM, Niels2 wrote: > Hallo Rob, > > have you figured out a solution to the error? I've got the same problem. > > regards > N. > > -- > View this message in context: > http://r.789695.n4.nabble.com/Matrix-package-loading-problem-Error-object-kronecker-i

Re: [R] unique vs duplicate problem

2012-07-09 Thread arun
Hi, Try this: #Duplicated: x<-c(1:3,3) x==x[duplicated(x)] #[1] FALSE FALSE  TRUE  TRUE #Unique:  x[!x==x[duplicated(x)]] #[1] 1 2 A.K. - Original Message - From: Nico902 To: r-help@r-project.org Cc: Sent: Monday, July 9, 2012 12:42 PM Subject: [R] unique vs duplicate problem Hi

Re: [R] how to make plot lines thicker

2012-07-09 Thread Sarah Goslee
I'd suggest using lines() rather than points() to add lines to a plot. The parameter to change line width is lwd rather than cex. e.g. lines(x, Sobs$Chao_1_Mean, col="Gray", lwd=2) Reading ?par can be both an enlightening and confusing experience. Sarah On Mon, Jul 9, 2012 at 1:11 PM, peziza w

[R] Issue with installing RExcel

2012-07-09 Thread bjbreitling
Hi community. I'm fairly new to R and have a basic question. When I try to install RExcel with the code: install.packages("RExcelInstaller", "rcom", "rsproxy") I get the message below: Warning in install.packages("RExcelInstaller", "rcom", "rsproxy") : 'lib = "rcom"' is not writable Error in i

Re: [R] Skipping lines and incomplete rows

2012-07-09 Thread arun
Hello, Just now I checked reading directly from .txt file instead of the one showed in my earlier reply, #Use skip=3 instead of 4. dat1<-read.table("dat1.txt",sep="",skip=3,fill=TRUE,header=TRUE) dat1<-dat1[-1,]  row.names(dat1)<-1:nrow(dat1)  dat1   variable1 Variable2 Variable3 Variable4 1  

Re: [R] Issue with installing RExcel

2012-07-09 Thread Charlie Friedemann
If you look at the help for install.packages: help(install.packages) You will see that the first argument to install.packages takes a vector of the package names. In your case, you are passing three arguments to the function, so R is trying to install "RExcelInstaller" package into a library dire

Re: [R] How to import SAS data in R?

2012-07-09 Thread kenkl
In addition to the helpful guidance suggested already, you might investigate the sas7bdat package, by Matt Shotwell. I described it here: http://sas-and-r.blogspot.com/2011/07/really-useful-r-package-sas7bdat.html Ken -- View this message in context: http://r.789695.n4.nabble.com/How-to-import-

Re: [R] anova.lm and F-test

2012-07-09 Thread SKrishna
Dear Peter, Thank you very much for that excellent answer to a rather stupid question :) I did not notice that the RSS actually increased for the model with more parameters and so in this case the F-statistic is negative and therefore a p-value from the F-distribution is meaningless. But I guess y

Re: [R] Skipping lines and incomplete rows

2012-07-09 Thread arun
Hi, I guess you should have "fill=TRUE" in the read.table. dat1<-read.table(text=" First line: Skip this line Second line: skip this line Third line: skip this line variable1 Variable2 Variable3 Variable4   Unit1    Unit2    Unit3 10  0.1  0.01   

Re: [R] differences between survival models between STATA and R

2012-07-09 Thread jthetzel
UCLA's Advanced Technical Services' Statistical Computing website often has very good resources for comparing analyses between R, Stata, and SAS ( http://www.ats.ucla.edu/stat ). For accelerated failure time models, I believe that it has some examples for Stata ( http://www.ats.ucla.edu/stat/stata/

[R] number of shared species between sites (VEGAN or RICH?)

2012-07-09 Thread elpape
Dear all I'm trying to calculate the number of shared species between sites. I have a dataframe with in the first column the names of the sites; the names of the other columns are the species names. To use the shared function from the package RICH one needs to input different matrices. So actuall

Re: [R] Extracting arithmetic mean for specific values from multiple .txt-files

2012-07-09 Thread vimmster
Dear Mr. Barradas, your solution comes very close to what I want. But I have two questions left: First question: If "R" computes the mean for the reaction times of test subject 34 (the example I provided above), it says "310112.0", but if I use the "mean"-function in Excel it says "345.210". Ap

Re: [R] add constraints to nls or use another function

2012-07-09 Thread PtitBleu
bbolker wrote > > PtitBleu yahoo.fr> writes: > >> >> Hello, >> >> I'm trying to fit experimental data with a model and nls. >> For some experiments, I have data with x from 0 to 1.2 and the fit is >> quite >> good. >> But it can happen that I have data only the [0,0.8] range (see the >> exam

Re: [R] Re : Matrix package loading problem "Error : object ‘kronecker’ is not exported by 'namespace:methods'"

2012-07-09 Thread Niels2
Hallo Rob, have you figured out a solution to the error? I've got the same problem. regards N. -- View this message in context: http://r.789695.n4.nabble.com/Matrix-package-loading-problem-Error-object-kronecker-is-not-exported-by-namespace-methods-tp4632861p4635878.html Sent from the R help m

[R] additive interaction for a dichotomous dependent variable (i.e. risk difference)

2012-07-09 Thread wouterjohannes
Dear all, For my research I want to test additive interaction for a dichotomous dependent variable. Can anyone help me to estimate this in R? Wacholder describes this procedure in the American Journal of Epidemiology in 1986 (Binomial regression in GLIM: estimating risk ratios and risk differenc

[R] how to make plot lines thicker

2012-07-09 Thread peziza
I am trying to make the lines thicker in a graph (for a ppt presentation). Here is what I currently have: plot(x,y,type="l", ylab="Number of OTUs", xlab="Number of Samples Collected", col="Black", pch=1, ylim=c(0,6000)) points(x, Sobs$Chao_1_Mean, type="l", col="Gray", pch=1) (this is one of th

[R] Lavaan Package - How to Extract Residuals in Data Values

2012-07-09 Thread Emily Zimmerman
Hello R Community, I am using the Lavaan package in R 2.15.0 to analyze data collected from 1200 lakes across North America. My dataset includes 3 continuous independent variables (LOG_NTL, LOG_PTL, and LOG_SR_A_D) and 1 continuous dependent variable (BIOVOL) . I have successfully constructed struc

Re: [R] number of decimal places in a number?

2012-07-09 Thread Jim Plante
I don't know how significant this is, but WolframAlpha's value of pi disagrees with R's at about the 16th decimal: Wpi->3.141592653589793238462643383279502884197169399375105 ..^ Rpi->3.14159265358979311599796346854418516 Probably not of interest to anyone but astronomers, na

[R] R, maps, choropleth, data keys

2012-07-09 Thread Charles Carter
I have four files that map populations to appropriate keys: statepop.csv, countypop.csv, zip3.csv, and zip5.csv. I'm using the TIGER/Lines shape files: tl_2009_12_state, tl_2009_12_county tl_2009_12_zcta3, and  tl_2009_12_zcta5. I have carefully followed a number of tutorials and can reproduce t

Re: [R] returning multiple values

2012-07-09 Thread Bert Gunter
Indeed. You do not understand lists. The behavior you expect is not how R works. Have you read "An Introduction to R" where this is explained (section 6.1). Also chapter 10 and 10.7 in particular for scoping in R. See also ?with ?within ?eval and e.g. ?lm or ?xyplot for the ubiquitous use of "dat

Re: [R] returning multiple values

2012-07-09 Thread R. Michael Weylandt
Hi, No, you won't be able to simply call "a" and have that work. R returns these in a single object with components (elements) named a,b,c,d Here's a concrete example: func <- function(x, y) return(list(a = x+1, b = y + 2)) out <- func(3, 5) out[["a"]] # or out$a out[["b"]] # or out$b give

[R] returning multiple values

2012-07-09 Thread PRAGYA SUR
I am running a program which has an output containing four vectors named meanfevs, meanfevns, pfevs, pfevns. I wish to return all four and be able to access them later. I used the command return(list(a=meanfevs,b=meanfevns,c=pfevs,d=pfevns)) it did give me the ouput. However the values did not get

Re: [R] R to winbugs interface

2012-07-09 Thread PRAGYA SUR
Yes that was the problem. Thank you very much. Can anyone tell me the meaning of The following object(s) are masked _by_ '.GlobalEnv': beta i was shown this notification after the results were printed. On Mon, Jul 9, 2012 at 1:15 PM, Uwe Ligges wrote: > > > On 09.07.2012 18:19, PRAGYA SUR wr

Re: [R] R to winbugs interface

2012-07-09 Thread Uwe Ligges
On 09.07.2012 18:19, PRAGYA SUR wrote: I ran the same program in a different computer where it had run proper a week ago. This time around in the log file in WinBUGS the program stopped at a line which said : save(C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/RtmpU3u46p/log.odc) save(C:/DOCUME~1/ADMINI~1/

Re: [R] unique vs duplicate problem

2012-07-09 Thread Nico902
excellent!!! thanks a lot!! -- View this message in context: http://r.789695.n4.nabble.com/unique-vs-duplicate-problem-tp4635868p4635874.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.eth

Re: [R] R code for Ljung-Box Test

2012-07-09 Thread Rui Barradas
Hello, The function is ?Box.test It has two types, Box-Pierce and Ljung-Box. Hope this helps, Rui Barradas Em 09-07-2012 15:59, Sajeeka Nanayakkara escreveu: What is the R code for Ljung-Box Test in Statistics? Sajeeka Nanayakkara [[alternative HTML version deleted]] ___

Re: [R] unique vs duplicate problem

2012-07-09 Thread Rui Barradas
Hello, Maybe this function. fun <- function(x) x %in% x[duplicated(x)] x <- c(1, 2, 3, 3) fun(x) Hope this helps, Rui Barradas Em 09-07-2012 17:42, Nico902 escreveu: Hi, Let say I have a numeric vector: x <- c(1, 2, 3, 3). I want on one hand numbers which are not duplicated ie "1,2" a

Re: [R] unique vs duplicate problem

2012-07-09 Thread jim holtman
Here is one way of doing it -- you can create your own functions: > x <- c(1, 2, 3, 3) > > allDup <- + function (value) + { + duplicated(value) | duplicated(value, fromLast = TRUE) + } > > duped <- unique(x[allDup(x)]) > duped [1] 3 > > setdiff(unique(x), duped) [1] 1 2 > > On Mon, Jul 9, 2

[R] unique vs duplicate problem

2012-07-09 Thread Nico902
Hi, Let say I have a numeric vector: x <- c(1, 2, 3, 3). I want on one hand numbers which are not duplicated ie "1,2" and duplicated "3". so I did: >duplicated(x) FALSE FALSE FALSE TRUE > unique(x) 1 2 3 which is not what I want. Is there a function in R to have the following result: >dupli

Re: [R] Package 'MASS' (polr): Error in svd(X) : infinite or missing values in 'x'

2012-07-09 Thread Jessica Streicher
large (585000 rows) and has no NA, - or blank values. > > My script (in brief) is as follows, with results: > > >> library(MASS) >> >> ## ADD DATA >> Jdata<- read.delim("/Analysis/20120709 JLittle data file.txt", header=T) >> &g

Re: [R] R to winbugs interface

2012-07-09 Thread PRAGYA SUR
I ran the same program in a different computer where it had run proper a week ago. This time around in the log file in WinBUGS the program stopped at a line which said : save(C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/RtmpU3u46p/log.odc) save(C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/RtmpU3u46p/log.txt) and did n

Re: [R] classification using zero-inflated negative binomial mixture model

2012-07-09 Thread Ben Bolker
Kai Ying iastate.edu> writes: > > Hi, >I want using zero-inflated negative binomial regression model to > classify data(a vector of data), that is I want know each observed value is > more likely belong to the "zero" or "count" distribution(better with > relative probability). My data is som

[R] Predicted values for zero-inflated Poisson

2012-07-09 Thread Lee, Laura
Hi all- I fit a zero-inflated Poisson model to model bycatch rates using an offset term for effort. I need to apply the fitted model to a datasets of varying levels of effort to predict the associated levels of bycatch. I am seeking assistance as to the correct way to code this. Thanks in adva

Re: [R] differences between survival models between STATA and R

2012-07-09 Thread Robert W. Baer
On 7/9/2012 9:17 AM, Javier Palacios Fenech wrote: Please. After, Terry's response I guess I was expecting to hear how your comparison between R and STATA went when you used the R function, survreg() for your analysis. We still don't know what your data look like. The posting guide asks for

Re: [R] Problem to establish Bloomberg connection / Package RBloomberg / function blpConnect()

2012-07-09 Thread Alexander Erbse
John, the problem is now resolved. I changed the "PATH" environment variable. I replaced the path leading to the old java installation by the new one and now it works. Thanks for your help. Regards, Alex -Ursprüngliche Nachricht- Von: Alexander Erbse Gesendet: Montag, 9. Juli 2012 17

Re: [R] Problem to establish Bloomberg connection / Package RBloomberg / function blpConnect()

2012-07-09 Thread Alexander Erbse
Hi John, I did some further checks and noticed that the java version, which is indicated by the settings (I used the code you sent) is version 1.5.0_12, although I installed version 1.7.0_05 shortly. The paths as shown by parameter "java.endorsed.dirs" are wrong. They are pointing to an older v

[R] R code for Ljung-Box Test

2012-07-09 Thread Sajeeka Nanayakkara
 What is the R code for Ljung-Box Test in Statistics? Sajeeka Nanayakkara [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-proj

Re: [R] anova.lm and F-test

2012-07-09 Thread peter dalgaard
On Jul 9, 2012, at 15:40 , Suresh Krishna wrote: > > Hello, > > Why does anova.lm sometimes return a p-value and at other times not ? Is it > because it recognizes nested models from non-nested ones ? > >> x<-seq(1,100,1) >> y<-3*x+rnorm(100) >> anova(lm(y~x),lm(y~x+I(x^2)),test="F") > Analy

Re: [R] differences between survival models between STATA and R

2012-07-09 Thread Javier Palacios Fenech
Please. find an example here. With exactly the same data set, I run two hazard models following the instructions for each function. aftreg(formula = Surv(sta, sto, S) ~ a + b + c + d + e + f + g , factor(F), data = data.frame(SURV), dist = "weibull", id = ID) streg f1 f2 f3 f4 f5 a b c d

Re: [R] a fortune?

2012-07-09 Thread Ted Harding
Indeed!! I made a spelling mistake! Correction: Should this not be attributed to DescRtes? Ted. On 09-Jul-2012 13:31:03 John Kane wrote: > ooohhh! > > John Kane > Kingston ON Canada > > >> -Original Message- >> From: ted.hard...@wlandres.net >> Sent: Sun, 08 Jul 2012 21:07:09 +0

Re: [R] differences between survival models between STATA and R

2012-07-09 Thread Terry Therneau
Without more information, we can only guess what you did, or what you are seeing on the page that is "different". I'll make a random guess though. There are about 5 ways to paramaterize the Weibull distribution. The standard packages that I know, however, tend to use the one found in the Kal

Re: [R] Splitting a character vector.

2012-07-09 Thread John Kane
Right, I see it now. Thanks. Who knows in another 100 years I may understand regex. John Kane Kingston ON Canada > -Original Message- > From: smartpink...@yahoo.com > Sent: Sat, 7 Jul 2012 16:19:54 -0700 (PDT) > To: jrkrid...@inbox.com > Subject: Re: [R] Splitting a character vector.

Re: [R] a fortune?

2012-07-09 Thread John Kane
ooohhh! John Kane Kingston ON Canada > -Original Message- > From: ted.hard...@wlandres.net > Sent: Sun, 08 Jul 2012 21:07:09 +0100 (BST) > To: r-help@r-project.org > Subject: Re: [R] a fortune? > > Should this not be attributed to DescaRtes? > > Ted. > > On 08-Jul-2012 18:41:17 Ac

Re: [R] Using the effects package

2012-07-09 Thread John Fox
Dear Abraham, I must admit that I don't really follow what you want to do. Disregarding the fact that the example you provide doesn't converge to a proper solution, the plot that you've requested will range over all values of bid at the median home, which is 0. You may have intended home to be

  1   2   >