Re: [R] gsub -> replace substring in column

2012-08-22 Thread PIKAL Petr
Hi One more comment > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of David Winsemius > Sent: Thursday, August 23, 2012 2:22 AM > To: Paula Cafeld > Cc: r-help@r-project.org > Subject: Re: [R] gsub -> replace substring in colum

Re: [R] removing lines from text file

2012-08-22 Thread Berend Hasselman
On 23-08-2012, at 07:22, Doug Edmunds wrote: > I downloaded a text file which has several lines of text before the header > line of the data, similar to this: > > ---start--- > "Corn December 2012 (CZ2012)" > Source: Wikiposit Open Data via wikiposit.org > (http://wikiposit.org/uid?FUTURE.CZ2

[R] Origin of coordinate system

2012-08-22 Thread Richard Müller
Dear R-community, In graphical representations of findings concerning bodies of standing water (lakes e.g.) in x-y-plots you often make use of a somewhat different definition of coordinates in a cartesian system: the origin is top-left, the x-axis (depth of the water body) from top to bottom and t

Re: [R] Barplot with Secondary axis

2012-08-22 Thread vikrant
Thanks Rui and Greg for providing me the solution , it Works. -- View this message in context: http://r.789695.n4.nabble.com/Barplot-with-Secondary-axis-tp4640980p4641081.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-pr

[R] removing lines from text file

2012-08-22 Thread Doug Edmunds
I downloaded a text file which has several lines of text before the header line of the data, similar to this: ---start--- "Corn December 2012 (CZ2012)" Source: Wikiposit Open Data via wikiposit.org (http://wikiposit.org/uid?FUTURE.CZ2012) Update: http://wikiposit.org/w?action=dl&dltypes=comma

Re: [R] negative AIC and BIC values in gls

2012-08-22 Thread Bert Gunter
Inline. On Wed, Aug 22, 2012 at 5:17 PM, Jeremy Miles wrote: > It's fine. Just interpret them as you would any other (lower is better). > I don't think so. I believe all 3 values are the negative of what they should be. AIC is defined as -2*log(L) + k*{degrees of freedom for model) . BIC is sim

Re: [R] Accessing the (first or more) principal component with princomp or prcomp

2012-08-22 Thread Bert Gunter
How about reading the Help files? -- Bert On Wed, Aug 22, 2012 at 8:34 PM, jpm miao wrote: > Hi , > >To my knowledge, there're two functions that can do principal component > analysis, princomp and prcomp. > >I don't really know the difference; the only thing I know is that when > the sa

Re: [R] Controlling line-join style in Lattice

2012-08-22 Thread Peter Ehlers
I should add that you can also use the par.settings() mechanism to set your linejoin specification on the fly: x <- 1:4; y <- c(1,3,2,4) xyplot(y ~ x, type = "l", lwd = 20, par.settings = list(grid.pars = list(linejoin = "mitre"))) Peter Ehlers On 2012-08-22 12:28, Peter Ehlers wrote: Yo

[R] Accessing the (first or more) principal component with princomp or prcomp

2012-08-22 Thread jpm miao
Hi , To my knowledge, there're two functions that can do principal component analysis, princomp and prcomp. I don't really know the difference; the only thing I know is that when the sample size < number of variable, only prcomp will work. Could someone tell me the difference or where I can

Re: [R] negative AIC and BIC values in gls

2012-08-22 Thread David Winsemius
On Aug 22, 2012, at 5:17 PM, Jeremy Miles wrote: It's fine. Just interpret them as you would any other (lower is better). And it is the printed logLik that is out of step here. log-likelihoods _should_ be negative. -- David. On 22 August 2012 16:43, Gary Dong wrote: Dear R users,

Re: [R] gsub -> replace substring in column

2012-08-22 Thread David Winsemius
On Aug 22, 2012, at 10:24 AM, Paula Cafeld wrote: Hi all, please excuse- I'm a complete newbie to R, so it's possible my question was asked a thousand times before, but I don't get it :-( I imported a CSV file via: x=read.csv("test.csv",header=TRUE,sep="\t") In a column there are values w

Re: [R] negative AIC and BIC values in gls

2012-08-22 Thread Jeremy Miles
It's fine. Just interpret them as you would any other (lower is better). On 22 August 2012 16:43, Gary Dong wrote: > Dear R users, > > I obtained negative AIC and BIC and positive Loglik values in a gls model. > Is this normal? how should I interpret them? Thanks! > >AIC BIC

[R] negative AIC and BIC values in gls

2012-08-22 Thread Gary Dong
Dear R users, I obtained negative AIC and BIC and positive Loglik values in a gls model. Is this normal? how should I interpret them? Thanks! AIC BIC logLik -659.978 -587.5541 345.989 Best Gary [[alternative HTML version deleted]] ___

Re: [R] Iterative sampling with restrictions

2012-08-22 Thread David L Carlson
The third phase is determined since there are only three groups, but I should have added them to group specifications to make things clearer: > require(e1071) > groups <- apply(permutations(3), 1, function(x) paste(x, collapse="/")) > assign <- sample(rep(groups, 10)) > table(assign) assign 1/2/3

Re: [R] Error in if (n > 0)

2012-08-22 Thread Rich Shepard
On Wed, 22 Aug 2012, David Winsemius wrote: I'm not sure I understand why you think there should be any estimate when all of one group is censored? Of course you're coreect. Without uncensored data there's no way to fit a distribution that could estimate the censored data. It's been that sor

Re: [R] gsub -> replace substring in column

2012-08-22 Thread arun
Hi, Try this: x<-read.table(text=" 1 GPS_LATITUDE 2    53.51982466427600 3   51.520379571037000 4   53.520745152837800 5   51.521750487103766 6    53.52067987059652 7   53.519504773664345 8    51.51861690180330 9   51.519100010776675 10   51.51905431150669 11    51.5193415632712 12   53.519

Re: [R] Error in if (n > 0)

2012-08-22 Thread David Winsemius
On Aug 22, 2012, at 3:59 PM, Rich Shepard wrote: On Wed, 22 Aug 2012, David Winsemius wrote: It is not saying there are zero values for concentration it is saying there are groups with zero elements: Thank you very much, David. table(cu.t$ceneq1, cu.t$era) Mining Pre-mining F

Re: [R] Error in if (n > 0)

2012-08-22 Thread Rich Shepard
On Wed, 22 Aug 2012, David Winsemius wrote: It is not saying there are zero values for concentration it is saying there are groups with zero elements: Thank you very much, David. table(cu.t$ceneq1, cu.t$era) Mining Pre-mining FALSE723 0 TRUE 183 9

Re: [R] Error in if (n > 0)

2012-08-22 Thread David Winsemius
On Aug 22, 2012, at 3:26 PM, Rich Shepard wrote: I've searched the Web with Google and do not find what might cause this particular error from an invocation of cenboxplot: cenboxplot(cu.t$quant, cu.t$ceneq1, cu.t$era, range=1.5, main='Total Recoverable Copper', ylab='Concentration (mg/L)',

Re: [R] Entering a table

2012-08-22 Thread David Winsemius
On Aug 21, 2012, at 5:48 AM, Thomas wrote: I'm trying to enter a frequency table manually so that I can run a goodness of fit test (I only have the frequencies, I don't have the raw data). So for example, let's say I want to re-create the HorseKicks table: library(vcd) data(HorseKicks) s

Re: [R] Plot label axis with expression

2012-08-22 Thread David Winsemius
On Aug 22, 2012, at 2:46 PM, Noia Raindrops wrote: Hello, Use 'parse' for converting from character to expression: x <- c(100, 50, 10, 1, 0.1, 0.05, 0.001) plot(log(x), yaxt = "n") parse(text = sprintf("e^%d", axTicks(2))) ## expression(e^-6, e^-4, e^-2, e^0, e^2, e^4) axis(2, at = axTicks(

Re: [R] Iterative sampling with restrictions

2012-08-22 Thread David L Carlson
If I understand you, this is just random assignment over 6 groups: 1/2, 1/3, 2/1, 2/3, 3/1, 3/2. > groups <- c("1/2", "1/3", "2/1", "2/3", "3/1", "3/2") > assign <- sample(rep(groups, 10)) > table(assign) assign 1/2 1/3 2/1 2/3 3/1 3/2 10 10 10 10 10 10 ---

Re: [R] Entering a table

2012-08-22 Thread David L Carlson
Also you were very close with your matrix vex: > vec <- xtabs(vex[2,]~vex[1,]) > names(dimnames(vec)) <- "nDeaths" > vec nDeaths 0 1 2 3 4 109 65 22 3 1 > goodfit(vec) Observed and fitted values for poisson distribution with parameters estimated by `ML' count observed fi

Re: [R] Plot label axis with expression

2012-08-22 Thread Noia Raindrops
Hello, Use 'parse' for converting from character to expression: x <- c(100, 50, 10, 1, 0.1, 0.05, 0.001) plot(log(x), yaxt = "n") parse(text = sprintf("e^%d", axTicks(2))) ## expression(e^-6, e^-4, e^-2, e^0, e^2, e^4) axis(2, at = axTicks(2), labels = parse(text = sprintf("e^%d", axTicks(2))),

Re: [R] Fwd: Need help

2012-08-22 Thread Rui Barradas
Hello, An excelent alternative to Google is package 'sos'. #install.packages('sos') library(sos) > r1 <- findFn('Berger-Parker') found 2 matches > r2 <- findFn('Brillouin') found 0 matches Warning message: In findFn("Brillouin") : HIT not found in HTML; processing one page only. > r1 # open

[R] Plot label axis with expression

2012-08-22 Thread mariojose
Hi all, I need help with axis in plot. I want to edit y axis label of my plot. My data is like: x <- c(100,50,10,1,0.1,0.05,0.001) plot(log(x)) axTicks(2) # Label of y axis [1] -6 -4 -2 0 2 4 I'd like that y axis label was like: e^-6, e^-4, etc. (with text "e" superscript -6, -4, etc.) I t

Re: [R] [Rd] Suggestion for "Writing R Extensions"

2012-08-22 Thread Rui Barradas
Hello, It makes sense. And should be easy to change. Rui Barradas Em 22-08-2012 21:13, Joshua Ulrich escreveu: On Wed, Aug 22, 2012 at 2:58 PM, Oliver Bandel wrote: Hello, Zitat von "Joshua Ulrich" (Wed, 22 Aug 2012 12:35:51 -0500) [...] Would it make sense to add links and/or mention t

Re: [R] Reshaping dataframes

2012-08-22 Thread Rui Barradas
Hello, Your function doesn't seem to be very difficult to generalize. d <- read.table(text=" trg_type child_type_1 1 Scientists NA 2of used ", header=TRUE) str(d) subs_na <- function(tok, na_factor_level = "NOT_REALIZED", na_num = 9) { ifac <- which(sapply(tok, is.fac

Re: [R] Error: ReadItem: unknown type 98, perhaps written by later version of R

2012-08-22 Thread Aldi Kraja
Hi, Here is a solution for this type of error: Error: ReadItem: unknown type 98, perhaps written by later version of R Execution halted Created a script file under the directory where the pgm-s and data reside and ran there ./script.sh where script.sh had the following lines R CMD BATCH ./dc

Re: [R] What makes R different from other programming languages?

2012-08-22 Thread Alexandre Aguiar
Hi. Em Ter 21 Ago 2012, Mark Dalphin escreveu: > I guess the other aspect which I take the most time to describe to any > programmer from other more traditional languages is the working with > vectors. To use R effectively, you must move data in large chunks; the > standard paradigm of looping ove

[R] loading both RPostgreSQL and RSQLite leads to problems

2012-08-22 Thread Jon McAuliffe
hello, if i load the RSQLite package in addition to the RPostgreSQL package, i get various errors when trying to use RPostgreSQL functions. here is an example transcript showing one such error: == R version 2.15.0 (2012-03-30) [...] > packa

Re: [R] plotting Kaplan Meier using ggplot2 returns class function error

2012-08-22 Thread C W
Hi David, Yes, I looked through the comments. I have ran the blog version and the comment version from the blogger. The comment gives error: Error in ggkm(fit, timeby = 500) : attempt to apply non-function So, I chose to go back to blog and fix the class function error. Mike On Wed, Aug 22, 201

Re: [R] plotting Kaplan Meier using ggplot2 returns class function error

2012-08-22 Thread David Winsemius
On Aug 22, 2012, at 12:53 PM, C W wrote: Hi list I am running this ggplot2 R code: http://www.r-bloggers.com/an-enhanced-kaplan-meier-plot/ with its graphical output looks like this: http://statbandit.files.wordpress.com/2011/03/rstudio-v79384.pdf It gives me this error: ggplot2 doesn't know

Re: [R] Is there a data/variable explorer in R?

2012-08-22 Thread David Winsemius
On Aug 22, 2012, at 12:30 PM, Michael wrote: Is there a data/variable explorer in R? Hi all, I am inspecting a complex variable which has lists inside lists... Is there a data-explorer that can help me view the structure and content of such variables? In my Mac GUI there is a Workspace

[R] Reshaping dataframes

2012-08-22 Thread Ingmar Schuster
Hi, I have a data set with variables that are _not_ missing at random. Now I use a package for learning a Bayesian Network which won't accept NA as a value. From a database I query data.frames with k,k+n,k+2n, ... variables (there are always at least k variables as leftmost columns). Using rbind.f

Re: [R] log-normal distribution fitting with expected value = 1

2012-08-22 Thread Biophil
Yes, I'm sure. It's about normalized citation scores, where the individual raw citation score is divided by the average of the whole set of publications. On Aug 22, 2012 7:37 PM, "David Winsemius" wrote: > > On Aug 22, 2012, at 2:23 AM, Biophil wrote: > > Dear R users, >> I would like to estima

Re: [R] rbind in a loop with " : " elements

2012-08-22 Thread bilelsan
You are a GENIUS !! I don't know how to thank you !! Thank you so much ! I really need to improve my R language (I take any advice) If i can do something for you about MGARCH models, let me know Thx again Bilel Le Aug 22, 2012 à 8:55 PM, Rui Barradas [via R] a écrit : > Hello, > > I'm being

[R] plotting Kaplan Meier using ggplot2 returns class function error

2012-08-22 Thread C W
Hi list I am running this ggplot2 R code: http://www.r-bloggers.com/an-enhanced-kaplan-meier-plot/ with its graphical output looks like this: http://statbandit.files.wordpress.com/2011/03/rstudio-v79384.pdf It gives me this error: ggplot2 doesn't know how to deal with data of class function I l

Re: [R] Regular Expressions in grep - Solution and function to determine significant figures of a number

2012-08-22 Thread Bert Gunter
... On Wed, Aug 22, 2012 at 12:46 PM, Dr. Holger van Lishaut wrote: > Dear all, > > regmatches works. > > And, since this has been asked here before: > > SignifStellen<-function(x){ > strx=as.character(x) > nchar(regmatches(strx, regexpr("[1-9][0-9]*\\.[0-9]*[1-9]",strx)))-1 > } > > retur

Re: [R] Is there a data/variable explorer in R?

2012-08-22 Thread Greg Snow
Look at the TkListView function in the TeachingDemos package. On Wed, Aug 22, 2012 at 1:30 PM, Michael wrote: > Is there a data/variable explorer in R? > > Hi all, > > I am inspecting a complex variable which has lists inside lists... > > Is there a data-explorer that can help me view the structu

Re: [R] Barplot with Secondary axis

2012-08-22 Thread Greg Snow
Using par(new=TRUE) will often cause more problems than it helps. A better approach would be to use the twoord.plot function from the plotrix package or to use the updateusr function from the TeachingDemos package along with the lines function to add the lines afterwards. On Wed, Aug 22, 2012 at

Re: [R] Is there a data/variable explorer in R?

2012-08-22 Thread Bert Gunter
Define: "Data explorer." (How can we know what you mean?) I would answer your question: Yes. R. But see also ?str ?summary -- Bert On Wed, Aug 22, 2012 at 12:30 PM, Michael wrote: > Is there a data/variable explorer in R? > > Hi all, > > I am inspecting a complex variable which has lists insi

Re: [R] Regular Expressions in grep - Solution and function to determine significant figures of a number

2012-08-22 Thread Dr. Holger van Lishaut
Dear all, regmatches works. And, since this has been asked here before: SignifStellen<-function(x){ strx=as.character(x) nchar(regmatches(strx, regexpr("[1-9][0-9]*\\.[0-9]*[1-9]",strx)))-1 } returns the significant figures of a number. Perhaps this can help someone. Thanks & best reg

Re: [R] Loop for readLines(URL[i]) fails when URL returns Error 404

2012-08-22 Thread Noia Raindrops
Hello, For example: url <- c("http://www.example.com";, "http://www.example5.com";) res <- vector("list", length(url)) for (i in 1:length(url)) res[[i]] <- try(readLines(url[i]), silent = TRUE) res[[2]] ## [1] "Error in file(con, \"r\") : cannot open the connection\n" ## attr(,"class") ## [1] "tr

Re: [R] gsub -> replace substring in column

2012-08-22 Thread MacQueen, Don
This is untested, but I suspect you should try x[[9]] instead of x[9] If you want to replace the original values with the modified values, then you will need something like, x[[9]] <- gsub(".",",",x[[9]],fixed=T) The difference between single brackets [] and double brackets [[]] is importa

[R] Is there a data/variable explorer in R?

2012-08-22 Thread Michael
Is there a data/variable explorer in R? Hi all, I am inspecting a complex variable which has lists inside lists... Is there a data-explorer that can help me view the structure and content of such variables? Thank you! [[alternative HTML version deleted]] __

Re: [R] Controlling line-join style in Lattice

2012-08-22 Thread Peter Ehlers
You can set grid parameters in the grid.pars component of trellis.par.get(). x <- 1:4; y <- c(1,3,2,4) xyplot(y ~ x, type = "l", lwd = 20) # default linejoin ## set linejoin to 'mitre' trellis.par.set(grid.pars = list(linejoin = "mitre")) xyplot(y ~ x, type = "l", lwd = 20) Peter Ehlers

Re: [R] help

2012-08-22 Thread Gábor Csárdi
Hi, the thing is, you didn't really have any questions in your email. What is the problem with your code? Is it not giving the expected results? More below. On Wed, Aug 22, 2012 at 8:31 AM, Yanis El Omari wrote: [...] > Rm(list()) What is this this supposed to do? Do you mean 'rm(list=ls())' ?

Re: [R] strange behaviour when sourcing inside function

2012-08-22 Thread Noia Raindrops
Hello, If argument 'local' is FALSE, 'source' function is evaluating the file in global environment and object 'a' is not in global environment. Function's environment is just local. And environment() in a function returns the function's environment. test <- function () source("test.R", local

[R] multiline text() with different cex sizes

2012-08-22 Thread Michael Friendly
This question has probably been asked & answered before, but I can't find it: How to print a multiline figure caption in a plot, where different lines have different fonts and font sizes, and so that the lines of text are spaced in a reasonable way. Here's a simple example, where I have to kee

Re: [R] Merging data in R compared to SAS

2012-08-22 Thread rmailbox
Untested code below - Original message - From: ramoss To: r-help@r-project.org Subject: [R] Merging data in R compared to SAS Date: Wed, 22 Aug 2012 07:59:04 -0700 (PDT) Hello, I am a SAS user new to R. What is the R equivalent to following SAS statements: 1) data all; merge test

[R] Loop for readLines(URL[i]) fails when URL returns Error 404

2012-08-22 Thread Shelby McIntyre
I have a loop over readLines(URL[i]) which works fine until it hits a bad URL (e.g., a URL that returns a 404 Error). How can I handle this with a test for this error condition. I read the tryCatch( … ) description but can't figure out how to apply it here. Perhaps there is something else that

Re: [R] rbind in a loop with " : " elements

2012-08-22 Thread Rui Barradas
Hello, I'm being lazy, but the following works. r = 3 ; set.seed(1) v <- matrix(c(rnorm(40)),10,4) result <- vector("list", r*ncol(v)) ires <- 0 for (j in 1:4){ for (i in 1:r){ x <- t(v[,j]^(i)*v[,1:4]^((r-(4-1)):r)) #print(x) ires <- ires + 1 result[[ ires

Re: [R] Barplot with Secondary axis

2012-08-22 Thread Rui Barradas
Hello, You were almost there. x = c("a","b","c","d") y= cbind(c(50,40,30,20),c(40,30,20,10)) y2 = c(0.80,0.65,0.75,0.50) # bp <- barplot(t(y), beside = TRUE) xlim <- c(floor(min(bp)), ceiling(max(bp))) # par(new=T) plot(colMeans(bp), y2, type="o", col="black", lwd=3, lty=1, xaxt="n", yaxt="n

[R] Fwd: Need help

2012-08-22 Thread Elvira M.H
Dear colleagues. I wonder if anybody knows about a procedure in R to calculate the Berger-Parker index and the Brillouin Diversity index. I searched the net but did not find anything good about it. Thanks a lot for any help Mayo, Elvira. [[alternative HTML version deleted]] __

[R] Controlling line-join style in Lattice

2012-08-22 Thread Morgan, Andrew Parker
R users, I am creating a series of scatterplots with Lattice's xyplot(). Some of the plotting symbols are squares with thick borders. The corners of the squares are rounded by default; I would like them to be square. In base graphics this is easily done with par(ljoin = "mitre"), and in grid

[R] use lme4 if given effects' design matrix

2012-08-22 Thread Jie
Dear All, Suppose I have a regular linear mixed model Y|b~ X*beta+Z*b+error; b~N(0, Psi) and would like to fit it to a simulated data, where Y, X and Z are known. I checked some reference but examples are given with the specified variable names. Could some one help me out, please? # R code to try

[R] hat matrix for zeroinfl and hurdle objects

2012-08-22 Thread Christopher Desjardins
Hi, I am wondering if there is an easy way to access the hat matrix for zeroinfl and hurdle objects in the pscl library? Thanks, Chris [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listi

Re: [R] gsub -> replace substring in column

2012-08-22 Thread Rui Barradas
Hello, Your earch pattern is wrong, it should be gsub("\\.", ", ", x[9]) I find x[9] a bit strange, by the way. Specially if the column vector name is V16. Anyway, try the instruction above and if it doesn't work, post a data example with dput( head(x, 16) ) # paste the output of this in

[R] gsub -> replace substring in column

2012-08-22 Thread Paula Cafeld
Hi all, please excuse- I'm a complete newbie to R, so it's possible my question was asked a thousand times before, but I don't get it :-( I imported a CSV file via: x=read.csv("test.csv",header=TRUE,sep="\t") In a column there are values with the dot-character (".") I want to replace with a co

[R] choosing the correct number of clusters usinf NbClust

2012-08-22 Thread Lisa Baxter
I am attempting to use NbClust to examine different indices to determine the number of clusters. The code appears to be working and I am getting results. However, I have noticed that each time I run it I may get different answers. For example looking at the DB index one run recommended 6 clust

[R] strange behaviour when sourcing inside function

2012-08-22 Thread Jannis
Dear R community, I encounter a problem that is counterintuitive to my understanding of the documentation of source and the "local" argument of that function. With the following code, I would expect the content of "test.R" to be evaluated inside the environment of the function "test". This, h

Re: [R] Question concerning anova()

2012-08-22 Thread Bin.You
Hi, I am doing Bayesian Calibration for a model which has 24 parameters using MCMC. I get a sample of 100,000 points from the posterior pdf. Let's say, It is a dataframe named as "BC_output", with 24 parameters (V1,V2,V24) I would like to show the Maximum a Posteriori (MAP)parameter value

[R] Clustered standard errors in Relogit (Zelig)

2012-08-22 Thread Katrine
How do I apply clustered standard errors (by country) when using "relogit" in Zelig? I can not find a function covering this. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

[R] Exporting data to spss

2012-08-22 Thread research email
I have a dataframe of 80+ columns and over 700 rows. I use write.foreigin(data,C:/filename.dat,codefile.sps) and it does write out the .dat file and the code file. Problem is that when I open the codefile in SPSS 20, I can an error message saying there are too many variables and something about

[R] Maximum a Posteriori estimation

2012-08-22 Thread bin you
Hi, I am doing Bayesian Calibration for a model which has 24 parameters using MCMC. I get a sample of 100,000 points from the posterior pdf. Let's say, It is a dataframe named as "BC_output", with 24 parameters (V1,V2,V24) I would like to show the Maximum a Posteriori (MAP)parameter value of

Re: [R] AIC for GAM models

2012-08-22 Thread Rui Barradas
Hello, For gam, try model1$aic. The returned value is an object of class "gam" as described in ?gamObject. For gamm, try model$gam$aic. The returned value is a list of two objects, a "gam" and the return value of "lme" or "|gammPQL". See ?gam and ?gamm, the Value section. Hope this helps, Rui

[R] Merging data in R compared to SAS

2012-08-22 Thread ramoss
Hello, I am a SAS user new to R. What is the R equivalent to following SAS statements: 1) data all; merge test1(in=a) test2(in=b) ; by account_id; if a; run; 2) proc sort data=all nodupkey; by account_id; run; 3) data all test1onnly test2only; merge test1(in=a)

[R] rbind in a loop with " : " elements

2012-08-22 Thread bilelsan
Dear Ruser, Below, the deal (you can copy paste): r=3 ; set.seed(1) v <- matrix(c(rnorm(40)),10,4) for (j in 1:4){ for (i in 1:r){ x <- t(v[,j]^(i)*v[,1:4]^((r-(4-1)):r)) print(x) } } How to reach to " x " " row bind " inside or outside (preferred) of the loop. T

[R] help

2012-08-22 Thread Yanis El Omari
Hi, As a beginner in R, I need some help on a programming problem which, I guess, will seem trivial to you: I am doing some Network analysis in which I need to calculate some metrics for all the weeks I have (each week the network evolves in terms of number of nodes etc...) For exemple, I ne

[R] Barplot with Secondary axis

2012-08-22 Thread vikrant
Hi all, I am trying to plot a bar chart and trying to plot a line as a secondary axis as my scale is different for two y axis. I am plotting a clustered bar chart by using besides = True option in barplot function and my y coordinates are not plotted exactly at the center on each two bars. Pleas

[R] pseudo-additive seasonal decomposition

2012-08-22 Thread Hosia Aino
Dear All, Would anyone happen to have tips on how to do a pseudo-additive seasonal decomposition in R? I am working on a ca. 20 year monthly time series on species abundance data, with annual peaks of varying magnitude and zero abundances between the seasonal occurrences. I have tried to use

Re: [R] log-normal distribution fitting with expected value = 1

2012-08-22 Thread David Winsemius
On Aug 22, 2012, at 2:23 AM, Biophil wrote: Dear R users, I would like to estimate mu and sigma of a log-normal distribution, where I know that the expected value is 1, as it is a normalized distribution. Are you sure that is what "normalized distribution" actually means in the context y

Re: [R] Question concerning anova()

2012-08-22 Thread Rainer M Krug
Further discussed on r-sig-mixed-models Rainer On 22/08/12 17:04, Bert Gunter wrote: Oops -- missed that. OTOH, my reply demonstrates the value of the mixed models list recommendation. -- Bert On Wed, Aug 22, 2012 at 7:55 AM, Rainer M Krug wrote: On 22/08/12 16:36, Bert Gunter wrote: Mode

Re: [R] Simpson diversity in biodiversityR

2012-08-22 Thread Jean V Adams
The functions diversityresult() and diversitycomp() in package BiodiversityR call the function diversity() from package vegan. The calculation of the indices are described in the help file. ?vegan:::diversity Jean Marte Lilleeng wrote on 08/22/2012 09:28:57 AM: > > Hello! > I am searching

Re: [R] Question concerning anova()

2012-08-22 Thread Bert Gunter
Oops -- missed that. OTOH, my reply demonstrates the value of the mixed models list recommendation. -- Bert On Wed, Aug 22, 2012 at 7:55 AM, Rainer M Krug wrote: > On 22/08/12 16:36, Bert Gunter wrote: >> >> Models with different fixed effects estimated by REML cannot be >> compared by anova. >

Re: [R] Question concerning anova()

2012-08-22 Thread Rainer M Krug
On 22/08/12 16:36, Bert Gunter wrote: Models with different fixed effects estimated by REML cannot be compared by anova. I have seen that much in "Modern Applied Statistics in S", and therefore have chosen the model = "ML" In future, please post questions on mixed effects models on the r-si

Re: [R] log-normal distribution fitting with expected value = 1

2012-08-22 Thread R. Michael Weylandt
Take a look at fitdist in the MASS package. Cheers, Michael On Wed, Aug 22, 2012 at 4:23 AM, Biophil wrote: > Dear R users, > I would like to estimate mu and sigma of a log-normal distribution, where I > know that the expected value is 1, as it is a normalized distribution. That > means as E(x

Re: [R] Question concerning anova()

2012-08-22 Thread Bert Gunter
Models with different fixed effects estimated by REML cannot be compared by anova. In future, please post questions on mixed effects models on the r-sig-mixed-effects mailing lists. You're likely to receive more informative replies there, too. -- Bert On Wed, Aug 22, 2012 at 7:23 AM, Rainer M Kr

[R] Simpson diversity in biodiversityR

2012-08-22 Thread Marte Lilleeng
Hello! I am searching and searching, but I can't find information on how the package biodiversityR calculates the Simpson diversity! Can anyone help me on this? (I expected it to be simple) -- Mvh Marte Synnøve Lilleeng tlf 97 74 38 12 __ R-help@r-proje

[R] Question concerning anova()

2012-08-22 Thread Rainer M Krug
Hi I am comparing four different linear mixed effect models, derived from updating the original one. To compare these, I want to use anova(). I therefore do the following (not reproducible - just to illustration purpose!): dat <- loadSPECIES(SPECIES) subs <- expression(dead==FALSE & recTreat=

Re: [R] read info from a website requiring login

2012-08-22 Thread S Ellison
> If I want to read some info from a website, which login is > required, do you know how to do that? For example, > Have a look at the R help posting(s) at http://r.789695.n4.nabble.com/reading-data-from-password-protected-url-td3623663.html S Ellison **

Re: [R] Appending many different and separate Excel files using R

2012-08-22 Thread Rui Barradas
Hello, I'm glad it helped. As for books on R, there are so many nowadays that it's difficult to recommend one. I'd start by seeing the R home page http://www.r-project.org/ and the links on the lower left, under the title Documentation > Books or, for free downloads, Documentation > Other >

[R] AIC for GAM models

2012-08-22 Thread ritapatricio
Dear all, I am analysing growth data - response variable - using GAM and GAMM models, and 4 covariates: mean size, mean capture year, growth interval, having tumors vs. not The models work fine, and fit the data well, however when I try to compare models using AIC I cannot get an AIC value. This

Re: [R] dimnames in an array(I'll be grateful if this message will be passed to all list users)

2012-08-22 Thread aleksandr shfets
Hi, Thank you for the suggestions. I've attached the code in the text file "test"; to run this one needs the CollocInfer package(available under R 2.14, now I think if you have 2.14 on your system you can download CollocInfer from CRAN). I've tried the 'error' options you suggest; using the synt

[R] log-normal distribution fitting with expected value = 1

2012-08-22 Thread Biophil
Dear R users, I would like to estimate mu and sigma of a log-normal distribution, where I know that the expected value is 1, as it is a normalized distribution. That means as E(x) = exp (mu + 1/2*sigma^2) = 1 that 2*mu = -sigma^2 . Therefore I only need to fit one parameter either sigma or mu. How

[R] Class-attribute and method dispatch for the function-class

2012-08-22 Thread Jonas Rauch
Hi everyone. I played with operator overloading for functions and came upon a few peculiarities. I basically wanted to do something like this: > Ops.function<-function(e1, e2) { > Op <- getMethod(.Generic) >if(missing(e2)) return(function(...) Op(e1(...)) ) >if(is.function(e2)) return(f

[R] Remove similar rows from matrix

2012-08-22 Thread Tonja Krueger
Hi everybody, I have a matrix (mat) from which I want to remove all rows that differ from other rows in that matrix only by having one ore two NA’s instead of a numbers. I would like to remove rows with more NA’s preferably, so in the end the matrix would look like mat2. Ha

Re: [R] Combining imputed datasets for analysis using Factor Analysis

2012-08-22 Thread Jose Iparraguirre
Dear Conrad, 1) Have you tried the missMDA package? It imputes missing values of a dataset to perform multiple factor analysis, principal components analysis, etc. 2) The EM algorithm can be used for FA even in the presence of missing values. Two references in this regard: a) Jamshidian, M.

Re: [R] What makes R different from other programming languages?

2012-08-22 Thread Jim Lemon
johannes rara wrote: My intention is to give a presentation about R programming language for software developers. I would like to ask, what are the things that make R different from other programming languages? What are the specific cases where Java/C#/Python developer might say "Wow, that was n

Re: [R] select most frequent value in set of variables

2012-08-22 Thread Jim Lemon
On 08/20/2012 06:48 PM, Sam Dekeyser wrote: Hi, I would like to select the most frequent value level in a set of three variables. Three different observators have judged hair color in study subjects. Mostly they judge the same color, sometimes there is a slight difference. I want to know wha

Re: [R] How should one handle "NA" properly in a .csv dataset?

2012-08-22 Thread jpm miao
Hi, I find the problem. Some of the numbers like "1357" are presented as "1,357". After deleting the comma, everything is ok. Thank you for your attention! Miao 2012/8/22 jpm miao > Hi, > >I am reading several .csv file of time series. Some values of the time > series are unavailable. S

[R] How should one handle "NA" properly in a .csv dataset?

2012-08-22 Thread jpm miao
Hi, I am reading several .csv file of time series. Some values of the time series are unavailable. Some of the unavailable series are marked "NA", and some are just blank. The "NA" value can be read, but the blank cannot be read. Then I change the change the blank to "NA", but they can't be pro