Re: [R] problem in installing reshape2 (urgent)

2013-02-02 Thread Jeff Newmiller
Suggestion: follow instructions appropriate for your OS (see CRAN) to install the current version of R. (2.15.2) --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. #

[R] problem in installing reshape2 (urgent)

2013-02-02 Thread Partha Saha
Dear R users, In order to install reshape2 package, I gave the following command: install.packages("reshape2",dep=TRUE) However, it is not getting installed. The message that I am getting is: Warning: dependencies ‘plyr’, ‘stringr’, ‘testthat’ are not available trying URL ' http://ftp.ctex.org

Re: [R] Question: write an R script with help information available to the user

2013-02-02 Thread Bert Gunter
A related approach which, if memory serves, was originally in S eons ago, is to define a "doc" attribute of any function (or object, for that matter) that you wish to document that contains text for documentation and a doc() function of the form: doc <- function(obj) cat(attr(obj,"doc")) used a

Re: [R] Split xts data set into weeks

2013-02-02 Thread Jeff Newmiller
Your example of the problem is not reproducible [1]. This behavior could arise due to small discrepancies in the index values, or from specifying "frequency" instead of "f" as the second argument, our perhaps you have found a bug that only your data triggers. Any verification of what your proble

Re: [R] Question: write an R script with help information available to the user

2013-02-02 Thread Gabor Grothendieck
On Sat, Feb 2, 2013 at 6:31 PM, Chee Chen wrote: > Dear All, > > I would like to ask a question on how to incorporate into an R script help > information for the user. I vaguely recall that I saw some instructions on an > R manual, but am not able to figure them out. Hereunder is the basic setti

Re: [R] Question: write an R script with help information available to the user

2013-02-02 Thread Jeff Newmiller
The normal expectations of an R user is that useful functions you want to share are in packages, which include help files. There is no way to both avoid the package development process and offer help to the user within R. Read the Writing R Extensions document for the most up-to-date information

[R] Question: write an R script with help information available to the user

2013-02-02 Thread Chee Chen
Dear All, I would like to ask a question on how to incorporate into an R script help information for the user. I vaguely recall that I saw some instructions on an R manual, but am not able to figure them out. Hereunder is the basic setting: 1. I finished writing an R script, my_script.r, that

[R] Split xts data set into weeks

2013-02-02 Thread Seimizu Joukan
Hi I am trying to use split() to split a xts data set into weeks, but the result seems not right. original data is as following: > head(xec) Open HighLow Close mean 2011-02-28 112.34 113.34 111.96 112.87 112.6275 2011-03-01 112.89 113.71 112.75 112.80 113.0375 2011-03-02 1

Re: [R] Nested loop and output help

2013-02-02 Thread staysafe23
Dear R help moderator, My name is Thomas and I am new here. I am wondering if my post violated some of the rules of posting here. If so can you please let me know what I have done so that I can repost? I reread the posting guidelines and don't see anything that I violate. I have been reading a gre

[R] Fortan to R

