Re: [R] Adding a year to existing date

2011-11-17 Thread Petr PIKAL
Hi > > On 17/11/11 17:33, arunkumar wrote: > > Hi > > > > I need to add an year to and date field in the dataframe. > > > > Please help me > > > > X Date > > 1 2008-01-01 > > 2 2008-02-01 > > 3 2003-03-01 > > I can't find anything built in. This is probably because "year" is an > ill-def

[R] Fisher Exact Test

2011-11-17 Thread Abraham Mathew
This mean First, I am no expert but I am analyzing some marketing data. 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 Fill

Re: [R] building biOps on macports, and configure--vars

2011-11-17 Thread Prof Brian Ripley
Please don't ask non-R programming questions on R-help. This is best asked on R-sig-mac, including details of how you built your R. But the short answer is not to mix macports with the CRAN build of R. And there are matching libs for CRAN's build at http://r.research.att.com/libs/ On Thu, 1

Re: [R] Spatial Statistics using R

2011-11-17 Thread vioravis
Thanks a lot for the guidance. I will take a look at these options. Ravi -- View this message in context: http://r.789695.n4.nabble.com/Spatial-Statistics-using-R-tp4079092p4082354.html Sent from the R help mailing list archive at Nabble.com. __ R-hel

[R] help

2011-11-17 Thread Somaye Node
hello mr martin i need the program of lower incomplet Gamma function, and i dont know any thing about mathematica, my gamma function is Y(1/2,r^2/4*teta), r is variable. pleasr help me, its emmidiate for me. all the best somaye node [[alternative HTML version deleted]] _

[R] Predicting response from new curves using fda package

2011-11-17 Thread rubbish
Basically all I want to do is predict a scalar response using some curves. I've got as far as doing a regression (using fRegress from the fda package) but have no idea how to apply the results to a NEW set of curves (for prediction). I have N=536 curves, and 536 scalar responses. Here's what I'

[R] tuning random forest. An unexpected result

2011-11-17 Thread gianni lavaredo
Dear Researches, I am using RF (in regression way) for analize several metrics extract from image. I am tuning RF setting a loop using different range of mtry, tree and nodesize using the lower value of MSE-OOB mtry from 1 to 5 nodesize from1 to 10 tree from 1 to 500 using this paper as refery

[R] extract positions from matrix

