Re: [R] How to view the source of code?

2013-08-23 Thread Berend Hasselman
On 23-08-2013, at 07:40, Marino David davidmarino...@gmail.com wrote: Hi all R mailing listers: I am using the coda package. I tried to view the source of HPDinterval code by typing fix(HPDinterval), it dispalys as follows: function (obj, prob = 0.95, ...) UseMethod(HPDinterval) Then I

Re: [R] varpart

2013-08-23 Thread Jari Oksanen
Sibylle Stöckli sibylle.stoeckli at gmx.ch writes: I applied vegan's varpart function to partition the effects of explanatory matrices. Adj. R square for the unique fraction [a] is 0.25. Does anyone know why the decomposition by hand using rda gives me a different result for [a]

Re: [R] labcurve - use of putKey function

2013-08-23 Thread Pascal Oettli
Hello, In labcurve, use keys=c(19,5). It is said in examples provided in the help page. You should also modify the following lines: lines(timeseries,dataseries1,col=red,type=l) lines(timeseries,dataseries2,col=blue,type=l) Regards, Pascal 2013/8/23 Igor Ribeiro igor...@gmail.com Dear all,

Re: [R] lattice: bwplot: getting two plots into one.

2013-08-23 Thread Anna Zakrisson Braeunlich
OK, I understand. I should probebly have noticed that. Why can I not control outlier pch=c(...) when using this code? I want all outliers to be circles and the medians only defined by pch 2-4. New dummy data with outliers: mydata- data.frame(factor1 = factor(rep(LETTERS[1:3], each = 21)), #Dummy

Re: [R] Track Starting Row number for Continuos Increment

2013-08-23 Thread arun
HI, May be this works:  row.names(MyDF)[c(0,diff(MyDF[,3]))==0|c(0,diff(MyDF[,3]))1] #[1] 1 5 8 A.K. Hi, Here i have a dataframe called MyDF. a- c(1,1,1,1,1,1,1,0,1,1) b-c(1,1,0,1,1,0,0,0,1,1) c-c(1,2,3,1,1,2,0,5,6,1) d-c(1,1,1,1,1,1,1,1,0,1) MyDF-data.frame(DWATT=a,TNH=b,CSGV=c,BIX=d)

[R] Setting up 3D tensor product interactions in mgcv

2013-08-23 Thread Mark Payne
Hi, I am trying to fit a smoothing model where there are three dimensions over which I can smooth (x,y,z). I expect interactions between some, or all, of these terms, and so I have set up my model as mdl - gam(PA ~ s(x) + s(y) + s(z) + te(x,y) + te(x,z) + te(y,z) + te(x,y,z),...) I have

Re: [R] Problems installing FAME package on Windows 7.

2013-08-23 Thread Andreas Dibiasi
The CRAn binary is the first thing I tried. When using install.packages(fame) require(fame) I get the following output: under R x64: install.packages(fame) Installing package into ‘C:/APPS/R/R-3.0.1/library’ (as ‘lib’ is unspecified) trying URL

Re: [R] Problems installing FAME package on Windows 7.

2013-08-23 Thread Prof Brian Ripley
On 23/08/2013 10:06, Andreas Dibiasi wrote: The CRAn binary is the first thing I tried. When using install.packages(fame) require(fame) I get the following output: under R x64: install.packages(fame) Installing package into ‘C:/APPS/R/R-3.0.1/library’ (as ‘lib’ is unspecified) trying URL

Re: [R] From POSIXct to numeric and back with time zone

2013-08-23 Thread Daniel Haugstvedt
I am replying to my own question in case someone else finds this tread and needs help with the same problem. Thanks to Mark Leeds for helping me on my way. Any errors or flaws are mine since I have rewritten most of his comments to make sure I understood them correctly. First three general

Re: [R] converting a summary table to survey database form

2013-08-23 Thread Pancho Mulongeni
Thank you! -Original Message- From: arun [mailto:smartpink...@yahoo.com] Sent: 22 August 2013 17:17 To: Pancho Mulongeni Cc: R help Subject: Re: [R] converting a summary table to survey database form Hi, May be this helps: dat1- structure(...  dat1$ID- row.names(dat1)

[R] RSM

2013-08-23 Thread Waqas Shafqat
please send me response surface codes of R [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and

[R] Combining two tables without going through lot of ifelse statement

2013-08-23 Thread Anindya Sankar Dey
HI All, Suppose I have two table like below Table 1: 1 10 3 5 0 0 Table 2: 2 10 0 0 3 5 I need to create a new table like below Table 3: 1 10 2 10 3 10 The row may interchange in table 3, but is there any way to do this instead of writing lot of if-else and loops? Thanks in advance.

Re: [R] Combining two tables without going through lot of ifelse statement

2013-08-23 Thread arun
Hi, Try: dat1- read.table(text= 1 10 3  5 0  0 ,sep=,header=FALSE) dat2- read.table(text= 2 10 0  0 3  5 ,sep=,header=FALSE) res-with(rbind(dat1,dat2),aggregate(V2~V1,FUN=sum)) res1-res[res[,1]!=0,]  res1 #  V1 V2 #2  1 10 #3  2 10 #4  3 10 #or library(data.table) dt1-

Re: [R] Combining two tables without going through lot of ifelse statement

2013-08-23 Thread Rui Barradas
Hello, Try the following. x1 - read.table(text = 1 10 3 5 0 0 ) x2 - read.table(text = 2 10 0 0 3 5 ) x3 - merge(x1, x2, by = V1, all = TRUE) res - data.frame(x3[1], sum = rowSums(x3[-1], na.rm = TRUE)) res - res[-(res$sum == 0), ] res Hope this helps, Rui Barradas Em 23-08-2013

Re: [R] Combining two tables without going through lot of ifelse statement

2013-08-23 Thread arun
In the case of ?data.table() dt1-data.table(rbind(as.matrix(dat1),as.matrix(dat2))) ## converted the data.frame to matrix to mimic the situation  dt2- subset(dt1[,sum(V2),by=V1],V1!=0)  setnames(dt2,2,V2)  dt2 #   V1 V2 #1:  1 10 #2:  3 10 #3:  2 10 #or  

Re: [R] Combining two tables without going through lot of ifelse statement

2013-08-23 Thread Anindya Sankar Dey
Hi All, Arun's solution is working. Now can someone help me in just an expansion. If we have multiple table like this, adding them in rbind is working, but if I want a generic function where we do not know how many tables will be created can that also be avoided from using loops. On Fri, Aug

[R] Summation sign

2013-08-23 Thread Sebastian Hersberger
Hi all I have a short question relating to the usage of the summation sign in R. Let's define A and B as two kxk matrices (which are constant). C^(n) = Ó_(j=1)^n [(Ó_(i=1)^(j-1) A^i ) B (Ó_(i=1)^(j-1) A^i)’ ] My goal is to calculate the matrix C for the periods from 1 to 200 (n=1-200). How

[R] (no subject)

2013-08-23 Thread rajib prasad
I am new to R. I have a data like: x y z w p .. m 1 1015 20 25 30 2 11 1621 26 31 3 12 171819 20

[R] Randomization

2013-08-23 Thread Silvano
Hi, I have a set of 80 animals and their respective weights. I would like create 4 groups of 20 animals so that the groups have means and variances with values ??very close. How can I make this randomization in R? Thanks, -- Silvano Cesar da Costa

Re: [R] Randomization

2013-08-23 Thread Charles Determan Jr
Hi Silvano, How about this? id - seq(80) weight - runif(80) # randomize 4 groups with 'sample' function group - sample(rep(seq(4),20)) dat - cbind(id, weight, group) # ordered dataset by group res - data.frame(dat[order(group),]) # get mean and variance for each group aggregate(res$weight,

Re: [R] (no subject)

2013-08-23 Thread Anindya Sankar Dey
You can easily subset the data then use rowSum. say your dataset name is data1. then write data2-data[,c(7,12,45,57)] then write result-rowsum(data2) On Fri, Aug 23, 2013 at 3:47 PM, rajib prasad rwho2...@gmail.com wrote: I am new to R. I have a data like: x

Re: [R] (no subject)

2013-08-23 Thread arun
Hi, May be:  set.seed(24)  dat1- as.data.frame(matrix(sample(1:50,145*160,replace=TRUE),ncol=160)) dat2- dat1 dat1$m-rowSums(dat1[,c(7,12,45,57)]) #or dat2-within(dat2,{m-rowSums(cbind(V7,V12,V45,V57))}) #using column names identical(dat1,dat2) #[1] TRUE A.K. - Original Message -

Re: [R] Combining two tables without going through lot of ifelse statement

2013-08-23 Thread arun
Hi Anindya, If you have multiple tables and it is in a folder, you can use: list.files() #I had three files in the working directory #[1] test1.txt test2.txt test3.txt library(data.table) dt1-rbindlist(lapply(list.files(),function(x) read.table(x,header=FALSE,sep=))) dt1 #   V1 V2 #1:  1 10

Re: [R] lattice: bwplot: getting two plots into one.

2013-08-23 Thread Richard M. Heiberger
Anna, You forget to include font.settings - list( font = 1, cex = 1.3, fontfamily = serif) in this email, so it wasn't immediately reproducible. The panel.bwplot.intermediate.hh function explicitly sets the outlier pch to match the median pch. Your controls did affect the cex of the outliers.

Re: [R] From POSIXct to numeric and back with time zone

2013-08-23 Thread David Winsemius
On Aug 23, 2013, at 3:12 AM, Daniel Haugstvedt wrote: I am replying to my own question in case someone else finds this tread and needs help with the same problem. Thanks to Mark Leeds for helping me on my way. Any errors or flaws are mine since I have rewritten most of his comments to

[R] Add sums across chosen columns. ... was (No Subject)

2013-08-23 Thread David Winsemius
On Aug 23, 2013, at 9:41 AM, Anindya Sankar Dey wrote: You can easily subset the data then use rowSum. say your dataset name is data1. then write data2-data[,c(7,12,45,57)] then write result-rowsum(data2) In R there are two different functions `rowsum` and `rowSums`. The use you are

[R] lags of a variable, with a factor

2013-08-23 Thread Michael Friendly
For sequential analysis of sequences of events, I want to calculate a series of lagged versions of a (numeric or character) variable. The simple function below does this, but I can't see how to generalize this to the case where there is also a factor variable and I want to calculate lags

Re: [R] RSM

2013-08-23 Thread Kevin Wright
You need to: 1. Use this site for searching first: http://www.rseek.org 2. Ask better questions that we can understand. Kevin On Fri, Aug 23, 2013 at 7:52 AM, Waqas Shafqat waqas1...@gmail.com wrote: please send me response surface codes of R [[alternative HTML version deleted]]

[R] Simulated mixed distribution multivariate data

2013-08-23 Thread Charlie Brown
Hi, I want to simulate multivariate data with 1 distribution type. For example, I would like one normal variate and one poisson variate with a specified correlation structure. Is there a package that has this implemented? Thanks. Chuck [[alternative HTML version deleted]]

[R] Unexpected behaviour with seq() and %in%

2013-08-23 Thread Finlay Scott
Hi, During the course of putting together a function I came across some unexpected behaviour when using seq() and %in%. I am creating two numeric vectors using seq(), and then using %in% to find the values in one vector that are in the other. Sometimes all the values are found, but sometimes a

[R] Creating a Plot in R Commander

2013-08-23 Thread Thomas LaBone
There a GUI menu option to do this in R Commander: fit - lm(y ~ x) But is there an option to do this? plot(x,y) lines(x,predict(fit)) Thanks. Tom [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] (no subject)

2013-08-23 Thread PIKAL Petr
Well if I understand correctly you want data.csv$m - rowSums(data.csv[, c(7,12,57,45)]) If you want something else please read Posting Guide and provide at least part of your data and the result you want. In the meantime It would be good for you to read at least R intro document provided with

[R] greek symbols to postscript

2013-08-23 Thread ja ja
I need to print greek symbols IN ITALIC to eps-figures [ideally, using the Century Schoolbook font family]. I've found many ways how to print e.g. mu, but didn't succeed to print sigma, rho or other; even without the italic or font family restriction. An example:

Re: [R] Unexpected behaviour with seq() and %in%

2013-08-23 Thread arun
Hi, Possibly R FAQ 7.31 vec1[180] #[1] 18  vec1[180]-18 #[1] 3.552714e-15 vec1[round(vec1,2)%in%vec2] # [1]  2  4  6  8 10 12 14 16 18 20 A.K. - Original Message - From: Finlay Scott drfinlaysc...@gmail.com To: r-help@r-project.org Cc: Sent: Friday, August 23, 2013 11:00 AM Subject:

Re: [R] From POSIXct to numeric and back with time zone

2013-08-23 Thread Jeff Newmiller
I disagree with the characterization that setting TZ to anything but UTC yields confusing results. If your time strings do not specify a time offset, then TZ will be assumed, and if the assumed time zone accounts for daylight savings and you don't want it to then you might be disappointed in

Re: [R] How to view the source of code?

2013-08-23 Thread Marino David
Thanks a lot. It works 2013/8/23 Berend Hasselman b...@xs4all.nl On 23-08-2013, at 07:40, Marino David davidmarino...@gmail.com wrote: Hi all R mailing listers: I am using the coda package. I tried to view the source of HPDinterval code by typing fix(HPDinterval), it dispalys as

Re: [R] Creating a Plot in R Commander

2013-08-23 Thread John Fox
Dear Tom, The Graphs - Scatterplot dialog includes an option for a least-squares line (which is checked by default). Best, John --- John Fox McMaster University Hamilton, Ontario, Canada -Original Message- From:

[R] Avoiding copies in list assignments

2013-08-23 Thread Peter Langfelder
One more question about avoiding copies when modifying lists. I would like to call a function (call it 'f') that does an operation on a large array according to a given index. For example f = function(data, index) sum(data[index]) The idea is to repeatedly call f() with the same 'data' but

[R] Replace two nested loop with an apply kind of function

2013-08-23 Thread ginan
Dear R users, I am confused with the usage of apply kind of functions instead of nested loops. Let me illustrate my problem, I have an array,named C, with dimesions c(nr,nr,nt*n). I want to fill in a Tmat array according to the rule as given below: Tmat-array(diag(nt*nr), c(nt*nr,nt*nr,n))

[R] hide unused labels and resize panels in lattice barchart

2013-08-23 Thread Noah Hoffman
Hello - I'm stumped on a lattice question. I'll start with my existing code: library(lattice) library(latticeExtra) # no https for read.csv... tab - read.csv(pipe('curl -s https://raw.github.com/gist/6323455')) fig - barchart(assignment ~ freq | label, groups=method,

[R] how to combine apply and which or alternative ways to do so

2013-08-23 Thread Guillaume Bal
Dear useRs, I am currently doing some data cleaning and data manipulation and I have the following problem. I have two vectors. Let say the size of the first one is 10 000 (vector 1) and the size of the second one is 1 000 000 (vector 2). I need to know for each cell of vector 1 which cells of

Re: [R] A couple of questions regarding the survival:::cch function

2013-08-23 Thread Ryung Kim
Above, I posted what I find may be errors in survival:::Prentice and survival:::LinYing. Today, I found (what I believe is) another discrepancy/error in survival:::SelfPrentice. The variance estimator is slightly different from codes of Therneau Li (1999). When extracting dfbeta, Therneau

Re: [R] Appropriateness of R functions for multicore

2013-08-23 Thread R. Michael Weylandt
On Mon, Aug 19, 2013 at 2:08 PM, Patrick Connolly p_conno...@slingshot.co.nz wrote: On Sat, 17-Aug-2013 at 05:09PM -0700, Jeff Newmiller wrote: | In most threaded multitasking environments it is not safe to | perform IO in multiple threads. In general you will have difficulty | performing IO

Re: [R] How to rebuild an R package that has been removed from CRAN?

2013-08-23 Thread R. Michael Weylandt
On Mon, Aug 19, 2013 at 6:07 PM, Shang Zuofeng zuofengsh...@gmail.com wrote: So this is an alternative method. The package can be installed from source() rather than rebuilt. Although the warnings exist, the package itself may still be useful. Can you let me know how to installed from source?