2013-02-02 Thread eliza botto
Dear UseRs, How can i connect my FTN95 fortran compiler with R in window 7?Thanks in Advance, Elisa [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/list

Re: [R] Filter according to the latest data

2013-02-02 Thread Gabor Grothendieck
On Fri, Feb 1, 2013 at 8:05 AM, nalluri pratap wrote: > library(sqldf) > > sqldf("select * > from k1 > group by No > having max(Date)") > HAVING is only used to select groups and only works by chance in this example but if the data were to change then it would likely not work. Try this instead.

Re: [R] vectorisation

2013-02-02 Thread Rui Barradas
Hello, Try the following. set.seed(4315) ml <- data.frame(matrix(sample(1:50,80, replace=TRUE),20,4)) mm <- apply(ml, 2, cumsum) s2 <- starts <- data.frame(matrix(0,600,4)) for (i in 1:4){ starts[,i][mm[,i]] <- 1 } s2[] <- lapply(seq_len(ncol(mm)), function(i) {s2[,i][mm[,i]] <- 1; s2[

Re: [R] vectorisation

2013-02-02 Thread arun
Hi, Not sure this helps: ml <- data.frame(matrix(sample(1:50,80, replace=TRUE),20,4)) mm <- apply(ml, 2, cumsum) starts<- data.frame(matrix(0,600,4)) starts1<- data.frame(matrix(0,600,4)) for (i in 1:4){ starts1[,i][mm[,i]] <-1 } starts2<-as.data.frame(do.call(cbind,lapply(1:4,function(i) {star

Re: [R] Why replacement has length zero? And How can I fix it?

2013-02-02 Thread Dennis Murphy
Hi: No offense, but this is code is inefficient on several levels. Firstly, a loop is unnecessary (see below); secondly, ifelse() is a vectorized function and you're attempting to apply it to each row of DataSet. Try this instead, given dput(DataSet) structure(list(Age = c(-0.552450789929175, -

Re: [R] create and save a simulated dataset

2013-02-02 Thread Rui Barradas
Hello, Once you formulate the problem properly, it's not hard to solve it in R. Bert's questions should be answered before continuing. I'll make two assumptions, not present in your post. All diameters are assumed independent and to follow the same uniform distribution. (iid scenario; the two

Re: [R] create and save a simulated dataset

2013-02-02 Thread Bert Gunter
Is this a homework problem? (We don't do homework here). What is missing from your query is any specification of what you mean by "random," which, by itself, is meaningless. It also might be the case that the trees within each stand are correlated in some way -- perhaps they should to be more simi

Re: [R] Why replacement has length zero? And How can I fix it?

2013-02-02 Thread soon yi
Hi for the loop section runif needs curved brackets Try IAP <-NA for (i in 1:Sample.Size){ if (DataSet$SES[i]>0) { IAP[i] <- ifelse(runif(1)>0.75, 1, 0) # High SES, higher chance to be in Treatment # } else { IAP[i] <- if

Re: [R] Reading .rdata files

2013-02-02 Thread Duncan Murdoch
On 13-02-02 2:23 PM, Andrew DeCarlo wrote: Hello, I am a developer working on extracting information from .rdata files using java. I have been looking through the documentation a lot trying to figure out how to read these files, but am a bit stuck at the moment. I have generated two .RDATA file

[R] create and save a simulated dataset

2013-02-02 Thread Giovanna Ottaviani
Hello, I am trying to learn how to create a simulated dataset of a forest stand: I must simulate 10 stands, for each of the stands I have been creating a random number of trees. For each tree I should create a random diameter. The problem I have is that I cannot use a matrix because the length of

Re: [R] Change default order of colors & line types

2013-02-02 Thread Harris Butler
You can change colors by manually creating your own palette. You can start with the Set1 color palette from RColorBrewer, then move the values. You then use this new palette in your plot: library(RColorBrewer) numGroups <-5 #here is where you define the size of your color palette customPalette

[R] VAR simulation help

2013-02-02 Thread londonphd
Hi Everyone, I am a new comer to R circle. I am trying to simulate a VAR estimation. The problem is given above in the image. Assume that the errors are iid and normally distributed. Here the number of observations x1=x2=64. I've writ

Re: [R] Choice of text for intermediate level R programming course

2013-02-02 Thread Harris Butler
I recommend The Art of R Programming: A Tour of Statistical Software Design, by Norman Matloff, No Starch Press. It is only 40 bucks so your students will appreciate that. As far as content goes, it covers just about everything, you can view a sample chapter, detailed ToC, and index at the websit

[R] Reading .rdata files

2013-02-02 Thread Andrew DeCarlo
Hello, I am a developer working on extracting information from .rdata files using java. I have been looking through the documentation a lot trying to figure out how to read these files, but am a bit stuck at the moment. I have generated two .RDATA files from StatTransfer and have noticed that the

[R] vectorisation

2013-02-02 Thread Brett Robinson
Hi I'm trying to set up a simulation problem without resorting to (m)any loops. I want to set entries in a data frame of zeros ('starts' in the code below) to 1 at certain points and the points have been randomly generated and stored in a separate data.frame ('sl'), which has the same number of

Re: [R] Loading a list into the environment

2013-02-02 Thread Jonathan Greenberg
Thanks all! list2env was exactly what I was looking for. As an FYI (and please correct me if I'm wrong), if you want to load a list into the current environment, use: myvariables <- list(a=1:10,b=20) loadenv <- list2env(myvariables ,envir=environment()) a b --j On Fri, Feb 1, 2013 at 5:49 PM,

Re: [R] use name (not values!) of a dataframe inside a funktion

2013-02-02 Thread William Dunlap
Another R-ish way of modifying an object with a function is to use 'replacement functions' (there must be other names, I'm not sure what the standard is) that let you use syntax like someProperty(myData, ...) <- newProperty To do this define a function called `someProperty<-` whose last argume

Re: [R] Mixed Models: Contribution of random variable to final estimate

2013-02-02 Thread Ben Bolker
Luis Reino isa.utl.pt> writes: > > Dear all, > We want to test if the invasiveStatus is predicted by the amount > (quant) of animals arriving to a country of a certain species > (taxonid). We are using lmer to perform the model. In general lmer questions belong on r-sig-mixed-mod...@r-proje

Re: [R] Armadillo error in R extension

2013-02-02 Thread Simon Zehnder
Dear Michael, during the last days of programming I came across RcppArmadillo (Rcpp) and for my kind of work this is indeed pretty interesting. So, I will take a closer look today what it is about and how it works. As a C++ programmer though, I am still interested why compilation of my package

[R] Mixed Models: Contribution of random variable to final estimate

2013-02-02 Thread Luis Reino
Dear all, We want to test if the invasiveStatus is predicted by the amount (quant) of animals arriving to a country of a certain species (taxonid). We are using lmer to perform the model. The model is: lmer(invasiveStatus~I(log(quant+1))+I(log(inDegree+1))+(1|taxonid)+(1|country), family=binom

Re: [R] Question on "plotCI" function

2013-02-02 Thread Jim Lemon
On 02/02/2013 02:21 AM, li li wrote: Thanks so much for the reply, Ista. I used "plotrix" library. Here is my example: xx<- seq(0.05, 0.95, by=0.05) lower<- c(-2.896865, -2.728416, -2.642574, -2.587724, -2.548672, -2.518994, -2.495409, -2.476031, -2.459662, -2.445513, -2.433014, -2.421739, -2.4

Re: [R] order function

2013-02-02 Thread nalluri pratap
I agree with Duncan.   may be you need this   format(output[order(output[,3]),],scientific=T)   Pratap --- On Sat, 2/2/13, Duncan Murdoch wrote: From: Duncan Murdoch Subject: Re: [R] order function To: "Kripa R" Cc: r-help@r-project.org Date: Saturday, 2 February, 2013, 4:19 AM On 13-02-01