2011-11-17 Thread .Jpg
Hi everyone, I tried to solve this problem but I could not find the solution. I have about 105 matrices of equal size in the memory of**R, I need to do is extract from these matrices some known positions and create a new matrix with these columns. Show you an example with only three matrices (b

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

2011-11-17 Thread Katrina Bennett
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. Here is the function: asym <- 84.951 xmid <- 66.90742 sca

[R] Delete Rows Dynamically Within a Loop

2011-11-17 Thread ftonini
Ok guys, as requested, I will add more info so that you understand why a simple vector operation is not possible. It's not easy to explain in few words but let's see. I have a huge amount of points over a 2D space. I divide my space in a grid with a given resolution,say, 100m. The main loop that I

[R] building biOps on macports, and configure--vars

2011-11-17 Thread Timothy Teravainen
All, the MacOSX binary build of the biOps package is broken on cran, so I am trying to compile from source. I am very close; the trick is apparently that this package depends on fftw3, libjpeg and libtiff. My fftw3 is in /usr/local/, but my libjpeg and libtiff are in /opt/local/ since i got th

[R] Need Help

2011-11-17 Thread dilshan benaragama
Hi, I need to make a subset of my species abundance matrix with only species (columns) that have a total abundance(column sum) greater than 0.5 to do ordination in vegan package. I used following code but it is not working. Can you please give me a solution.   gl1<- subset(grassland[,5:44], colS

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

2011-11-17 Thread Ashim Kapoor
Dear Dennis, Many thanks.I was wondering if there was a way to edit the variable and put \n's in it. Is there ? Thank you, Ashim On Thu, Nov 17, 2011 at 4:07 PM, Dennis Murphy wrote: > Hi: > > This worked for me - I needed to modify some of the strip labels to > improve the appearance a bit an

[R] calculating symmetric matrix

2011-11-17 Thread Sachinthaka Abeywardana
Hi All, I need to a calculation W%*%d. However I know that this matrix is symmetric (since W=t(d)%*%w). My question is considering that I only need to calculate the lower/ upper triangle (n(n+1)/2 elements) rather than the n^2 elements of the entire matrix. Is there a way to do this efficiently.

Re: [R] merging corpora and metadata

2011-11-17 Thread Henri-Paul Indiogine
Hi Joshua! 2011/11/17 Joshua Wiley : > One possibility (though it does not concatenate per se): > > combined <- list(corpus.1, corpus.2) Thanks I will look into it. > *if* (there are only attributes in corpus.1 OR corpus.2) OR (the > attribute names in corpus.1 and corpus.2 are unique), then yo

[R] Drawing ticks in the 3rd and 4th row of a lattice

2011-11-17 Thread Ashim Kapoor
Dear all, I want to draw ticks on the 3rd and 4th row of a lattice. How do I do this ? In my search of the help, I discovered a parameter alternating,which kind of says where the ticks will be but does not suffice for me. I am running this command : - barchart(X03/1000~time|Company, dat

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

2011-11-17 Thread cgenolin
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 get of "A" or "B" (the constante 'SLOT_OF_A

Re: [R] Log-transform and specifying Gamma

2011-11-17 Thread Ben Bolker
Peter Minting hotmail.com> writes: > > > Dear R help, > I am trying to work out if I am justified in > log-transforming data and specifying Gamma in the same glm. > Does it have to be one or the other? No, but I've never seen it done. > I have attached an R script and the datafile to show w

Re: [R] calling self written R functions

2011-11-17 Thread Sachinthaka Abeywardana
Looks like the function I was looking for was source(), but thanks Joshua I certainly do need to make a package once I finish this set of re-coding into R from Matlab. Fingers crossed the effort is worth it. Thanks, Sachin On Fri, Nov 18, 2011 at 1:34 PM, Sarah Goslee wrote: > ?source > > source

Re: [R] Pairwise correlation

2011-11-17 Thread R. Michael Weylandt
Here's a function Josh Wiley provided in another thread: spec.cor <- function(dat, r, ...) { x <- cor(dat, ...) x[upper.tri(x, TRUE)] <- NA i <- which(abs(x) >= r, arr.ind = TRUE) data.frame(matrix(colnames(x)[as.vector(i)], ncol = 2), value = x[i]) } Michael On Thu, Nov 17, 2011

Re: [R] calling self written R functions

2011-11-17 Thread Sarah Goslee
?source source("/path/to/foo.R") will load it into R. Sarah On Thu, Nov 17, 2011 at 8:26 PM, Sachinthaka Abeywardana wrote: > Hi All, > > I have written a function (say) called foo, saved in a file called > foo.R. Just going by Matlab syntax I usually just change my folder path and > therefore

Re: [R] merging corpora and metadata

2011-11-17 Thread R. Michael Weylandt
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(..., recursive = FALSE) {ans = c.default(...); attributes(ans) <- c(do.call(attributes, ...))} Bu

Re: [R] calling self written R functions

2011-11-17 Thread Joshua Wiley
Hi Sachin, Nope, R does not work that way. You do have several options, though. For a function or two, consider creating/editing a workspace .Rprofile file. https://www.google.com/?q=Rprofile should bring up a fair number of pages describing this, you might look at a few. If you find yourself

Re: [R] merging corpora and metadata

2011-11-17 Thread Joshua Wiley
Hi Michael, require(sos) findFn("{meta}", sortby = "Function") ## see that only two functions have the exact name, 'meta' ## one is titled, "Meta Data Management" in the package 'tm' ## seems a pretty likely choice Also, the fact that it is a truly terrible idea does not mean it is not easy: mvi

[R] calling self written R functions

2011-11-17 Thread Sachinthaka Abeywardana
Hi All, I have written a function (say) called foo, saved in a file called foo.R. Just going by Matlab syntax I usually just change my folder path and therefore can call it at will. When it comes to R, how is the usual way of calling/loading it? because R doesnt seem to automatically find the fun

Re: [R] merging corpora and metadata

2011-11-17 Thread R. Michael Weylandt
What package is all this from()? You might check if there is a special rbind/cbind method provided. I don't think you can easily change the behavior of c() Michael On Nov 17, 2011, at 4:43 PM, Henri-Paul Indiogine wrote: > Greetings! > > I loose all my metadata after concatenating corpora.

Re: [R] merging corpora and metadata

2011-11-17 Thread Joshua Wiley
Hi Henri-Paul, This can be rather tricky. It would really help if you could give us a reproducible example. In this case, because you are dealing with non standard data structures (or at least added attributes), the data exactly as R "sees" it. This means either A) code to create some data that

Re: [R] return only pairwise correlations greater than given value

2011-11-17 Thread B77S
Excellent; thanks Josh. Joshua Wiley-2 wrote: > > Hi Brad, > > You do not really need to reshape the correlation matrix. This seems > to do what you want: > > spec.cor <- function(dat, r, ...) { > x <- cor(dat, ...) > x[upper.tri(x, TRUE)] <- NA > i <- which(abs(x) >= r, arr.ind = TRUE)

Re: [R] Combining data

2011-11-17 Thread David Winsemius
On Nov 17, 2011, at 10:37 AM, Nasrin Pak wrote: Hi all; It seemed to be easy at first, but I didn't manage to find the answer through the google search. I have a set of data for every second of the experiment, but I don't need such a high resolution for my analysis. I want to replace every

Re: [R] return only pairwise correlations greater than given value

2011-11-17 Thread Joshua Wiley
Hi Brad, You do not really need to reshape the correlation matrix. This seems to do what you want: spec.cor <- function(dat, r, ...) { x <- cor(dat, ...) x[upper.tri(x, TRUE)] <- NA i <- which(abs(x) >= r, arr.ind = TRUE) data.frame(matrix(colnames(x)[as.vector(i)], ncol = 2), value = x[

Re: [R] return only pairwise correlations greater than given value

2011-11-17 Thread B77S
This is probably not the prettiest or most efficient function ever, but this seems to do what I wanted. spec.cor <- function(dat, r, ...){ require("reshape") d1 <- data.frame(cor(dat)) d2 <- melt(d1) d2[,3] <- rep(rownames(d1), nrow(d2)/length(uni

Re: [R] Vectorizing for weighted distance

2011-11-17 Thread R. Michael Weylandt
I'm starting to get a clearer idea of what you mean: there are two (possibly three) routes you can go: 1) If your matrices are sparse (mostly zero) there's some specialized work on multiplying them quickly 2) You can look at the RcppArmadillo package which interfaces to a very high quality linear

Re: [R] Vectorizing for weighted distance

2011-11-17 Thread Sachinthaka Abeywardana
Hi Michael, Thanks for that. The X1 and X2 are vectors are typically 1000 by 3 matrices, and hoping to scale up to much larger dimensions (say 20,000 by 3). I do appreciate your help and seems like this is the best way to do this, I was just wondering if I could squeeze out just a bit more perfor

Re: [R] Spatial Statistics using R

2011-11-17 Thread David L Carlson
These might get you started Analysing spatial point patterns in R by Adrian Baddeley CSIRO and University of Western Australia http://www.csiro.au/files/files/p10ib.pdf Spatial Regression Analysis in R: A Workbook, by Luc Anselin Spatial Analysis Laboratory http://geodacenter.asu.edu/system/files

Re: [R] Vectorizing for weighted distance

2011-11-17 Thread R. Michael Weylandt
I fail to see why you would need another idea: you asked how to multiply matrices efficiently, I told you how to multiply matrices efficiently. if you want to calculate X1-X2 times W times X1-X2, then simply do so: X1 <- matrix(1:6, 3) X2 <- matrix(7:12, 3) W = matrix(runif(9), 3) t(X1-X2) %*% W

[R] merging corpora and metadata

2011-11-17 Thread Henri-Paul Indiogine
Greetings! I loose all my metadata after concatenating corpora. This is an example of what happens: > meta(corpus.1) MetaID cid fid selfirst selend fname 1 0 1 11 2169 2518WCPD-2001-01-29-Pg217.scrb 2 0 1 14 9189 9702 WCPD-2003-01-1

Re: [R] Vectorizing for weighted distance

2011-11-17 Thread Sachinthaka Abeywardana
I'm not quite sure of what you mean by not worry if it's 1d R matrices. X1 and X2 are both n by d matrices and W is d by d. Thanks for the help though. Any other ideas? Thanks Sachin On Friday, November 18, 2011, R. Michael Weylandt < michael.weyla...@gmail.com> wrote: > The fastest is probably

Re: [R] Combining data

2011-11-17 Thread Bert Gunter
Well, for " What is the command for combining certain number of data into their average value?" one way would be (calling the data vector, x)" colMeans(matrix ( x[ seq_len(30 * floor(length(x)/30))], nrow=30)) Note that this will leave out the mean of any values with indices beyond the largest

Re: [R] Combining data

2011-11-17 Thread MacQueen, Don
There is no single command to do all of what you want. Read the posting guide for advice on how to ask questions that are more likely to receive helpful answers. The mean() function is a command for "combining certain number of data into their average value". The write.csv() function will creat

Re: [R] how to include a factor or class Variable

2011-11-17 Thread Bert Gunter
Please post this to r-sig-mixed-models instead. Or, better yet, consult your local statistician, as your question indicates a profound lack of understanding that may require more back and forth discussion than can occur on an internet help site. -- Bert On Thu, Nov 17, 2011 at 5:36 AM, arunkumar1

Re: [R] function sum for array

2011-11-17 Thread R. Michael Weylandt
It might not be as general as you have in mind, but this works: X = array(1:24, c(2,3,4)) rowSums(X, dims = 2) Combined with aperm() it's pretty powerful. Michael On Thu, Nov 17, 2011 at 11:24 AM, Simone Salvadei wrote: > I'm looking for a function that allows to sum the elements of an array

Re: [R] Pairwise correlation

2011-11-17 Thread R. Michael Weylandt
I can't see how it's stored like that and the email servers garble it up. Use dput() to create a plain text representation and paste that back in. Thanks, Michael On Thu, Nov 17, 2011 at 9:37 AM, muzz56 wrote: > Hi Michael, > Here is a sample of the data. > >  Gene Array1 Array2 Array3 Array4 Ar

Re: [R] set random numbers seed for different cpu's

2011-11-17 Thread R. Michael Weylandt
Sorry -- that came off as very muddled. What I meant to say: To make it (almost) certain you will get different results on each machine, you can reset the PRNG seed on each machine in some way unique to that machine. What immediately came to mind was IP address, which you can access with somethin

Re: [R] set random numbers seed for different cpu's

2011-11-17 Thread R. Michael Weylandt
http://search.dilbert.com/comic/Random%20Number%20Generator In all seriousness, you could set the seed differently on each machine after putting jobs through Torque (i.e., as part of the batch script, maybe using some piece of hardware id you can get through system() somehow or other: possibly net

Re: [R] White lines on persp plots in pdf format

2011-11-17 Thread Marc Schwartz
On Nov 17, 2011, at 10:13 AM, Miguel Lacerda wrote: > Hi, > > I am using the persp function to plot 3D surfaces, but the plots have > "little white lines" when I print them to a pdf file (visible in > Acrobat, Foxit, Evince, Xpdf and Gimp). This does not happen when I > create png or tiff images.

Re: [R] Difference between two time series

2011-11-17 Thread Sarwarul Chy
Hello Michael, Thanks again for your reply. Actually, I am working with wind data. I have some sample data for actual load. scan("/home/sam/Desktop/tt.dat") ->tt ## This is the input for the actual output of the generation t = ts(tt, start=8, end=24, frequency=1,) I have another random sequen

[R] R help

2011-11-17 Thread Arango, Ana
Hello: I have some trouble making a prediction from an AR(p) model. After I have the AR(p) model fitted , I want to use a new data set to make predictions. But I get the error: Error in newdata - object$x.mean : non-numeric argument to binary operator. A small version of my original data lo

[R] Time Series w/ Unequal Time Steps

2011-11-17 Thread kthomp271828
Hi. I am new to R and actually have several questions related to this topic. A row in my data looks like the following: 418 12 6/21/2010 9:37:12 40.7219593 -73.9962579 1.3406345525960568 0.019682641058810173 In order, the columns are id, week, date, time, latitude, long

Re: [R] hierarchical clustering within a size limit

2011-11-17 Thread petaltail
You can print out the nodes and their corresponding clusters into a file by this: > write.table (hc,file="hc_40clusters.cvs", quote=FALSE, sep=" ") -- View this message in context: http://r.789695.n4.nabble.com/hierarchical-clustering-within-a-size-limit-tp3515354p4080551.html Sent from the R

[R] function sum for array

2011-11-17 Thread Simone Salvadei
I'm looking for a function that allows to sum the elements of an array along a dimension that can be different from the classical ones (rows or columns). Let's suppose for example that: - A is an array with dimensions 2 x 3 x 4 - I want to compute B, a 2 x 3 matrix with elements equal to the sum

[R] lme contrast Error in `$<-.data.frame`(`*tmp*`, "df", value = numeric(0)) :

2011-11-17 Thread Tanu Soni
I am trying to run a lme model and some contrast for a matrix . lnY [1] 10.911628 11.198557 11.316971 11.464869 11.575233 11.612101 11.755903 11.722035 11.757705 11.863744 11.846515 11.852721 11.866936 11.838452 11.946680 11.885509 [17] 11.583309 11.750082 11.756005 11.630797 11.705536 11.566722 1

[R] Combining data

2011-11-17 Thread Nasrin Pak
Hi all; It seemed to be easy at first, but I didn't manage to find the answer through the google search. I have a set of data for every second of the experiment, but I don't need such a high resolution for my analysis. I want to replace every 30 row of my data with their average value. And then sa

Re: [R] Pairwise correlation

2011-11-17 Thread muzz56
Hi Michael, Here is a sample of the data. Gene Array1 Array2 Array3 Array4 Array5 Array6 Array7 Array8 Array9 Array10 Array11 Fth1 26016.01 23134.66 17445.71 39856.04 27245.45 23622.98 37887.75 49857.46 25864.73 21852.51 29198.4 B2m 7573.64 7768.52 6608.24 8571.65 6380.78 6242.76 6903.92 7330.6

[R] Log-transform and specifying Gamma

2011-11-17 Thread Peter Minting
Dear R help, I am trying to work out if I am justified in log-transforming data and specifying Gamma in the same glm. Does it have to be one or the other? I have attached an R script and the datafile to show what I mean. Also, I cannot find a mixed-model that allows Gamma errors (so I cannot find

[R] set random numbers seed for different cpu's

2011-11-17 Thread fantomas
Hi I'm running the same R script (throuth linux shell) of several cpu's. This R program uses random numbers and the result should be different every time. But if put jobs (through Torque) for several cpu's I get the same result. As a resealt my program saves numbers in file with randomly generate

[R] how to include a factor or class Variable

2011-11-17 Thread arunkumar1111
Hi How to include a factor or class variable to a fixed effect of lmer function. when i included it throws an error. Please help My code data <- read.delim("C:/TestData/data.txt") Mon=as.factor(data$Month) lmerform= "Y~ X2 +X3 + Month:Mon + (1|State)+ (1+ X5|State)" lmerfit=lmer(formula=l

Re: [R] hierachical code system

2011-11-17 Thread Albert-Jan Roskam
Hi,   Thanks for your reply. Based on your suggestions, I managed to simplify the code, but only a little. I don't see how I could do without a loop, given the nestedness of the hierachy. See the code below, which is working, but I'd like to simplify it.   # sample data theCodes <- c('STAT.01',

Re: [R] How to Fit Inflated Negative Binomial

2011-11-17 Thread Ben Bolker
Tyler Rinker hotmail.com> writes: > > > try: library(pscl) > > There's a zeroinfl for zero inflated neg. binom. > > Tyler > > > > Dear All, > > I am trying to fit some data both as a negative binomial and a zero > > inflated binomial. > > For the first case, I have no particular problems,

Re: [R] Non-finite finite-difference value" error in eha's, aftreg

2011-11-17 Thread John C Nash
This kind of error seems to surprise R users. It surprises me that it doesn't happen much more frequently. The "BFGS" method of optim() from the 1990 Pascal version of my book was called the Variable Metric method as per Fletcher's 1970 paper it was drawn from. It really works much better with

Re: [R] Help with "error: no acceptable C compiler found in $PATH"

2011-11-17 Thread R. Michael Weylandt
Hstrangeif possible, this might be solvable by simply updating to the release version R 2.14. If it's at all possible, I'd start there. Can you find the object it's unhappy about? On my machine, I do the following 1) Open Finder 2) Macintosh HD -> Library -> Frameworks -> R.framework

Re: [R] modelling and R misconceptions; was: package installtion

2011-11-17 Thread Scott Raynaud
My responses are in brackets below, plus a final note after the main text. - Original Message - From: Uwe Ligges To: Scott Raynaud Cc: "r-help@r-project.org" Sent: Thursday, November 17, 2011 9:16 AM Subject: Re: [R] modelling and R misconceptions; was: package installtion This is hope

Re: [R] package installtion

2011-11-17 Thread Scott Raynaud
See my responses in brackets below.   - Original Message - From: Rolf Turner To: Scott Raynaud Cc: "r-help@r-project.org" Sent: Wednesday, November 16, 2011 6:04 PM Subject: Re: [R] package installtion On 17/11/11 05:37, Scott Raynaud wrote: > That might be an option if it weren't my m

Re: [R] changelog for MASS?

2011-11-17 Thread Liviu Andronic
On Thu, Nov 17, 2011 at 7:33 AM, R. Michael Weylandt wrote: > Hmmm...sorry -- the only thing I can suggest is maybe striking some > sort of deal that you change when it gets however many months out of > date:  if you look here > (http://cran.r-project.org/src/contrib/Archive/MASS/), you can see th

Re: [R] read.table with double precision

2011-11-17 Thread Sarah Goslee
Hi, On Thu, Nov 17, 2011 at 11:49 AM, Alaios wrote: > Dear all I have a txt file with the following contents > 1 50.790643000 6.063498 > 2 50.790738000 6.063471 > 3 50.791081000 6.063380 > 4 50.791189000 6.063552 > > > I am usind read.table('myfile.

Re: [R] read.table with double precision

2011-11-17 Thread R. Michael Weylandt
I'm having trouble replicating/understanding why that would happen since I do it all the time. The only thing that raises a hint of suspicion is using the blank space separator , but I'm pretty sure that's fine What does str() give? Possibly factors? If you are sure that's happening as describ

Re: [R] Adding a year to existing date

2011-11-17 Thread Keith Jewell
Just looking at the ambiguity in "adding a year" > dates <- as.Date(c('2007-03-01','2008-02-29')) > tmp <- as.POSIXlt(dates) > tmp$year <- tmp$year+1 > dates2 <- as.Date(tmp) > dates2 [1] "2008-03-01" "2009-03-01" > dates2 - dates Time differences in days [1] 366 366 KJ "MacQueen, Don" wrote in

[R] read.table with double precision

2011-11-17 Thread Alaios
Dear all I have a txt file with the following contents 1 50.790643000 6.063498 2 50.790738000 6.063471 3 50.791081000 6.063380 4 50.791189000 6.063552 I am usind read.table('myfile.txt',sep=" ") which unfortunately returns only integers and not dou

Re: [R] Adding a year to existing date

2011-11-17 Thread MacQueen, Don
Here is an example that could probably be described as "adding a year": dates <- c('2008-01-01','2009-03-02') tmp <- as.POSIXlt(dates)tmp$year <- tmp$year+1 dates2 <- format(tmp) > dates [1] "2008-01-01" "2009-03-02" > dates2 [1] "2009-01-01" "2010-03-02" ## to begin to understand how it works, g

Re: [R] optim seems to be finding a local minimum

2011-11-17 Thread Dimitri Liakhovitski
One more thing: trying to defend R's honor, I've run optimx instead of optim (after dividing the IV by its max - same as for optim). I did not use L-BFGS-B with lower bounds anymore. Instead, I've used Nelder-Mead (no bounds). First, it was faster: for a loop across 10 different IVs BFGS took 6.14

Re: [R] how to read a freetext line ?

2011-11-17 Thread Sarah Goslee
Hi, Please copy your replies to r-help so others may participate in the discussion. 2011/11/17 Jie TANG : > yes ,I have tried readLines > by > config<- readLines(configfile,ok=TRUE,n=-1) > #but when strsplit is used as below > food<-unlist(strsplit(config[2].":")) > #here "food " is a vector > bu

Re: [R] modelling and R misconceptions; was: package installtion

2011-11-17 Thread Uwe Ligges
This is hopeless, since you never seem to listen to our advice, therefore this will be my very last try: So you actually need local advice, both for statistical concepts and R related. No statistics software can estimate effects of variables that you observed to be constant (e.g. 0) all the ti

Re: [R] how to read the text ?

2011-11-17 Thread R. Michael Weylandt
See Sarah's reply here: http://www.mail-archive.com/r-help@r-project.org/msg152883.html Michael On Thu, Nov 17, 2011 at 7:54 AM, haohao Tsing wrote: > hi,R users: >  I have such a text > > num = 3 > testco = 12 > testno = 1;12;3 > infp = test1;test2;test3 > How can I read this text by readLines?

Re: [R] package installtion

2011-11-17 Thread R. Michael Weylandt
Why are you trying to take the matrix trace of a regression model? (That's the only hit for mtrace on my system at least) Perhaps you mean to use traceback() or, even more useful, options(error = recover) Michael On Thu, Nov 17, 2011 at 9:49 AM, Scott Raynaud wrote: > I believe the problem is a

Re: [R] List of lists to data frame?

2011-11-17 Thread Bert Gunter
I don't know if this is faster, but ... out <- do.call(rbind, lapply(s, function(x)data.frame(x$category,x$name,as.vector(x$series ## You can then name the columns of out via names() Note: No fancy additional packages are required. -- Bert On Wed, Nov 16, 2011 at 6:39 PM, Kevin Burton

[R] package installtion

2011-11-17 Thread Scott Raynaud
I believe the problem is a column of zeroes in my x matrix.  I have tried the suggestions in the documentation, so now to try to confirm the probelm I'd like to run debug.  Here's where I think the problem is: ###~~  Fitting the model using lmer funtion    ~~### (fitmodel <-

Re: [R] how to read a freetext line ?

2011-11-17 Thread Sarah Goslee
Hi, On Thu, Nov 17, 2011 at 9:37 AM, Jie TANG wrote: > hi everyone . >  Here I have a text where there are some integer and string variables.But I > can not read them by readLines and scan I've seen this question several times this morning. If that's you, please do not post multiple times. If yo

[R] how to read a freetext line ?

2011-11-17 Thread Jie TANG
hi everyone . Here I have a text where there are some integer and string variables.But I can not read them by readLines and scan the text is : weight ;30;130 food:2;1;12 color:white;black the first column is the names of the variables and others are the value of them. the column in different l

Re: [R] Pairwise correlation

2011-11-17 Thread R. Michael Weylandt
I think something like this should do it, but I can't test without data: rownames(mydata) <- mydata[,1] # Put the elements in the first column as rownames mydata <- mydata[,-1] # drop the things that are now rownames Michael On Thu, Nov 17, 2011 at 9:23 AM, Musa Hassan wrote: > Hi Michael, > Th

Re: [R] Spatial Statistics using R

2011-11-17 Thread Paul Hiemstra
On 11/17/2011 06:28 AM, vioravis wrote: > I am looking for online courses to learn Spatial Statistics using R. > Statistics.com is offering an online course in December on the same topic > but that schedule doesn't suit mine. Are there any other similar modes for > learning spatial statistics using

Re: [R] Spatial Statistics using R

2011-11-17 Thread jon . skoien
Hi Ravi, You would probably get more answers to this if you posted to the list r-sig-geo. The following course was advertised a week ago and might match your needs: http://www.itc.nl/personal/rossiter/teach/degeostats.html You might also find the videos from this years' GEOSTAT course in Landa

Re: [R] Spatial Statistics using R

2011-11-17 Thread Roger Bivand
vioravis gmail.com> writes: > > Thanks, Raphael. Just checked their website. It appears that they currently > do not have any online courses planned. > You may find that this site: http://geostat-course.org/ has a wider range of possible courses.

[R] R2 for a mixed-effects model with AR(1) error structure

2011-11-17 Thread FMH
Dear All, The following equation is a linear mixed-effects  model with linear trend and AR(1) error structure, y = B0 + B1x + bo + b1x + e; e~AR(1)  where  y is a response, x is the predictor, B0 and B1 are fixed effects and b0 and b1 are random effects. Coud someone please advice me a fun

Re: [R] Pairwise correlation

2011-11-17 Thread R. Michael Weylandt
On Wed, Nov 16, 2011 at 11:22 PM, muzz56 wrote: > Thanks to everyone who replied to my post, I finally got it to work. I am > however not sure how well it worked since it run so quickly, but seems like > I have a 2000 x 2000 data set. Behold the great and mighty power that is R! Don't worry -- on

Re: [R] RV: Reporting a conflict between ADMB and Rtools on Windows systems

2011-11-17 Thread Rubén Roa
Thanks Gabor and Jan. The batch files solution seems the way to go. Will implement it! Rubén -Mensaje original- De: Gabor Grothendieck [mailto:ggrothendi...@gmail.com] Enviado el: jueves, 17 de noviembre de 2011 13:58 Para: Rubén Roa CC: r-help@r-project.org Asunto: Re: [R] RV: Reporting

Re: [R] Exclude NA while summing

2011-11-17 Thread R. Michael Weylandt
Or, for this specific application rowSums(XXX, na.rm = TRUE) Michael On Thu, Nov 17, 2011 at 5:51 AM, Jim Holtman wrote: > change to > >> row.sums.m <- apply(dummy.curr.res.m,1,sum, na.rm = TRUE) > > Sent from my iPad > > On Nov 17, 2011, at 5:18, Vikram Bahure wrote: > >> Dear R users, >> >>

Re: [R] Vectorizing for weighted distance

2011-11-17 Thread R. Michael Weylandt
The fastest is probably to just implement the matrix calculation directly in R with the %*% operator. (X1-X2) %*% W %*% (X1-X2) You don't need to worry about the transposing if you are passing R vectors X1,X2. If they are 1-d matrices, you might need to. Michael On Thu, Nov 17, 2011 at 1:30 AM,

Re: [R] Spatial Statistics using R

2011-11-17 Thread vioravis
Thanks, Raphael. Just checked their website. It appears that they currently do not have any online courses planned. -- View this message in context: http://r.789695.n4.nabble.com/Spatial-Statistics-using-R-tp4079092p4079574.html Sent from the R help mailing list archive at Nabble.com. _

Re: [R] RV: Reporting a conflict between ADMB and Rtools on Windows systems

2011-11-17 Thread Gabor Grothendieck
On Thu, Nov 17, 2011 at 3:54 AM, Rubén Roa wrote: > > I've just found that there is a conflict between tools used to build R > packages (Rtools) and ADMB due to the need to put Rtools compiler's location > in the PATH environmental variable to make Rtools work. > > On a Windows 7 64bit  with Rto

[R] how to read the text ?

2011-11-17 Thread haohao Tsing
hi,R users: I have such a text num = 3 testco = 12 testno = 1;12;3 infp = test1;test2;test3 How can I read this text by readLines? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/

[R] how to define the bound between parameters in nls()

2011-11-17 Thread Jinsong Zhao
Hi there, I have read the help page of nls(), there is lower or upper for defining the bounds of parameters. For example, nls(y ~ 1-a*exp(-k1*x)-(1-a)*exp(-k2*x), data=data.1, start=list(a=0.02, k1=0.01, k2=0.0004), upper=c(1,1,1), lower=c(0,0,0)) I hope to define k1 > k2, but I don't find

Re: [R] Reading data/variables

2011-11-17 Thread Sarah Goslee
Well, if your problem is that a workspace is being loaded automatically and you don't want that workspace, you have several options: 1. Use a different directory for each project so that the file loaded by default is the correct one. 2. Don't save your workspace, but regenerate it each time. 3.

Re: [R] How to resample one per group

2011-11-17 Thread ONKELINX, Thierry
Something like this? library(plyr) ddply(df, .(group), function(x){ x[sample(nrow(x), 1), ] }) Best regards, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek team Biometrie & Kwaliteitszorg Gaverst

[R] How to resample one per group

2011-11-17 Thread Johannes Radinger
Hello, I have got a dataframe which looks like: y <- c(1,5,6,2,5,10) # response x <- c(2,12,8,1,16,17) # predictor group <- factor(c(1,2,2,3,4,4)) # group df <- data.frame(y,x,group) Now I'd like to resample that dataset. I want to get dataset (row) per group. So per total sample I get 4 rows i

Re: [R] Exclude NA while summing

2011-11-17 Thread Jim Holtman
change to > row.sums.m <- apply(dummy.curr.res.m,1,sum, na.rm = TRUE) Sent from my iPad On Nov 17, 2011, at 5:18, Vikram Bahure wrote: > Dear R users, > > I am new to R and have some query. > > I am having a dataset with binary output 0's and ones. But along with it it > has NA's too. I want

[R] aov how to get the SST?

2011-11-17 Thread Giovanni Azua
Hello, I currently run aov in the following way: > throughput.aov <- > aov(log(Throughput)~No_databases+Partitioning+No_middlewares+Queue_size,data=throughput) > summary(throughput.aov) Df Sum Sq Mean Sq F valuePr(>F) No_databases 1 184.68 184.675 136.6945 < 2.2e-16

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

2011-11-17 Thread Dennis Murphy
Hi: This worked for me - I needed to modify some of the strip labels to improve the appearance a bit and also reduced the strip font size a bit to accommodate the lengths of the strings. The main thing was to change \\n to \n. Firstly, I created a new variable called Indic as a character variable

[R] Exclude NA while summing

2011-11-17 Thread Vikram Bahure
Dear R users, I am new to R and have some query. I am having a dataset with binary output 0's and ones. But along with it it has NA's too. I want to sum all the rows and get the sum total for each column. But whenever there is a NA in an row the sum of the row is returned as NA so I am not able

Re: [R] Spatial Statistics using R

2011-11-17 Thread Raphael Saldanha
Take a look on http://geodacenter.asu.edu/ , Training section. On Thu, Nov 17, 2011 at 4:28 AM, vioravis wrote: > I am looking for online courses to learn Spatial Statistics using R. > Statistics.com is offering an online course in December on the same topic > but that schedule doesn't suit mine

Re: [R] split list of characters in groups of 2

2011-11-17 Thread Uwe Ligges
On 17.11.2011 10:31, Dennis Murphy wrote: Hi: Here's one way: apply(matrix(var.names, ncol = 2, byrow = TRUE), 1, function(x) paste(x[1], x[2], sep = ',')) [1] "a,b" "c,d" "e,f" Or for short and slightly faster for huge data use column-wise operations as in: apply(matrix(var.names, nrow=

Re: [R] Getting unique colours

2011-11-17 Thread Milan Bouchet-Valat
Le mercredi 16 novembre 2011 à 20:02 -0800, Quercus a écrit : > Hey everyone, > > I am new to R, and I'm making a scatter plot graph where i have a bunch of > plots/points that fall into 9 unique categories. I want each category to > have a unique colour, however, with the coding I have (below),

  1   2   >