Re: [R] reshape data.frame

2011-11-18 Thread Dennis Murphy
This is very straightforward using the reshape2 package: library('reshape2') dc <- dcast(a, name ~ year, value_var = 'amount') name 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1a123456789 10 NA NA NA NA 2b 11 12

Re: [R] couting events by subject with "black out" windows

2011-11-18 Thread Dennis Murphy
Hi: Here's a Q & D solution that could be improved. It uses the plyr package. Starting from your data1 data frame, library('plyr') dseq <- seq(as.Date('2010-01-01'), as.Date('2011-06-05'), by = '30 days') # Use the cut() function to create a factor whose levels are demarcated # by the dates in ds

Re: [R] Permutations

2011-11-18 Thread R. Michael Weylandt
What build of R can't calculate factorial(150)? I thought the max double of a 32 bit build would be on the order of 10^308 ~ 2^1024 (the material below seems to agree with me on this) But yes, agreed with Ted: it's very helpful to think a bit about what you are calculating when doing these sorts o

Re: [R] autoregression

2011-11-18 Thread Rolf Turner
On 19/11/11 05:54, Keith Thompson wrote: Hi, I am new to R and looking to do auto-regression / ARIMA type modeling. My data has both date and time which I need to combine into a single date-Time value. The time steps are unequal. What package is best for doing the regression and plotting the

Re: [R] reshape data.frame

2011-11-18 Thread Trevor Davies
Thanks David and Bill. I don't know how I couldn't think of that - maybe because I'm working through a brutal flu right now. Thanks for the help. This list is a fantastic resource. Trevor On Fri, Nov 18, 2011 at 4:18 PM, David Winsemius wrote: > > On Nov 18, 2011, at 7:04 PM, Trevor Davies wr

Re: [R] reshape data.frame

2011-11-18 Thread David Winsemius
On Nov 18, 2011, at 7:04 PM, Trevor Davies wrote: A late friday afternoon coding question. I'm having a hard time thinking of the correct search terms for what I want to do. If I have a df like this: a <- data.frame(name=c(rep('a',10),rep('b', 15)),year=c(1971:1980,1971:1985),amount=1:25)

Re: [R] reshape data.frame

2011-11-18 Thread William Dunlap
You can use the reshape() in core R (the stats package) > reshape(a, timevar="year", idvar="name", direction="wide") name amount.1971 amount.1972 amount.1973 amount.1974 1 a 1 2 3 4 11b 11 12 13 14 amount.197

[R] cannot set the path to installed R packages when building a package vignette

2011-11-18 Thread Vincent Plagnol
Dear colleagues, I am having issues trying to build a R package I recently wrote. I am using R 2.14.0 and my package depends on another package called aod. Running: R CMD Sweave vignette.Rnw is perfectly fine and the vignette compiles properly. but when I use R CMD build mypackage to build the ta

Re: [R] [R-sig-ME] account for temporal correlation

