Re: [R] Object oriented programming in R.

2010-09-16 Thread Yvonnick Noel
I think you should have a look at the 'proto' package on CRAN. Yvonnick Noel University of Brittany, Rennes France __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] Pesky homemade function code

2010-09-16 Thread trekvana
Hi all- this seems to be simple to figure out but since im new to writing functions I dont know what is happening. Here is my code along with the error I am receiving: semivario=function(data,ids,times,resids){ id=unique(data$ids) index=combinations(length(data$times[data$ids==id[1]]),2)

[R] plotting time series using ggplots

2010-09-16 Thread Alison Macalady
Hi, I would like to plot a bunch of tree ring width data (time series) using ggplots, but I'm having trouble figuring out how to do it. My data is in a data.frame, with years as rownames and a distinct tree ring series in each column. So, something like this: rwl-matrix(rnorm(800), nrow =

[R] The permutation of one vector into another

2010-09-16 Thread Niels Richard Hansen
Dear R-help-list I have two character vectors a - c(A, B, C) b - c(A, C, B) Then sapply(a, function(i) grep(i, b)) computes the permutation of the entries in 'b' needed to bring 'b' into the same order as 'a'. I have searched around, but haven't been able to find any existing function that

Re: [R] Creating publication-quality plots for use in Microsoft Word

2010-09-16 Thread Gavin Simpson
On Wed, 2010-09-15 at 08:25 -0700, dadrivr wrote: Thanks for your help, guys. I'm looking to produce a high-quality plot (no jagged lines or other distortions) with a filetype that is accepted by Microsoft Word on a PC and that most journals will accept. That's why I'd prefer to stick with

Re: [R] plotting time series using ggplots

2010-09-16 Thread ONKELINX, Thierry
Dear Alison, Creating a dataset in long format instead of wide format makes things much easier with ggplot2. You also need a variable with Year. Rownames will not do. rwl - matrix(rnorm(800, 1, sd =0.5), nrow = 100) colnames(rwl) - paste('V', 1:8, sep = '') rwl - as.data.frame(rwl) rwl$Year -

Re: [R] Asking Favor

2010-09-16 Thread Michael Bedward
Here's a way with less code... # assume original matrix is X u - unique( sort(X) ) ucdf - cumsum( tabulate(X)[u] ) Xcdf - matrix(ucdf[ match(X, u) ], 8) Michael On 16 September 2010 14:58, chuan zun liang chuan...@yahoo.com.my wrote: Hello Friend: Thanks a lot. I kindly told that Micheal

Re: [R] Pesky homemade function code

2010-09-16 Thread ONKELINX, Thierry
The calculation of semivraiogram is allready implemented is many R packages. So why do it yourself? library(sos) findFn(variogram) Gives you 190 hits! ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek team

Re: [R] Pesky homemade function code

2010-09-16 Thread trekvana
@Thierry- I am writing my own semivariogram code since I could not find a pre-made function that did what I need it do. The code in the function correctly works but I not sure how to get the function itself to work. In other words if I fill in the commands (hope,id,sctime,scResid) by hand then

[R] Splitting a matrix

2010-09-16 Thread Megh Dal
Hi, I was trying to split the following matrix dat: set.seed(1) dat - matrix(rnorm(4*16), 4, 16) dat [,1] [,2] [,3][,4][,5][,6] [,7] [,8][,9] [,10] [,11] [1,] -0.6264538 0.3295078 0.5757814 -0.62124058 -0.01619026

[R] problem reading Matlab file into R

2010-09-16 Thread Claude Flener
Hi, I'm trying to read a .mat file into R (2.11.1) with medium success so far. The file I have is a MATLAB 5.0 MAT-file exported from RiverSurveyor LIVE software (http://www.sontek.com/software.php). I have R.matlab and Rcompression installed and readMat() starts reading the file, as can be

Re: [R] Fwd: R install in Fedora

2010-09-16 Thread Michael Hannon
Actually I tried in both ways : yum install R and sudo yum install R , but the error is same. I have root privilege, means I used the command su - and enter the password. May be its problem from Fedora. Thanks for your valuable help. I will post this issue in R-SIG-Fedora list. Kind

Re: [R] Splitting a matrix

2010-09-16 Thread Bill.Venables
Here is one possibility: set.seed(1) dat - matrix(rnorm(4*16), 4, 16) dim(dat) - c(4,4,4) dat , , 1 [,1] [,2] [,3][,4] [1,] -0.6264538 0.3295078 0.5757814 -0.62124058 [2,] 0.1836433 -0.8204684 -0.3053884 -2.21469989 [3,] -0.8356286 0.4874291 1.5117812

Re: [R] The permutation of one vector into another

2010-09-16 Thread Michael Bedward
match(b, a) ? Michael On 16 September 2010 17:13, Niels Richard Hansen niels.r.hansen+li...@math.ku.dk wrote: Dear R-help-list I have two character vectors a - c(A, B, C) b - c(A, C, B) Then sapply(a, function(i) grep(i, b)) computes the permutation of the entries in 'b' needed to

Re: [R] Using feather.plot to try and generate a stick plot of current velocity data (and having issues)

2010-09-16 Thread Jim Lemon
Hi all, After a bit of offlist correspondence, the problem with feather.plot was found to be with the input data format (lists) and the particular data revealed a bug in the function. A fix for the bug and a warning about lists as input will be in the next version of plotrix (3.0-1). Jim

Re: [R] The permutation of one vector into another

2010-09-16 Thread Niels Richard Hansen
match(b, a) ? Michael Right! Thanks, Michael. On 16 September 2010 17:13, Niels Richard Hansen niels.r.hansen+li...@math.ku.dk wrote: Dear R-help-list I have two character vectors a - c(A, B, C) b - c(A, C, B) Then sapply(a, function(i) grep(i, b)) computes the permutation of

Re: [R] use same breaks and colors, but the displayed scale are different-image.plot()

2010-09-16 Thread Jim Lemon
On 09/16/2010 12:05 PM, rusers.sh wrote: Hi all, I want to put several figures in a one figure for easy comparison, so i need to use the same methods to plot these figures. The following is an example. I also list my method, but it does not work. #Example data x- 1:10; y- 1:10; z- outer(

[R] How to combine matrix and vector

2010-09-16 Thread Wonsang You
Dear fellows, I am a novice in R. I would like to combine a matrix and a vector. Assume that we have the matrix a and the vector b with same length of column. a-matrix(seq(1:10),nrow=2,ncol=5,byrow=TRUE) a= 12345 6789 10 b-t(c(11,12,13,14,15)) b= 11 12 13 14

Re: [R] How to combine matrix and vector

2010-09-16 Thread Ivan Calandra
Hi! Take a look at rbind() Btw, I don't think you have to transpose b. HTH, Ivan Le 9/16/2010 11:09, Wonsang You a écrit : Dear fellows, I am a novice in R. I would like to combine a matrix and a vector. Assume that we have the matrix a and the vector b with same length of column.

Re: [R] How to uncompress a gz file in R

2010-09-16 Thread Wonsang You
Dear Henrik and Steven, Thank you for your kind help and guidance even though it is a basic question. I misunderstood that gunzip is a part of not R.utils but utils. I could find out the function in R.utils. Then, it was successful to decompress any gz file as follows. library(R.utils)

Re: [R] standard error of difference for mixed effects

2010-09-16 Thread ONKELINX, Thierry
Dear Tony, A mixed models is not a good idea if you have only two levels for sites and two times two for phase. The first problem is a mathematical problems. You are estimating variances based on only two and four values. Which is very small, hence you will not get reliable estimates of the

Re: [R] How to uncompress a gz file in R

2010-09-16 Thread steven mosher
you are welcome. Henrik's package is an great piece of work. It is worth the time to read through the whole thing and see how you can improve your programs by using other features as well. On Thu, Sep 16, 2010 at 2:16 AM, Wonsang You y...@ifn-magdeburg.de wrote: Dear Henrik and Steven, Thank

Re: [R] Pesky homemade function code

2010-09-16 Thread Sebastian Gibb
Hello, why you don't use the last 3 arguments? semivario=function(data,ids,times,resids){ id=unique(data$ids) ... It seems data be a list. In that case the last 3 arguments are useless. Could you please send us a runable code example. That means some example data and your all neede functions

Re: [R] Error compiling R 2.10.1 on AIX

2010-09-16 Thread Balkrishna Ketkar
Hello, I am also facing exactly same problem like Mike while compiling R on AIX 5.3 Error in read.dcf(file = descfile) : Line starting 'Package: tools ...' is malformed! Calls: makeLazyLoading ... code2LazyLoadDB - loadNamespace - parseNamespaceFile - read.dcf Execution halted My Environment

Re: [R] multiple cores/building fails

2010-09-16 Thread Uwe Ligges
On 15.09.2010 17:40, Gregory Ryslik wrote: Hi, That seems to be the case. Is there a way that I can put an object in some global place where all the workers can access it? Doing the following at the start (before I make multiple workers) does not work: Assign('global.control', control,

Re: [R] approxfun returning value higher than I would expect

2010-09-16 Thread Duncan Murdoch
stephen sefick wrote: I will get R-dev tomorrow, and give it a try. Where do I check out the svn? https://svn.r-project.org/R/trunk The fixed files are in .../src/library/stats/R and are approx.R, spline.R and splinefun.R. The only one that affects your report is approx.R. Duncan

[R] help me understand how things work.

2010-09-16 Thread Alaios
Hello I have some strange output from R and I try to understand how R works. Could you please help me with that? temp - rbind (c(10,1),c(99,98)) temp [,1] [,2] [1,] 101 [2,] 99 98 dist(temp) 1 2 131.6435 sqrt(dist(temp)) 1 2 11.47360 so far so good.

Re: [R] Pesky homemade function code

2010-09-16 Thread Rafael Björk
Checking on the function 'combinations' in gplot i find this: if (mode(n) != numeric || length(n) != 1 || n 1 || (n%%1) != 0) stop(bad value of n) So essentially, the argument 'length(data$times[data$ids == id[1]])' in the line 'combinations(length(data$times[data$ids ==

Re: [R] Error compiling R 2.10.1 on AIX

2010-09-16 Thread Ei-ji Nakama
Hi, This is a bug of tre-regex(AIX 64bit only). following patches help you. https://r-forge.r-project.org/scm/viewvc.php/patches/aix_R210_tre.patch?view=markuproot=aix 2010/9/16 Balkrishna Ketkar bket...@gmail.com: Hello, I am also facing exactly same problem like Mike while compiling R on

Re: [R] help me understand how things work.

2010-09-16 Thread Michael Bedward
Hello Alex, Look at the help page for the dist function. You'll see it doesn't return a simple vector or matrix, rather a dist class object which is why you got a surprise when you tried to treat it like a simple value. The function is not really intended for spatial point distance calculations,

Re: [R] help me understand how things work.

2010-09-16 Thread Julian Burgos
Hi Alex, What is happening is that the ´dist´function calculates a distance matrix, and returns an object of the ´dist´ class. temp - rbind (c(10,1),c(99,98)) x=dist(temp) x 1 2 131.6435 class(x) [1] dist You can see a description of the ´dist´class at the end of the function´s

Re: [R] help me understand how things work.

2010-09-16 Thread Alaios
I fixed by adding this: k - sqrt(dist(temp)) k returns sort of a list. So I need to select the first item which is the result. a - k[1] Can someone explain me why k[1] is needed for that? Best Regards Alex From: Mario Valle mva...@cscs.ch Sent: Thu,

Re: [R] Problem with cat() == A related question

2010-09-16 Thread Peng, C
The question is wehter cat() can print out a matrix as it is. For example, Let's assume that we have matrices A, B, D(= A+B), if it is possible that cat(\n, A, +,B,=, D, some control arguments , \n) prints out matrix A + matrix B = matrix D where matrices A, B, D (= A+B) should be in the

Re: [R] help me understand how things work.

2010-09-16 Thread Mario Valle
print(k) and you see a lower triangular distance matrix. k[1] selects distances between 1 and 2 k[2] selects distances between 1 and 3 and so on. you have a distance matrix, not a single distance value, so you have to select which distance you need. Ciao! mario On

[R] Help for an absolutely r-noob

2010-09-16 Thread strampe
Hello together, I am an absolute noob in R and therefore I need help urgently. I have received a script from my tutor with plot functions in it. However, I can' manage to adapt these plots. The hole script is as follows: setwd(E:/) # (1) Read data ### dat -

Re: [R] The permutation of one vector into another

2010-09-16 Thread David Winsemius
On Sep 16, 2010, at 4:23 AM, Michael Bedward wrote: match(b, a) ? Or just order(.) : b[order(a)] [1] A C B -- David Michael On 16 September 2010 17:13, Niels Richard Hansen niels.r.hansen+li...@math.ku.dk wrote: Dear R-help-list I have two character vectors a - c(A, B, C) b - c(A,

[R] How do I create a plotable zoo object based on weekly data?

2010-09-16 Thread Michael Green
Dear readers, The problem is simple: I have weekly time series data with a maximum week number of (52,53,52,52) in (2008,2009,2010,2011) respectively. That means I have a dataset looking like this: 2008-01 value 2008-02 value . . 2011-52 value And I would like to turn that data into a plotable

Re: [R] Help for an absolutely r-noob

2010-09-16 Thread Ivan Calandra
Hi, Take a look at ?par, all the arguments for the plot() function are described there. Check in particular ylim, xlab and ylab HTH, Ivan Le 9/16/2010 14:45, strampe a écrit : Hello together, I am an absolute noob in R and therefore I need help urgently. I have received a script from my

Re: [R] reshape matrix entities to columns

2010-09-16 Thread Natasha Asar
Thanks for the help I have tried the one that uses xtab() and the answer is correct because when I was using the rbind() still getting the same error message… Now I have some more questions … I am trying to be able to adapt this for any kind of data of the same structure so now im

[R] R Founding

2010-09-16 Thread jaropis
A few days ago Tal Galili posted a message about some controversies concerning the future of R. Having read the discussions, especially those following Ross Ihaka's post, I have come to the conclusion, that, as usual, the problem is money. I doubt there would be discussions about dropping R in

[R] How do I create a plotable zoo object based on weekly data?

2010-09-16 Thread Michael Green
Dear readers, The problem is simple: I have weekly time series data with a maximum week number of (52,53,52,52) in (2008,2009,2010,2011) respectively. That means I have a dataset looking like this: 2008-01 value 2008-02 value . . 2011-52 value And I would like to turn that data into a plotable

Re: [R] Odp: Programming: loop versus vector oriented

2010-09-16 Thread Jan private
Hello Petr, If you want to get results of your function for a vector of reynolds and dk you can use function outer and probably get rid of for cycle in the function. outer(c(100, 530,2410), c(10, 150,200),lambda_wall) [,1] [,2] [,3] [1,] 0.640 0.6400

Re: [R] Package build and install under Windows

2010-09-16 Thread Uwe Ligges
On 15.09.2010 17:06, Tao wrote: Thanks. It seems that both Rtools210.exe and Rtools211.exe support R 1.10.x, which one is better for R 2.10.1. You can use both, but you may want to choose the newer one. Uwe __ R-help@r-project.org mailing list

Re: [R] R Founding

2010-09-16 Thread stephen sefick
I am a poor student, and would gladly donate 20ish bucks if it would help. R continues to make me more productive. Thanks for all of the good work! On Thu, Sep 16, 2010 at 5:49 AM, jaropis jaro...@zg.home.pl wrote: A few days ago Tal Galili posted a message about some controversies concerning

Re: [R] R Founding

2010-09-16 Thread Duncan Murdoch
On 16/09/2010 6:49 AM, jaropis wrote: A few days ago Tal Galili posted a message about some controversies concerning the future of R. Having read the discussions, especially those following Ross Ihaka's post, I have come to the conclusion, that, as usual, the problem is money. I doubt there

[R] IP address

2010-09-16 Thread Jorge Nieves
Hi, We have some tight controls in our systems and I am having difficulty downloading/upgrading R packages. The IT department will configure our system to let me download packages from two or three R depositories. How do I find out what the IP address of the R depositories are so that I can

Re: [R] R Founding

2010-09-16 Thread Christopher W. Ryan
I mailed a check for an R Foundation membership almost a year ago, along with the form. In US dollars, corrected by the then-current Euro exchange rate. It has never been cashed. Christopher W. Ryan, MD SUNY Upstate Medical University Clinical Campus at Binghamton 425 Robinson Street,

[R] problems trying to reproduce structural equation model using the sem package

2010-09-16 Thread Gustavo Carvalho
Hello, I've been unsuccessfully trying to reproduce a sem from Grace et al. (2010) published in Ecological Monographs: http://www.esajournals.org/doi/pdf/10.1890/09-0464.1 The model in question is presented in Figure 8, page 81. The errors that I've been getting are: 1. Using a correlation

[R] Help with customizing a histogram figure

2010-09-16 Thread Josh B
Hi all, Please consider the following code: require(plotrix) l - list(rnorm(50),rnorm(50,sd=2),rnorm(50,mean=3)) multhist(l) I have two things I need help with: (1) In the output, there are empty spaces on the x-axis. How would I eliminate these spaces? I want a nice, smooth,

Re: [R] R Founding

2010-09-16 Thread Uwe Ligges
I cannot speak for the R Foundation, but you know, getting a US check into money is roughly 20$ fees (at least in Germany, don't know the typical Austrian conditions). I know from organizing a conference in Germany that the only really good way was and is ordinary money transfer via BIC and

Re: [R] error in 2.10: R include directory is empty prevents package installation

2010-09-16 Thread slakov
I hope to revive this topic. I have the same error message when I try to install any package. Many thanks upfront! -- View this message in context: http://r.789695.n4.nabble.com/error-in-2-10-R-include-directory-is-empty-prevents-package-installation-tp907110p2542306.html Sent from the R help

[R] Nemenyi test as a post-hoc test to Kruskal Wallis

2010-09-16 Thread Anne-Christine Mupepele
Dear all, I've discovered the possibility to do the Nemenyi-Damico-Wolfe-Dunn test in the library(coin); oneway_test() With the given example I am unfortunately not able to reproduce the test. What does trafo and contrMat mean? I have a dataframe with 176 elements in 7 classes. It may be a

Re: [R] Help with customizing a histogram figure

2010-09-16 Thread Thomas Stewart
Josh- The link you included with your post provides the code for the example plot. Simply click on the icon in the Download Source Code section. I think you'll be able to learn a lot by playing with that source code. -tgs On Thu, Sep 16, 2010 at 9:40 AM, Josh B josh...@yahoo.com wrote: Hi

Re: [R] IP address

2010-09-16 Thread Ben Bolker
Jorge Nieves jorge.nieves at moorecap.com writes: Hi, We have some tight controls in our systems and I am having difficulty downloading/upgrading R packages. The IT department will configure our system to let me download packages from two or three R depositories. How do I find out

Re: [R] Help with customizing a histogram figure

2010-09-16 Thread Jorge Ivan Velez
Hi Josh, You can go to http://addictedtor.free.fr/graphiques/sources/source_55.R and see the source code there. Now, if you want to run the example directly from the R console, something along the lines of source('http://addictedtor.free.fr/graphiques/sources/source_55.R') might work. HTH,

[R] FTP Download

2010-09-16 Thread Martin
Hi, I have problems downloading complete folders via ftp with R. Single files work fine. I tried Rcurl, but it does not work. This is my code: url = ftp://disc2.nascom.nasa.gov/data/TRMM/Gridded/Derived_Products/3B42_V6/Daily/2009/; filenames = getURL(url, ftp.use.epsv = FALSE, ftplistonly =

Re: [R] How to combine matrix and vector

2010-09-16 Thread Wonsang You
Thank you so much for your help. It was successful to combine matrix and vector by using rbind as follows. a-matrix(seq(1:10),nrow=2,ncol=5,byrow=TRUE) a [,1] [,2] [,3] [,4] [,5] [1,]12345 [2,]6789 10 b-t(c(11,12,13,14,15)) b [,1] [,2] [,3]

Re: [R] FTP Download

2010-09-16 Thread Henrique Dallazuanna
Try this: mapply(download.file, filenames, basename(filenames)) On Thu, Sep 16, 2010 at 11:56 AM, Martin mar...@bier-mail.de wrote: Hi, I have problems downloading complete folders via ftp with R. Single files work fine. I tried Rcurl, but it does not work. This is my code: url =

Re: [R] FTP Download

2010-09-16 Thread Martin
works, thanks a lot! -- View this message in context: http://r.789695.n4.nabble.com/FTP-Download-tp2542359p2542380.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] Nemenyi test as a post-hoc test to Kruskal Wallis

2010-09-16 Thread Peter Ehlers
On 2010-09-16 8:31, Anne-Christine Mupepele wrote: Dear all, I've discovered the possibility to do the Nemenyi-Damico-Wolfe-Dunn test in the library(coin); oneway_test() With the given example I am unfortunately not able to reproduce the test. What does trafo and contrMat mean? I have a

[R] question about changing color scale in plot.fmri

2010-09-16 Thread Dana TUDORASCU
Hello everybody, I am using plot.fmri function to plot some stats on a functional image, but for some reasons the only collor I get on the image is gray. Here is the function I am using:plot.fmridata(t1,type=slice,col.o=heat.colors(256)) It is the first time I am using this package, so I

[R] Odd graphics output problem

2010-09-16 Thread David Warren
Hi all, I'm having trouble saving graphics output from within a loop, and I can't figure out a solution. I'd like to produce and save lots of individual plots for inspection, so I set up the following script: library( lattice ) wd = ~/Documents/PPM/ ppm = read.table( paste( wd,

Re: [R] Can I save my console contents automatically?

2010-09-16 Thread Nobuaki Michihata
Hello David and Greg, Thank you for your suggestions. These really help me. I'm curious about txtStart function of TeachingDemos library. It looks exactly what I need. So I installed TeachingDemos library and tried following. - library(TeachingDemos) setwd(/Users/NOBU/Documents/R_data/)

[R] question about converting a matrix to a dataframe

2010-09-16 Thread Leigh E. Lommen
First I have a matrix called stocks1: class(stocks1) [1] matrix Here are the first 5 rows of the last 4 columns: stocks1[1:5,2:5] [,1] [,2] [,3] [,4] [1,] 80.73 31.95 25.4 25.69 [2,] 83.66 31.95 27.12 25.2 [3,] 83.27 32.93 28.74 26.29 [4,] 83.9 34.07 29.77 26.6 [5,]

Re: [R] Odd graphics output problem

2010-09-16 Thread RICHARD M. HEIBERGER
See the FAQ 7.22 Why do lattice/trellis graphics not work? The most likely reason is that you forgot to tell R to display the graph. Lattice functions such as xyplot() create a graph object, but do not display it (the same is true of *ggplot2*http://cran.r-project.org/package=ggplot2graphics, and

[R] Instal R on OS X Server

2010-09-16 Thread James Nead
Hi, I was trying to install R in my home directory on a Mac OS X Server running Darwin. How do I go about installing it? How can I install from the binary provided (R-2.11.1.pkg) from command line? Is there any other information that I can provide? thanks [[alternative HTML

Re: [R] question about converting a matrix to a dataframe

2010-09-16 Thread Michael Green
Use as.data.frame instead. It does what you want it to do. newdata.df-as.data.frame(stocks1[1:5,2:5]) Cheers, Michael -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Leigh E. Lommen Sent: 16. september 2010 17:18 To:

Re: [R] question about converting a matrix to a dataframe

2010-09-16 Thread Ivan Calandra
Hi, Well, it works for me: x - matrix(1:20, nrow=5, ncol=4) data.frame(x[1:5,2:4]) X1 X2 X3 1 6 11 16 2 7 12 17 3 8 13 18 4 9 14 19 5 10 15 20 Maybe with as.data.frame(), or set the drop argument to FALSE: data.frame(x[1:5,2:4,drop=FALSE]) Not sure why it doesn't work for you. Check

Re: [R] Odd graphics output problem

2010-09-16 Thread David Warren
Got it, thanks! On Thu, Sep 16, 2010 at 10:22 AM, RICHARD M. HEIBERGER r...@temple.eduwrote: See the FAQ 7.22 Why do lattice/trellis graphics not work? The most likely reason is that you forgot to tell R to display the graph. Lattice functions such as xyplot() create a graph object, but do

[R] Local Variable

2010-09-16 Thread harunpirim
Dear All, I have a function: gen - function(m){for(i in 1:m){assign(paste(x,i, sep=), (7*get(paste(x,i-1,sep=)))%%13); print(get(paste(x, i, sep=)))}} my question is, I do gen(20), then the function prints out 20 values, however when I do objects(), I can't see x1,x2,x3,,x20 as objects.

[R] get top n rows group by a column from a dataframe

2010-09-16 Thread Tan, Richard
Hi, is there an R function like sql's TOP key word? I have a dataframe that has 3 columns: company, person, salary How do I get top 5 highest paid person for each company, and if I have fewer than 5 people for a company, just return all of them? Thanks, Richard

[R] ANOVA - more sophisticated contrasts

2010-09-16 Thread Jake Kami
dear list, i am using a multifactorial design with two treatments (factor A: drugs, three levels; factor B: theraphy, two levels) and a time factor (three levels, different timepoint). hypothetically, i measured the same subjects for all treatements and timepoints, so its a repeated measurement

Re: [R] Local Variable

2010-09-16 Thread Sarah Goslee
Leaving aside the question of whether this is a good thing to do, you can accomplish what you want by changing the pos argument, which by default does not save the variable to the global environment. Reading the details section of ?assign and also ?environment may help. I'd offer an example, but

[R] using variable from for loop in naming new variables

2010-09-16 Thread Maas James Dr (MED)
Simple one here ... but can't get it to work ... for (i in 1:4){ paste(stuff,[i]),sep=) - 3 + i } ls() rm(list=ls()) I just want it to create 4 new variables called stuff1, stuff2, stuff3, stuff4 with the corresponding assignments. I realise that there are more elegant functions but

Re: [R] Local Variable

2010-09-16 Thread Erik Iverson
Sarah Goslee wrote: Leaving aside the question of whether this is a good thing to do, Let's not leave that aside. Surely there is a much more straight-forward way to accomplish what you want. Why not store all the X's in a vector, and then you can avoid this for/assign/get hack. you can

Re: [R] R Founding

2010-09-16 Thread Joshua Wiley
On Thu, Sep 16, 2010 at 3:49 AM, jaropis jaro...@zg.home.pl wrote: A few days ago Tal Galili posted a message about some controversies concerning the future of R. Having read the discussions, especially those following Ross Ihaka's post, I have come to the conclusion, that, as usual, the

[R] More accurate ODE solver?

2010-09-16 Thread Tianchan Niu
Dear All, I was using rk4 and lsoda to solve a ODE system. However, both of them gave bad accurate solutions, especially compared with Matlab solver ODE45. For example, ODE45 gave solutions that can go to a stable level (about 1.6) when time goes to infinity, however, the solutions from lsoda are

Re: [R] aggregate, by, *apply

2010-09-16 Thread Mark Ebbert
Thanks everyone for the responses. They were all helpful! On Sep 15, 2010, at 5:22 PM, Abhijit Dasgupta, PhD wrote: I would approach this slightly differently. I would make func a function of x and y. func - function(x,y){ m - median(x) return(m 2 m y) } Now generate tmp

Re: [R] get top n rows group by a column from a dataframe

2010-09-16 Thread RICHARD M. HEIBERGER
tmp - data.frame(matrix(rnorm(30), 10, 3, dimnames=list(letters[1:10], c(company, person, salary tmp company person salary a -1.04590176 -0.7841855 1.07150503 b -1.06643101 0.6545647 0.43920454 c

[R] Help with graphic margin

2010-09-16 Thread Filoche
Hi everyone. I would like to make a graphic with 2 subplots (lets say A and B). For instance, I use : par(mfcol = c(2,1)); The 2 subplots use the same X axis. So I provide no tics labels and no xlab for the top plot. I would like the second plot to be right bellow the first one (small

[R] KMedians clustering in R

2010-09-16 Thread Shubha Vishwanath Karanth
Hi R, Is there a package in R to perform KMedian clustering? Thanks. Shubha This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the

[R] More accurate ODE solver?

2010-09-16 Thread Tianchan Niu
Dear All, I was using rk4 and lsoda to solve a ODE system. However, both of them gave bad accurate solutions, especially compared with Matlab solver ODE45. For example, ODE45 gave solutions that can go to a stable level (about 1.6) when time goes to infinity, however, the solutions from lsoda are

Re: [R] Instal R on OS X Server

2010-09-16 Thread David Winsemius
On Sep 16, 2010, at 11:25 AM, James Nead wrote: Hi, I was trying to install R in my home directory on a Mac OS X Server running Darwin. How do I go about installing it? How can I install from the binary provided (R-2.11.1.pkg) from command line? It's not really an rhelp question, is

Re: [R] ANOVA - more sophisticated contrasts

2010-09-16 Thread RICHARD M. HEIBERGER
Jake, You can easily use glht for that. See ?MMC in the HH package for examples. You may need install.packages(HH) ## if you don't already have HH. Specifically, look at the examples showing the use of focus.lmat On Thu, Sep 16, 2010 at 11:43 AM, Jake Kami jakejk...@gmail.com wrote: dear

Re: [R] KMedians clustering in R

2010-09-16 Thread Christian Hennig
pam/clara in package cluster are probably as close to it as you can be. There is no unique definition of a multivariate median and therefore there is no unique definition of k-medians, but pam/clara is one possible version of it. (Of course if you think of k-medians as defined in a specific

Re: [R] using variable from for loop in naming new variables

2010-09-16 Thread Ivan Calandra
Hi! assign() should do the job. But using a list, and filling each element iteratively (with a for loop or with *apply() ) might be better, up to you. Btw, why do you remove your objects? HTH, Ivan Le 9/16/2010 17:44, Maas James Dr (MED) a écrit : Simple one here ... but can't get it to

Re: [R] Problem with cat() == A related question

2010-09-16 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Peng, C Sent: Thursday, September 16, 2010 5:39 AM To: r-help@r-project.org Subject: Re: [R] Problem with cat() == A related question The question is wehter cat() can print

Re: [R] using variable from for loop in naming new variables

2010-09-16 Thread David Winsemius
On Sep 16, 2010, at 11:44 AM, Maas James Dr (MED) wrote: Simple one here ... but can't get it to work ... for (i in 1:4){ paste(stuff,[i]),sep=) - 3 + i } ls() rm(list=ls()) for (i in 1:4){ +paste(stuff,[i]),sep=) - 3 + i Error: unexpected '[' in: for (i in 1:4){ paste(stuff,[

[R] Survival Analysis Daily Time-Varying Covariate but Event Time Unknown

2010-09-16 Thread smm7aa
Help! I am unsure if I can analyze data from the following experiment. Fish were placed in a tank at (t=0) Measurements of Carbon Dioxide were taken each day for 120 days (t=0,...120) A few fish were then randomly pulled out of the tank at different days, killed and examined for the presence of

Re: [R] reshape matrix entities to columns

2010-09-16 Thread Dennis Murphy
Hi: Could you please devise a reproducible example that illustrates the problem? As far as points (1) and (2) are concerned, if you lack row or column names, they can always be defined and added to the object. Dennis On Thu, Sep 16, 2010 at 4:26 AM, Natasha Asar natasha.asa...@yahoo.comwrote:

[R] RODBC Access/Excel driver location for 64 bit Win7

2010-09-16 Thread Peter Holck
Apologies, but after a fair amount of digging, I still only have a foggy understanding of the cause of this problem, due to my own ignorance. I hope to use RODBC package to connect to an Access DB when running 64 bit Win7 (R version 2.11.1, 64 bit). I have successfully done this before on a

[R] a reliable way to check the latest version of R on CRAN?

2010-09-16 Thread Yihui Xie
Hi all, We know old.packages() can check for updates of add-on packages, but is there a way to check updates of R itself? go to R homepage is a way, of course, but I hope this can be done by R. I'm not sure about the reliable place to check; here is a simple example to check from one of the CRAN

[R] Problems creating a Panel

2010-09-16 Thread Luis Felipe Parra
Hello, I am trying to create a panel with the attached data frame. using the following code: PanelRio = DataRiopaila[which(duplicated(DataRiopaila$SEC_STE)==T),] PanelRio=plm.data(PanelRio,index=c(SEC_STE,FechaSiembra)) series

Re: [R] Creating publication-quality plots for use in Microsoft Word

2010-09-16 Thread dadrivr
Thanks for all the suggestions, guys. It looks like TIFF may be the easiest solution, as I wouldn't have to worry about printing to a postscript printer or converting to PDF (when using EPS). That way, I could send the Word file as is to all coauthors (important for collaboration - i.e., track

[R] parallel computation with plyr 1.2.1

2010-09-16 Thread Dylan Beaudette
Hi, I have been trying to use the new .parallel argument with the most recent version of plyr [1] to speed up some tasks. I can run the example in the NEWS file [1], and it seems to be working correctly. However, R will only use a single core when I try to apply this same approach with

[R] shuffling of data

2010-09-16 Thread fugelpitch
I have a file that reads like this: Species,Year,Julian_day Alnus_glutinosa, 1873, 123 Sorbus_aucuparia, 1873, 122 (more species...) Alnus_glutinosa, 1874, 134 Sorbus_aucuparia, 1874, 143 (more species and years) Is there a way to plot this as julian day over years so that each species

Re: [R] shuffling of data

2010-09-16 Thread stephen sefick
Something like this? library(ggplot2) qplot(Year, Julian_day, data=a, colour=Species) On Thu, Sep 16, 2010 at 12:14 PM, fugelpitch jo...@runtimerecords.net wrote: I have a file that reads like this: Species,Year,Julian_day Alnus_glutinosa, 1873, 123 Sorbus_aucuparia, 1873, 122 (more

Re: [R] get top n rows group by a column from a dataframe

2010-09-16 Thread Tan, Richard
Hi Richard Thanks for the suggestion, but I want top 5 salary for each company, not the whole list. I don't see how your way can work? Thanks, Richard From: RICHARD M. HEIBERGER [mailto:r...@temple.edu] Sent: Thursday, September 16, 2010 11:53 AM To: Tan, Richard Cc:

Re: [R] shuffling of data

2010-09-16 Thread David Winsemius
On Sep 16, 2010, at 1:14 PM, fugelpitch wrote: I have a file that reads like this: How much R do you know? Are you still at the stage where you need basic help reading a file into a session? Species,Year,Julian_day Alnus_glutinosa, 1873, 123 Sorbus_aucuparia, 1873, 122 (more

Re: [R] test to see if a s4 property is assigned?

2010-09-16 Thread Martin Morgan
On 09/15/2010 12:03 PM, darckeen wrote: Class(person,representation(age=numeric,weight=numeric)) [1] person bob - new(person,age=30) is.null(b...@weight) [1] FALSE b...@weight numeric(0) b...@weight == numeric(0) logical(0) Hi darckeen -- use the prototype argument to setClass to

  1   2   >