2011-11-18 Thread matteo dossena
Thanks again, really appreciate that. Il giorno 18 Nov 2011, alle ore 23:06, Ben Bolker ha scritto: > [cc'ing back to r-help] > > On Fri, Nov 18, 2011 at 4:39 PM, matteo dossena > wrote: >> Thanks a lot, >> >> just to make sure i got it right, >> >> if (using the real dataset) from the LogL

[R] Producing plot using polygon function

2011-11-18 Thread avinash barnwal
Hi, I am looking forward to fill the plot using conditions on variables a2 and a3. Whenever variable(a2) goes above variable(a3) i fill it with some color . I am storing the coordinates of a2 and a3 in x and y as well as time where it is occurring . But it is not producing properly. I must be wro

Re: [R] Filling a variable with unmentioned categories

2011-11-18 Thread jim holtman
will this work for you: > str(x) 'data.frame': 10 obs. of 2 variables: $ price: chr "0,00" "0,00" "0,02" "0,03" ... $ mentioned: int 1 1 1 1 1 1 1 1 1 1 > # create vector with range of 'price' > allPrices <- paste('0,', sprintf("%02d", 0:19), sep = '') > # find missing prices and add wi

[R] reshape data.frame

2011-11-18 Thread Trevor Davies
A late friday afternoon coding question. I'm having a hard time thinking of the correct search terms for what I want to do. If I have a df like this: a <- data.frame(name=c(rep('a',10),rep('b',15)),year=c(1971:1980,1971:1985),amount=1:25) name year amount 1 a 1971 1 2 a 1972

[R] elemental composition from exact mass

2011-11-18 Thread eldor ado
dear R-listers, does anyone of you know whether there is any R package that features a alogarithm to calculate the sum formula from a given exact mass (as used in mass spectrometry)? thanks a lot, lukas -- Lukas Kohl Department of Chemical Ecology and Ecosystem Research http://www.ecosystem-res

[R] couting events by subject with "black out" windows

2011-11-18 Thread Chris Conner
I large datset that includes subjects(ID), Dates and events that need to be counted.  Not every date includes an event, and I need to only count one event per 30days, per subject.  So in essence, I need to create a 30-day "black out" period during which time an event cannot be "counted" for each

Re: [R] [R-sig-ME] account for temporal correlation

2011-11-18 Thread Ben Bolker
[cc'ing back to r-help] On Fri, Nov 18, 2011 at 4:39 PM, matteo dossena wrote: > Thanks a lot, > > just to make sure i got it right, > > if (using the real dataset) from the LogLikelihood ratio test model1 isn't > "better" than model, > means that temporal auto correlation isn't seriously affec

Re: [R] S4 : defining [<- using inheritance from 2 classes

2011-11-18 Thread Martin Morgan
On 11/17/2011 09:46 PM, cgenolin wrote: Hi the list, I define a class 'C' that inherit from two classes 'A' and 'B'. 'A' and 'B' have no slot with similar names. setClass( Class="C", contains=c("A","B") ) To define the get operator '[' for class "C", I simply use the

Re: [R] Problem Installing R 2.9.1.1 RHEL x86_64 binary

2011-11-18 Thread dona...@hotmail.com
You can use Extra Packages for Enterprise Linux (or EPEL) to install your RPM from. https://fedoraproject.org/wiki/EPEL -- View this message in context: http://r.789695.n4.nabble.com/Problem-Installing-R-2-9-1-1-RHEL-x86-64-binary-tp900310p4084929.html Sent from the R help mailing list archive

Re: [R] Permutation matrix

2011-11-18 Thread Bert Gunter
1. We don't do homework on this list. 2. "... which is of the size 10 by 2^10." No it isn't. (Hint: Many of the permutations are not distinct). -- Bert On Fri, Nov 18, 2011 at 2:02 PM, Gyanendra Pokharel wrote: >  Hi all, > I have a set of elements (1, 1, 0,1,1,0,1,0,1,1) with ten elements. I

[R] Permutation matrix

2011-11-18 Thread Gyanendra Pokharel
Hi all, I have a set of elements (1, 1, 0,1,1,0,1,0,1,1) with ten elements. I have to construct the permutation matrix of this set which is of the size 10 by 2^10. Can some one help how is this possible? Is there is a particular function in R or I need to make function? Best [[alternativ

Re: [R] Question about package installation

2011-11-18 Thread David Winsemius
On Nov 18, 2011, at 3:52 PM, Roger Coupal wrote: Hi, I am working with R on a Mac. I need to use a couple of packages that I found on the Web site. I install them using Packages and Data: Package Manager. I leave R and come back another time and the installed packages are not installed. So

Re: [R] simultaneously maximizing two independent log likelihood functions using mle2

2011-11-18 Thread Adam Zeilinger
Dear Dr. Bolker and R list, Thanks so much for the help! Apologies for taking so long to write back, I've been distracted with other work. Between your response and the suggested section in the EMD book, I was able to figure it out! I have another question. I ran three optimization runs wi

Re: [R] Question about package installation

2011-11-18 Thread R. Michael Weylandt
I don't really know about the second half of your email, but are you sure you don't just need to reload the packages with the library() command rather than reinstalling them? It's also to set up autoload: google Rprofile for instructions. Michael On Nov 18, 2011, at 3:52 PM, Roger Coupal wro

Re: [R] How to fill irregular polygons with patterns?

2011-11-18 Thread baptiste auguie
Hi, Two possible routes I can suggest: 1- export the plot in svg format, which supports natively the use of filling patterns, e.g. http://www.w3.org/TR/SVG/images/pservers/pattern01.svg It's possible that the gridSVG package could help you automate the process of "grid.garnish()-ing" the grobs;

[R] Question about package installation

2011-11-18 Thread Roger Coupal
Hi, I am working with R on a Mac. I need to use a couple of packages that I found on the Web site. I install them using Packages and Data: Package Manager. I leave R and come back another time and the installed packages are not installed. So I do it again. Not a big deal, but is there anyway to

Re: [R] tip: large plots

2011-11-18 Thread Franklin Bretschneider
Dear Sarah, RE: > Hi all, > > I'm working with a bunch of large graphs, and stumbled across > something useful. Probably many of you know this, but I didn't and so > others might benefit. > > Using pch="." speeds up plotting considerably over using symbols. > >> x <- runif(100) >> y <- run

[R] Kalman Filter with dlm

2011-11-18 Thread Pearl
I have built a Kalman Filter model for flu forecasting as shown below. Y - Target Variable X1 - Predictor1 X2 - Predictor2 While forecasting into the future, I will NOT have data for all three variables. So, I am predicting X1 and X2 using two Kalman filters. The code is below x1.model <- dl

Re: [R] Permutations

2011-11-18 Thread Ted Harding
On 18-Nov-11 16:03:44, Gyanendra Pokharel wrote: > Hi all, > why factorial(150) shows the error out of range in 'gammafn'? > I have to calculate the number of subset formed by 150 samples > taking 10 at a time. How is this possible? > best Because factorial(150) is nearly 10^263, which is far grea

Re: [R] tip: large plots

2011-11-18 Thread Justin Haynes
That is a function I did not know about, thanks Hadley! I still don't see the speed increase that you do with the base plot package, but I'm sticking with ggplot anyway! > x<-runif(1e6) > y<-runif(1e6) > system.time(print(qplot(x,y))) user system elapsed 42.234 0.520 43.061 > system.time(

Re: [R] tip: large plots

2011-11-18 Thread Hadley Wickham
You need: system.time(print(qplot(x,y,pch=I('.' Hadley On Fri, Nov 18, 2011 at 1:30 PM, Justin Haynes wrote: > Very cool.  Sadly, as far as I can tell, it doesn't work with ggplot though > :( > > >> x<-runif(1e6) >> y<-runif(1e6) >> system.time(plot(x,y,pch='.')) >   user  system elapsed >  

[R] R and Tinn-R communication problems

2011-11-18 Thread John Kane
I have a couple of Tinn-R problems that I hope someone may be able to make some suggestions about or point me to a Tinn-R source. So far I have not found anything particularly relevant by googling on Tinn-R. NOTE: Just to be on the safe side I uninstalled both R and Tinn-R , ran some cleanup

Re: [R] tip: large plots

2011-11-18 Thread Justin Haynes
Very cool. Sadly, as far as I can tell, it doesn't work with ggplot though :( > x<-runif(1e6) > y<-runif(1e6) > system.time(plot(x,y,pch='.')) user system elapsed 0.824 0.012 0.845 > system.time(plot(x,y)) user system elapsed 33.422 0.016 33.545 > system.time(print(qplot(x,y)))

[R] Block length for Bivariate Stationary Bootstrap for Inference for Correlation

2011-11-18 Thread Andreas Klein
Hello, I am searching for a method, algorithm or some solution to the following problem: I need an estimator for the block length of two series to bootstrap the correlation coefficient with the stationary bootstrap procedure. The problem here: the two series have different block lengths! Here

[R] NB and poisson glm models: three issues

2011-11-18 Thread D_Tomas
Hi, I fit both Poisson and NB (negative binomial) models to some empirical data. Although models provide me with sensible parameters, in the case of the NB models i get three inconsistencites: - First, the total number of occurrences predicted by the model (i.e. fitted(fit)) is much greater th

Re: [R] Very simple loop

2011-11-18 Thread John Kane
As others have said, no need for a loop Another approach mydata <- data.frame(A = dpois(x,exp(4.5355343)), B = dpois(x,exp(4.5355343 + 0.0118638)), C = dpois(x,exp(4.5355343 -0.0234615)), D = dpois(x,exp(4.5355343 + 0.0316557)), E = dpois(x,exp(4.5355343 + 0.0004716)), F = dpois(x,exp(4.5355343 +

Re: [R] Export Tree for latex

2011-11-18 Thread RMSOPS
Hello, This is the code to generate the tree library(RWeka) library(randomForest) library(party) library(partykit) if(require(mlbench, quietly = TRUE) && require(party, quietly = TRUE)) m1 <- J48(income2 ~ capital.gain+capital.loss+relationship+marital.status, data = treino) #m1 <- J48(in

[R] R: writing data from one matrix into another with keeping NA's

2011-11-18 Thread Karl Weinmayer
Hi, I am looking to build even quintiles for a set of data. I managed to get it done, but I would like to know if there is a more direct way to write the data from my loop output x in the bottom of the code into the "empty" matrix p1, which I filled with NA's. The way I am doing it at the momen

[R] tip: large plots

2011-11-18 Thread Sarah Goslee
Hi all, I'm working with a bunch of large graphs, and stumbled across something useful. Probably many of you know this, but I didn't and so others might benefit. Using pch="." speeds up plotting considerably over using symbols. > x <- runif(100) > y <- runif(100) > system.time(plot(x, y,

Re: [R] Reading a file w/ two delimiters

2011-11-18 Thread Bert Gunter
... and yet another line I left out below! I apologize for this baloney! On Fri, Nov 18, 2011 at 10:48 AM, Bert Gunter wrote: > ... I failed to correctly paste the first line of an example: > > On Fri, Nov 18, 2011 at 10:44 AM, Bert Gunter wrote: >> David: >> >> As you now realize "\t" etc. is

Re: [R] Reading a file w/ two delimiters

2011-11-18 Thread Bert Gunter
... I failed to correctly paste the first line of an example: On Fri, Nov 18, 2011 at 10:44 AM, Bert Gunter wrote: > David: > > As you now realize "\t" etc. is a perfectly legal single tab character. > > Now consider: - left this out -- > gsub("\\","a","\\") -

Re: [R] Reading a file w/ two delimiters

2011-11-18 Thread Bert Gunter
David: As you now realize "\t" etc. is a perfectly legal single tab character. Now consider: Error in gsub("\\", "a", "\\") : invalid regular expression '\', reason 'Trailing backslash' BUT > gsub("","a","\\") [1] "a" ??? The issue is there are two levels of escapes here -- the R parser

Re: [R] One-way repeated measures ANOVA

2011-11-18 Thread John Fox
Dear Varina, I think that you may be confusing the Anova() function in the car package (which takes an idesign argument) with the standard R anova() function. I hope this helps, John John Fox Senator William McMaster Professor of Social Statistics Department o

[R] How to fill irregular polygons with patterns?

2011-11-18 Thread Ortiz, John
Hi, I'm looking the best way to fill irregular polygons with patterns, Something like the function grid.pattern do, but my case is with irregular polygons. Whit this script I can get it, but I'm looking for an "elegant" solution.. library(grid) grid.polygon(x=c(0.2, 0.8, 0.6, 0.6, 0.8, 0.2),

Re: [R] Filling a variable with unmentioned categories

2011-11-18 Thread Milan Bouchet-Valat
Le vendredi 18 novembre 2011 à 15:06 +, Mario Giesel a écrit : > Hello, list, > > I've been struggling with this task for a while looking for an efficient way > to solve it: > There are two variables 'price' and 'mentioned'. > I want to 'enlarge' data so that missing price points within the p

Re: [R] help

2011-11-18 Thread Sarah Goslee
I have no idea what you're talking about, and you're probably on the wrong mailing list. I'm sure there's Mathematica help out there. Sarah On Fri, Nov 18, 2011 at 10:53 AM, Somaye Node wrote: > > Thanks for your reply, > i cant open three sites. > all the best. > > --- On Fri, 11/18/11, Sarah G

[R] autoregression

2011-11-18 Thread Keith Thompson
Hi, I am new to R and looking to do auto-regression / ARIMA type modeling. My data has both date and time which I need to combine into a single date-Time value. The time steps are unequal. What package is best for doing the regression and plotting the predicted values against the actual data?

Re: [R] Ensuring a matrix to be positive definite, case involving three matrices

2011-11-18 Thread Giovanni Petris
You may want to look at the following paper. Best, Giovanni Reference Type: Journal Article Author: Pinheiro, José C. Author: Bates, Douglas M. Primary Title: Unconstrained parametrizations for variance-covariance matrices Journal Name: Statistics and Computing Cover Date: 1996-09-01 Publisher: S

Re: [R] Permutations

2011-11-18 Thread Gavin Simpson
On Fri, 2011-11-18 at 11:03 -0500, Gyanendra Pokharel wrote: > Hi all, > why factorial(150) shows the error out of range in 'gammafn'? > I have to calculate the number of subset formed by 150 samples taking 10 at > a time. How is this possible? > best Do you mean: > choose(150, 10) [1] 1.169554e+

Re: [R] function sum for array

2011-11-18 Thread William Dunlap
S+'s help(apply) says MARGIN the subscripts over which the function is to be applied. For example, if X is a matrix, MARGIN=1 indicates rows and MARGIN=2 indicates columns. If the dimensions of X are named, then the names can be used to specify MARGIN. Note that MARGIN tells which dim

[R] Permutations

2011-11-18 Thread Gyanendra Pokharel
Hi all, why factorial(150) shows the error out of range in 'gammafn'? I have to calculate the number of subset formed by 150 samples taking 10 at a time. How is this possible? best [[alternative HTML version deleted]] __ R-help@r-project.org mai

Re: [R] Reading a file w/ two delimiters

2011-11-18 Thread Gabor Grothendieck
On Fri, Nov 18, 2011 at 10:26 AM, David Winsemius wrote: > > On Nov 18, 2011, at 9:28 AM, jim holtman wrote: > >> It is pretty straightforward in R: >> >>> x <- >>> readLines(textConnection("sadf|asdf|asdf\tqwer|qwer|qwer\tzxcv|zxcv|zxfcgv")) >>> closeAllConnections() >>> # convert tabs to newline

Re: [R] length of empty string

2011-11-18 Thread R. Michael Weylandt
Because it's a character vector with only one element, which just happens to be empty - sort of like why the cardinality of the set { /O } is one. (/O being my best shot at the empty set symbol in plain text). You might be thinking of nchar(). Michael On Nov 18, 2011, at 10:09 AM, "Jaensch,

Re: [R] length of empty string

2011-11-18 Thread David Winsemius
On Nov 18, 2011, at 10:09 AM, Jaensch, Steffen [TIBBE] wrote: Hi all, Can somebody explain why length("") returns 1 and not 0? How do I test if a given string is the empty string? character(0) is not the same as "" -- David Winsemius, MD West Hartford, CT __

Re: [R] length of empty string

2011-11-18 Thread Rainer Schuermann
> nchar("") > > [1] 0 On Friday 18 November 2011 16:09:38 Jaensch, Steffen [TIBBE] wrote: > Hi all, > > > > Can s

Re: [R] length of empty string

2011-11-18 Thread Milan Bouchet-Valat
Le vendredi 18 novembre 2011 à 16:09 +0100, Jaensch, Steffen [TIBBE] a écrit : > Hi all, > > Can somebody explain why length("") returns 1 and not 0? Probably because it contains one element, "". > How do I test if a given string is the empty string? a <- "" a == "" [1] TRUE Seems to be enough to

[R] length of empty string

2011-11-18 Thread Jaensch, Steffen [TIBBE]
Hi all, Can somebody explain why length("") returns 1 and not 0? How do I test if a given string is the empty string? Thanks, Steffen. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.c

[R] One-way repeated measures ANOVA

2011-11-18 Thread Varina Crisfield
Hi all, I'm trying to run a repeated measures ANOVA on some univariate ecological data that was collected over two growing seasons. I ran the test using the methodology found on this website: http://rtutorialseries.blogspot.com/2011/02/r-tutorial-series-one-way-repeated.html Upon running the act

[R] Export Tree for latex

2011-11-18 Thread RMSOPS
Hello everybody. I'm trying to send the result of a decision tree for latex, but I do not get with the package(xtable), there is a package that make this export Export this for latex marital.status = Divorced | educational.num <= 12: <=50K (1795.0/90.0) | educational.num > 12 | | ho

[R] Filling a variable with unmentioned categories

2011-11-18 Thread Mario Giesel
Hello, list,   I've been struggling with this task for a while looking for an efficient way to solve it: There are two variables 'price' and 'mentioned'. I want to 'enlarge' data so that missing price points within the price range are added to variable price. Also variable 'mentioned' is to recei

Re: [R] Export Tree for latex

2011-11-18 Thread jdanielnd
What kind of object it is? How was it generated? It doesn't have a plot method? -- View this message in context: http://r.789695.n4.nabble.com/Export-Tree-for-latex-tp4083586p4083593.html Sent from the R help mailing list archive at Nabble.com. __ R-h

Re: [R] Reading a file w/ two delimiters

2011-11-18 Thread David Winsemius
On Nov 18, 2011, at 9:28 AM, jim holtman wrote: It is pretty straightforward in R: x <- readLines(textConnection("sadf|asdf|asdf\tqwer|qwer|qwer\tzxcv| zxcv|zxfcgv")) closeAllConnections() # convert tabs to newlines x <- gsub("\t", "\n", x) Did the rules get liberalized for escaping patter

Re: [R] Reading a file w/ two delimiters

2011-11-18 Thread jim holtman
The thing to watch out for is if you file is large, 'textConnection' is very slow at providing the data stream for something like read.table. It is usually much faster to read in the file with 'readLines', preprocess the data data, write it out to a tempfile and then read it back in with 'read.tab

Re: [R] Obtaining a derivative of nls() SSlogis function

2011-11-18 Thread Gabor Grothendieck
On Thu, Nov 17, 2011 at 4:40 PM, Katrina Bennett wrote: > Hello, I am wondering if someone can help me. I have the following function > that I derived using nls() SSlogis. I would like to find its derivative. I > thought I had done this using deriv(), but for some reason this isn't > working out f

Re: [R] Reading a file w/ two delimiters

2011-11-18 Thread David Winsemius
On Nov 18, 2011, at 9:13 AM, Langston, Jim wrote: Thanks Paul, That's the path I was marching down, I was hoping for something a little cleaner, I do the same with Perl or Java. > tesfil <- "aa|bb|cc\tdd|ee|ff\t" > read.table(textConnection(gsub("\\\t", "\n", scan( textConnec

Re: [R] cca with repeated measures

2011-11-18 Thread Gavin Simpson
On Fri, 2011-11-18 at 15:17 +0100, René Mayer wrote: > Thanks a lot Gavin!, > this was what I was looking for. > Have I got this right that with no 'cyclic shifts *within* strata' you > mean that I cannot define a nesting within animal, e.g., > animal/year/season (speaking in regression-terms

[R] Ensuring a matrix to be positive definite, case involving three matrices

2011-11-18 Thread Pacin Al
Hi, I would like to know what should I garantee about P and GGt in order to have F = Z %*% P %*% t(Z) + GGt always as a positive definite matrix. Being more precise: I am trying to find minimum likelihood parameters by using the function 'optim' to find the lowest value generated by $LogLik fro

[R] StepAIC and boxplot

2011-11-18 Thread David martin
Hello, I have done a stepwise analysis to determine the best model fitting my data. data <- stepAIC( aov (Group)~ . , data=mydata) data > summary(data) Df Sum Sq Mean Sq F valuePr(>F) `a` 1 1.9829 1.98290 11.176 0.0011824 ** `b` 1 2.6606 2.66064 14.996 0.0001967 ***

Re: [R] Apply functions along "layers" of a data matrix

2011-11-18 Thread David Winsemius
On Nov 18, 2011, at 8:05 AM, wrote: Hello How can I apply functions along "layers" of a data matrix? Example: daf <- data.frame( 'id' = rep(1:5, 3), matrix(1:60, nrow=15, dimnames=list( NULL, paste('v', 1:4, sep='') )), rep = rep(1:3, each=5) ) The data frame "daf" contains 3 repetit

Re: [R] Reading a file w/ two delimiters

2011-11-18 Thread jim holtman
It is pretty straightforward in R: > x <- > readLines(textConnection("sadf|asdf|asdf\tqwer|qwer|qwer\tzxcv|zxcv|zxfcgv")) > closeAllConnections() > # convert tabs to newlines > x <- gsub("\t", "\n", x) > # write out to a temp file and then read in as a data frame > myFile <- tempfile() > writeLin

Re: [R] Import Access MDB on line

2011-11-18 Thread Barry Rowlingson
On Fri, Nov 18, 2011 at 1:53 PM, Raphael Saldanha wrote: > I would like > to import this dataset direct into R, without saving the file on disk > (for using the most updated file), You don't really have much choice - I'm certain that the mdb-tools won't read from a remote ftp server and I susp

Re: [R] cca with repeated measures

2011-11-18 Thread René Mayer
Thanks a lot Gavin!, this was what I was looking for. Have I got this right that with no 'cyclic shifts *within* strata' you mean that I cannot define a nesting within animal, e.g., animal/year/season (speaking in regression-terms random-effects for the animal-specific season and year varia

Re: [R] Reading a file w/ two delimiters

2011-11-18 Thread Langston, Jim
Thanks Paul, That's the path I was marching down, I was hoping for something a little cleaner, I do the same with Perl or Java. Jim On 11/18/11 8:35 AM, "Paul Hiemstra" wrote: >Hi Jim, > >You can read the text file using readLines. This puts each line in the >file into an element of a list. Th

Re: [R] how to define the bound between parameters in nls() (Jinsong Zhao)

2011-11-18 Thread John C Nash
The multiple exponential problem you are attempting has a well-known and long history. Lanczos 1956 book showed that changing the 4th decimal in a data set changes the parameters hugely. Nevertheless, if you just need a "fit" and not reliable paramters, you could reparameterize to k1 and k2diff=

Re: [R] Obtaining a derivative of nls() SSlogis function

2011-11-18 Thread John C Nash
I think you need to make an expression. I tried > nls.fn <- asym/((1+exp((xmid-x.seq)/scal))) Error: object 'asym' not found > nls.fn <- expression(asym/((1+exp((xmid-x.seq)/scal > D(nls.fn,"asym") 1/((1 + exp((xmid - x.seq)/scal))) > Does that help? Maybe there are other approaches too. JN

Re: [R] Introducing \n's so that par.strip.text can produce multiline strips in lattice

2011-11-18 Thread Ashim Kapoor
Dear David, Thank you. That was very clear. I will try to make minimal examples in the future. Best Regards, Ashim On Fri, Nov 18, 2011 at 6:50 PM, David Winsemius wrote: > > On Nov 18, 2011, at 1:51 AM, Ashim Kapoor wrote: > > Dear Dennis, >> >> Many thanks.I was wondering if there was a way

Re: [R] Import Access MDB on line

2011-11-18 Thread Raphael Saldanha
I am really sorry for the inconvenience, this will not repeat again. This message is in plain text and I will try give every information needed. If I'm not obeying some of the recommendations on the Posting Guide, please let me know. The IBGE, a Brazilian foundation of Geography and Statistics, ha

Re: [R] number of items to replace is not a multiple of replacement length

2011-11-18 Thread Milan Bouchet-Valat
Le vendredi 18 novembre 2011 à 04:45 -0800, Gyanendra Pokharel a écrit : > Hi all, following is my R -code and shows the error given below > > n <- 100 > > k<-2 > > x1 <-c(1, 3);x2 <- c(2,5) > > X <- matrix(c(0,0), nrow = 2, ncol = n) > > for(i in 1:k) > + X[i, ] <- mh1.epidemic(n,x1[i],x2[i]) > Er

Re: [R] how to normalize a subset of affy data using MAS5 method

2011-11-18 Thread Martin Morgan
On 11/18/2011 02:55 AM, Anup Som wrote: Dear all, I was trying to normalize a subset of affy data those transcribe are either P or M (called pm_filter). I am able to normalize pm_filter subset by using RMA method, however MAS5 is not working. For RMA method, I used the following com

Re: [R] Reading a file w/ two delimiters

2011-11-18 Thread Paul Hiemstra
Hi Jim, You can read the text file using readLines. This puts each line in the file into an element of a list. Then you can go through the lines manually (e.g. using grep, sub, strsplit) and create your data.frame. cheers, Paul On 11/18/2011 12:37 PM, Langston, Jim wrote: > Hi all, > > I've been

Re: [R] libpng warning: Application built with libpng-1.2.26 but running with 1.5.2

2011-11-18 Thread Paul Hiemstra
...in addition, you might get more answers on the R-sig-mac mailing list. Paul On 11/18/2011 12:34 PM, Assa Yeroslaviz wrote: > Hi, > > I have a problem on my mac when trying in R to produce png images. > > I am getting this warnings with the ArrayQualityMetrics package: > >> arrayQualityMetrics(

Re: [R] Obtaining a derivative of nls() SSlogis function

2011-11-18 Thread David Winsemius
On Nov 17, 2011, at 4:40 PM, Katrina Bennett wrote: Hello, I am wondering if someone can help me. I have the following function that I derived using nls() SSlogis. I would like to find its derivative. I thought I had done this using deriv(), but for some reason this isn't working out for me

Re: [R] libpng warning: Application built with libpng-1.2.26 but running with 1.5.2

2011-11-18 Thread Paul Hiemstra
Hi, Cross-posting between this list and stackoverflow is discouraged. cheers, Paul On 11/18/2011 12:34 PM, Assa Yeroslaviz wrote: > Hi, > > I have a problem on my mac when trying in R to produce png images. > > I am getting this warnings with the ArrayQualityMetrics package: > >> arrayQualityMet

Re: [R] Apply functions along "layers" of a data matrix

2011-11-18 Thread Paul Hiemstra
On 11/18/2011 01:05 PM, saschav...@gmail.com wrote: > daf <- data.frame( > 'id' = rep(1:5, 3), > matrix(1:60, nrow=15, dimnames=list( NULL, paste('v', 1:4, sep='') )), > rep = rep(1:3, each=5) > ) Hi, This seems like a job for plyr! library(plyr) ddply(daf, .(rep), summarise, mn = mean(v1))

Re: [R] Apply functions along "layers" of a data matrix

2011-11-18 Thread Dennis Murphy
Hi: Here are two ways to do it; further solutions can be found in the doBy and data.table packages, among others. library('plyr') ddply(daf, .(id), colwise(mean, c('v1', 'v2', 'v3', 'v4'))) aggregate(cbind(v1, v2, v3, v4) ~ id, data = daf, FUN = mean) # Result of each: id v1 v2 v3 v4 1 1 6

Re: [R] Introducing \n's so that par.strip.text can produce multiline strips in lattice

2011-11-18 Thread David Winsemius
On Nov 18, 2011, at 1:51 AM, Ashim Kapoor wrote: Dear Dennis, Many thanks.I was wondering if there was a way to edit the variable and put \n's in it. Is there ? Of course there is. The key however ti to realize that at the moment there are "\\"'s and "n"'s but not any single characters

Re: [R] Import Access MDB on line

2011-11-18 Thread Barry Rowlingson
On Fri, Nov 18, 2011 at 12:15 PM, Raphael Saldanha wrote: > Hi! > > I need to import an Access MDB database from this FTP address: > ftp://geoftp.ibge.gov.br/Organizacao/Localidades/cadastro_localidades_selecionadas.mdb > > I tried with Hmisc mdb.get and RODBC without sucess any tip? > What

[R] how to normalize a subset of affy data using MAS5 method

2011-11-18 Thread Anup Som
Dear all, I was trying to normalize a subset of affy data those transcribe are either P or M (called pm_filter). I am able to normalize pm_filter subset by using RMA method, however MAS5 is not working. For RMA method, I used the following commend: est<-rma(affydata, subset=pm_filter)

[R] number of items to replace is not a multiple of replacement length

2011-11-18 Thread Gyanendra Pokharel
Hi all, following is my R -code and shows the error given below > n <- 100 > k<-2 > x1 <-c(1, 3);x2 <- c(2,5) > X <- matrix(c(0,0), nrow = 2, ncol = n) > for(i in 1:k) + X[i, ] <- mh1.epidemic(n,x1[i],x2[i]) Error in X[i, ] <- mh1.epidemic(n,x1[i],x2[i]):   number of items to replace is not a mult

[R] Fwd: xtable and sweave: caption placement problem

2011-11-18 Thread renger
Dear All I am running Sweave with xtable and want to put the caption placement on top. But this does not work. Any idea what is going wrong? Here is an example that runs properly with the exception of the caption placement in the pdf-file. \documentclass[11pt,a4paper]{article} \usepackage

[R] Sweave

2011-11-18 Thread Guillaume Meurice
Dear all, I'm trying to use sweave, but running the demo example, I got problem. First, I'm realluy a beginner with LaTeX and sweave, so sorry if my question seems weird. First I've installed mactex distribution : http://www.tug.org/mactex/2011/ I've set up the "SWEAVE_STYLEPATH_DEFAULT" envi

[R] GSOC-R 2012

2011-11-18 Thread Toby Hocking
With John Nash, I am an administrator for the R project's contribution to the Google Summer of Code 2012. This is a program where Google provides $5000 to a student to write code for an open source project over a 3 month period in the summer. We would like to invite anyone interested in being ei

[R] Apply functions along "layers" of a data matrix

2011-11-18 Thread saschaview
Hello How can I apply functions along "layers" of a data matrix? Example: daf <- data.frame( 'id' = rep(1:5, 3), matrix(1:60, nrow=15, dimnames=list( NULL, paste('v', 1:4, sep='') )), rep = rep(1:3, each=5) ) The data frame "daf" contains 3 repetitions/layers (rep) of 4 variables of 5 p

Re: [R] Fisher Exact Test

2011-11-18 Thread Patrick Breheny
On 11/17/2011 06:29 PM, Abraham Mathew wrote: I have information on two versions of the same site, and I have data on the number of times people filled out a form on each version of the site. Sample data: Site 1 Site 2 Filled out form

[R] Import Access MDB on line

2011-11-18 Thread Raphael Saldanha
Hi! I need to import an Access MDB database from this FTP address: ftp://geoftp.ibge.gov.br/Organizacao/Localidades/cadastro_localidades_selecionadas.mdb I tried with Hmisc mdb.get and RODBC without sucess any tip? Regards, Raphael Saldanha saldanha.plan...@gmail.com [[alternative

[R] Reading a file w/ two delimiters

2011-11-18 Thread Langston, Jim
Hi all, I've been scratching and poking, but basically, the file I need to read has two delimiters that I need to contend with. The first is that the file contains tabs (\t) , instead of newlines (\n), and the second is that the fields have | for the seperators. I can easily do a read if I first

[R] libpng warning: Application built with libpng-1.2.26 but running with 1.5.2

2011-11-18 Thread Assa Yeroslaviz
Hi, I have a problem on my mac when trying in R to produce png images. I am getting this warnings with the ArrayQualityMetrics package: > arrayQualityMetrics(rma_fatBody, outdir="normData", force =T) The report will be written into directory 'normData'. KernSmooth 2.23 loaded Copyright M. P. Wan

Re: [R] merging corpora and metadata

2011-11-18 Thread Milan Bouchet-Valat
Le jeudi 17 novembre 2011 à 21:34 -0500, R. Michael Weylandt a écrit : > Hi Josh, > > You're absolutely right. I suppose one could set up some sort of S3 > thing for Henri's problem: > > c <- function(..., recursive = FALSE) UseMethod("c") > c.default <- base::c > c.corpus <- function(..., recurs

Re: [R] Spatial Statistics using R

2011-11-18 Thread Raphael Saldanha
And you always can count with the help of the R-SIG-GEO list: https://stat.ethz.ch/mailman/listinfo/r-sig-geo On Fri, Nov 18, 2011 at 4:54 AM, vioravis wrote: > Thanks a lot for the guidance. I will take a look at these options. > > Ravi > > -- > View this message in context: > http://r.789695.n

Re: [R] xtable and sweave: caption placement problem

2011-11-18 Thread Rainer Schuermann
It works if you separate the print command and put the caption placement in the print command , see below: \documentclass[11pt,a4paper]{article} \usepackage{Sweave} \begin{document} <<>>= x = runif(100, 1, 10) y = 2 + 3 * x + rnorm(100) @ <>= library(xtable) p <- (xtable(summary(lm(

Re: [R] cca with repeated measures

2011-11-18 Thread Gavin Simpson
On Fri, 2011-11-18 at 10:25 +0100, René Mayer wrote: > Dear all, > How can I run a constrained correspondence analysis with > the following data: > 15 animals were measured repeatedly month-wise (over to 2 years) > according to ther diet composition (8 food categories). > > our data.frame looks

Re: [R] xtable and sweave: caption placement problem

2011-11-18 Thread Charles Roosen
Dear Renger, This is occurring because "xtable" divides up the arguments into items related to the "content" of the table and arguments related to the "layout" of the table. The "caption.placement" is an argument to "print.xtable()" rather than to "xtable()": print(xtable(summary(lm(y~x)),

  1   2   >