Re: [R] Calculating a Maximum for a row or column with NA's

2010-04-17 Thread steven mosher
thx jorge, I was playing around with ifelse to solve the problem, but was unaware of the all(is.na(x)). RTFM I guess. On Sat, Apr 17, 2010 at 10:31 PM, Jorge Ivan Velez wrote: > Hi Steven, > > Try this: > > R> apply(m,1, function(x) ifelse(all(is.na(x)), NA, max(x, na.rm = TRUE))) > [1] NA 8 9

Re: [R] Calculating a Maximum for a row or column with NA's

2010-04-17 Thread Jorge Ivan Velez
Hi Steven, Try this: R> apply(m,1, function(x) ifelse(all(is.na(x)), NA, max(x, na.rm = TRUE))) [1] NA 8 9 See ?ifelse, ?all and ?max for more information. HTH, Jorge On Sun, Apr 18, 2010 at 12:16 AM, steven mosher <> wrote: > Is there a simple way to calculate the maximum for a row or col

Re: [R] rosavent problem

2010-04-17 Thread Joshua Wiley
On Sat, Apr 17, 2010 at 8:04 PM, Kevin Turner wrote: > I have a frequency table that I am trying to plot on a rose diagram using > rosavent.  I've set the table up by using this line: > > Wind_freq_speed <- t(table(cut(Wind_Dir_vec, 0:36), cut(Wind_Speed_vec, > seq(0, to=60, by=10 We do not h

Re: [R] Calculating a Maximum for a row or column with NA's

2010-04-17 Thread steven mosher
Ya I got that result but fixing it was a mystery. especially since I will eventually want to subtract the row max from the row Min ( or calculate the range) if a matrix thus is: [,1] [,2] [,3] [1,] NA NA NA [2,]258 [3,] NA69 and apply(m,1,max,na.rm=TRUE) yeilds [1

Re: [R] rosavent problem

2010-04-17 Thread David Winsemius
On Apr 17, 2010, at 11:04 PM, Kevin Turner wrote: I have a frequency table that I am trying to plot on a rose diagram using rosavent. I've set the table up by using this line: Wind_freq_speed <- t(table(cut(Wind_Dir_vec, 0:36), cut(Wind_Speed_vec, seq(0, to=60, by=10 It produces the

Re: [R] Calculating a Maximum for a row or column with NA's

2010-04-17 Thread David Winsemius
On Apr 18, 2010, at 12:16 AM, steven mosher wrote: Is there a simple way to calculate the maximum for a row or column of a matrix when there are NA,s present. # given a matrix that has any number of NA per row m<-matrix(c(seq(1,9)),nrow=3) m [,1] [,2] [,3] [1,]147 [2,]2

Re: [R] Serverless databases in R

2010-04-17 Thread Wincent
How about RSQLite? On 18 April 2010 12:56, kMan wrote: > Dear list, > > What are the cross-platform, serverless databases in R? > > Sincerely, > KeithC. > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE

[R] Serverless databases in R

2010-04-17 Thread kMan
Dear list, What are the cross-platform, serverless databases in R? Sincerely, KeithC. __ 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 pro

Re: [R] Calling R using Shell Script and give input file to the R script

2010-04-17 Thread jim holtman
?Rscript It is also in the Intro to R manual if you had read it (section B.4). On Sat, Apr 17, 2010 at 11:46 PM, Ayush Raman wrote: > Hi, > > I am trying to call the R script using shell script and pass the input file > as an argument to the R script. Can somebody give me some insights on this

[R] Calculating a Maximum for a row or column with NA's

2010-04-17 Thread steven mosher
Is there a simple way to calculate the maximum for a row or column of a matrix when there are NA,s present. # given a matrix that has any number of NA per row > m<-matrix(c(seq(1,9)),nrow=3) > m [,1] [,2] [,3] [1,]147 [2,]258 [3,]369 > m[3,1]=NA > m[1,]=NA

[R] Calling R using Shell Script and give input file to the R script

2010-04-17 Thread Ayush Raman
Hi, I am trying to call the R script using shell script and pass the input file as an argument to the R script. Can somebody give me some insights on this problem. Thanks. -- Regards, Ayush Raman [[alternative HTML version deleted]] __ R-hel

[R] rosavent problem

2010-04-17 Thread Kevin Turner
I have a frequency table that I am trying to plot on a rose diagram using rosavent. I've set the table up by using this line: Wind_freq_speed <- t(table(cut(Wind_Dir_vec, 0:36), cut(Wind_Speed_vec, seq(0, to=60, by=10 It produces the following table layout, which is consistent with the rosav

[R] Error when creating 2 R instances on the same context.

2010-04-17 Thread Tiago Zortea
Hello, I'm getting an error when trying to create a secound R instance on the same context, in my system R calls Fortran code that calls C++ code that ultimately call R code again, but on this secound call I get this error. Error in .Call("R_isMethodsDispatchOn", onOff, PACKAGE = "base") :

Re: [R] efficient rolling rank

2010-04-17 Thread Whit Armstrong
> library(fts) > x <- fts(data=rnorm(1e6)) > system.time(xrnk <- moving.rank(x,500)) user system elapsed 0.680.000.68 you will have to disguise your data as a time series to use fts. see below the exact implementation of rank that is used. -Whit template class Rank { publi

Re: [R] sqlite and r

2010-04-17 Thread Gabor Grothendieck
1. There is no off the shelf facility although SQLite itself allows you to write C functions and those presumably could call R but you would have to do it yourself. 2. There are also some solutions discussed here which might be good enough and are a lot easier than #1: http://code.google.com/p/sql

[R] sqlite and r

2010-04-17 Thread Wensui Liu
have used both for a while and feel they are like pea and carrot together. it is extremely handy to use sqlite engine for heavy data management from r instead of using r directly. i am also wondering if i could define and register sqlite functions within r in the way similar to how we do in python

Re: [R] Please help with min()

2010-04-17 Thread Ted Harding
On 17-Apr-10 23:14:32, Mark Na wrote: > Hello, > I have two vectors of length = 10 > > x<-c(2,14,79,27,3,126,15,1,12,4) > y<-rep(4,10) > > and I would like to create a third vector of length = 10 that > contains the smallest value at each position in the two above vectors. > > I have tried: > >

Re: [R] Please help with min()

2010-04-17 Thread Joshua Wiley
Hey Mark, I am sure there are other ways but one way would be: data <- cbind(x,y) #put the two vectors in a matrix > apply(data, 1, min) # use apply() to apply min() to each row [1] 2 4 4 4 3 4 4 1 4 4 Best regards, Josh On Sat, Apr 17, 2010 at 4:14 PM, Mark Na wrote: > Hello, > > I have t

[R] Please help with min()

2010-04-17 Thread Mark Na
Hello, I have two vectors of length = 10 x<-c(2,14,79,27,3,126,15,1,12,4) y<-rep(4,10) and I would like to create a third vector of length = 10 that contains the smallest value at each position in the two above vectors. I have tried: z<-min(x,y) but that doesn't work. With the example data a

Re: [R] Where can I find library rmutil?

2010-04-17 Thread Eduardo M. A. M.Mendes
Just after posting the question I stumbled at the site you've mentioned. Many thanks Ed From: Joshua Wiley [mailto:jwiley.ps...@gmail.com] Sent: Saturday, April 17, 2010 8:00 PM To: Eduardo M. A. M.Mendes Cc: r-h...@stat.math.ethz.ch Subject: Re: [R] Where can I find library rmutil?

Re: [R] Where can I find library rmutil?

2010-04-17 Thread Joshua Wiley
I believe you are referencing the rmutil by Lindsey. See his website ( http://www.commanster.eu/rcode.html ). Josh On Sat, Apr 17, 2010 at 3:44 PM, Eduardo M. A. M.Mendes < emammen...@gmail.com> wrote: > Hello > > I wonder whether I can find rmutil (it seem to be part of rcode or > something >

[R] Where can I find library rmutil?

2010-04-17 Thread Eduardo M. A. M.Mendes
Hello I wonder whether I can find rmutil (it seem to be part of rcode or something like that)? Many thanks Ed __ 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/p

[R] Fishy error with NAMESPACE when checking package

2010-04-17 Thread BXC (Bendix Carstensen)
I am updating the Epi package. I added functions named pc.points and pc.matpoints. Erroneously I wrote pc.plot and pc.matplot in the NAMESPACE file and of course got an error from Rcmd check. So I corrected the NAMESPACE file, but I still get from r-check: * install options are ' --no-html' Loa

Re: [R] interpreting acf plot

2010-04-17 Thread David Scott
Giovanni Azua wrote: Hello Denis, (1) I appreciate your feedback, however, I feel I have all the right to ask a specific question related R namely what's the interpretation of the acf function plot. I gave away the information that it is a homework because many times people before helping ask wh

Re: [R] bwplot puts the bars in the wrong place

2010-04-17 Thread Peter Ehlers
James, Your problem with bwplot is with your scales definition. bwplot places the plots at locations 1:24; you can then supply arbitrary labels for these locations. Try changing the following: xlim = c(-1, 24) to xlim = c(0, 25) at = hrs to at = hrs + 1 (or redefine hrs) As to needing to use

Re: [R] piecewise nls?

2010-04-17 Thread Christian Ritz
Hi Derek, have a look at the following made-up example: f1 <- function(x){2*x} f2 <- function(x){-10*x+1} x<-rnorm(10) x (x<0)*f1(x) (x>=0)*f2(x) (x<0)*f1(x) + (x>=0)*f2(x) Therefore I suggest you should specify the model as follows: yourNLSmodel <- nls(Y ~ (X=Z) * g(X,a,d,e), data = myData

Re: [R] Question regarding R plot

2010-04-17 Thread David Winsemius
On Apr 17, 2010, at 3:13 PM, Akito Y. Kawahara wrote: Thanks, this is really great! Just another quick question - if one were to calculate the mean of this curve, what command would you suggest? "Optimize" doesn't allow you to search for a mean value since it is only working on one point, and

Re: [R] Question regarding R plot

2010-04-17 Thread Akito Y. Kawahara
Thanks, this is really great! Just another quick question - if one were to calculate the mean of this curve, what command would you suggest? "Optimize" doesn't allow you to search for a mean value since it is only working on one point, and am just curious if there is a quick way to do this. Sorry

Re: [R] interpreting acf plot

2010-04-17 Thread Giovanni Azua
Hello Denis, (1) I appreciate your feedback, however, I feel I have all the right to ask a specific question related R namely what's the interpretation of the acf function plot. I gave away the information that it is a homework because many times people before helping ask what's the context for

Re: [R] how to remove one row at a time from a matrix keeping its nrow consistent

2010-04-17 Thread David Winsemius
On Apr 17, 2010, at 2:25 PM, wrote: After some headache with debugging my script, I finally isolated the problem taht I am going to illustrate in the following example. I expected matrix nrow to decrease consistently till 1. Instead, when the matrix is left with one row only, its nrow jumps

Re: [R] how to remove one row at a time from a matrix keeping its nrow consistent

2010-04-17 Thread Henrique Dallazuanna
Try this indeed of as.matrix(...) : B <- B[-1,, drop = FALSE] On Sat, Apr 17, 2010 at 3:25 PM, wrote: > After some headache with debugging my script, I finally isolated the problem taht I am going to illustrate in the following example. > I expected matrix nrow to decrease consistently till 1.

Re: [R] Question regarding R plot

2010-04-17 Thread David Winsemius
On Apr 17, 2010, at 1:18 PM, David Winsemius wrote: On Apr 17, 2010, at 12:45 PM, Charles C. Berry wrote: On Sat, 17 Apr 2010, Akito Y. Kawahara wrote: Hi, I am new to R, and have a quick question regarding an R script that I received from a kind colleague. I am trying to determine the "p

Re: [R] Frequency table

2010-04-17 Thread Kevin Turner
Thanks Robin. I used the following line, which got my table looking correct. Wind_freq_speed <- t(table(cut(Wind_Dir_vec, 0:36), cut(Wind_Speed_vec, seq(0, to=60, by=10 Unfortunately, the rosavent function produced a wind rose diagram that repeats my frequency data 6 times throughout the 360

Re: [R] how to remove one row at a time from a matrix keeping its nrow consistent

2010-04-17 Thread Ista Zahn
On Sat, Apr 17, 2010 at 7:25 PM, wrote: > After some headache with debugging my script, I finally isolated the problem > taht I am going to illustrate in the following example. > I expected matrix nrow to decrease consistently till 1. Instead, when the > matrix is left with one row only, its nr

[R] how to remove one row at a time from a matrix keeping its nrow consistent

2010-04-17 Thread mauede
After some headache with debugging my script, I finally isolated the problem taht I am going to illustrate in the following example. I expected matrix nrow to decrease consistently till 1. Instead, when the matrix is left with one row only, its nrow jumps to 2 because the matrix gets transposed.

[R] Newbie - and OSCON activities ??

2010-04-17 Thread Rich Pinder
Hello, I'm a newbie to the community, and look forward to exploring this platform for use with Genetic data analysis projects, and interfacing with RDBMS. R looks like a rich arena for both! I also found the introductory Manning book - I've used other of their 'early edition' type books, an

Re: [R] interpreting acf plot

2010-04-17 Thread Ben Bolker
Giovanni Azua gmail.com> writes: > > Hello, > > I am attending a course in Computational Statistics at > ETH and in one of the assignments I am asked to prove > that a time series is not autocorrelated using the R function "acf". > > I tried out the acf function with the given data, > accord

Re: [R] Question regarding R plot

2010-04-17 Thread David Winsemius
On Apr 17, 2010, at 12:45 PM, Charles C. Berry wrote: On Sat, 17 Apr 2010, Akito Y. Kawahara wrote: Hi, I am new to R, and have a quick question regarding an R script that I received from a kind colleague. I am trying to determine the "peak" (maximum value) of the graph that is plotted when

Re: [R] Question regarding R plot

2010-04-17 Thread Charles C. Berry
On Sat, 17 Apr 2010, Akito Y. Kawahara wrote: Hi, I am new to R, and have a quick question regarding an R script that I received from a kind colleague. I am trying to determine the "peak" (maximum value) of the graph that is plotted when executing the following. There is an input file called "r

Re: [R] bwplot puts the bars in the wrong place

2010-04-17 Thread Ben Bolker
James Rome gmail.com> writes: > ... does the call automatically assume that the variable > names are from the frame in the data= statement? Yes, it does. How about bwplot(tt~factor(OnHour,levels=0:23)|Runway,data=gdf, drop.unused.levels=FALSE) ? __

Re: [R] bwplot puts the bars in the wrong place

2010-04-17 Thread David Winsemius
On Apr 17, 2010, at 11:01 AM, James Rome wrote: Ah, Well, I thought I put up just the data needed. Sorry, was wrong file. And yes I am still climbing up the very steep learning curve hill. I attach a better data set. If it gets stripped, it is at http://dl.dropbox.com/u/537118/gdf.txt 1. I pu

Re: [R] bwplot puts the bars in the wrong place

2010-04-17 Thread Peter Ehlers
On 2010-04-17 9:01, James Rome wrote: Ah, Well, I thought I put up just the data needed. Sorry, was wrong file. And yes I am still climbing up the very steep learning curve hill. I attach a better data set. If it gets stripped, it is at http://dl.dropbox.com/u/537118/gdf.txt 1. I put the gdf$tt

[R] interpreting acf plot

2010-04-17 Thread Giovanni Azua
Hello, I am attending a course in Computational Statistics at ETH and in one of the assignments I am asked to prove that a time series is not autocorrelated using the R function "acf". I tried out the acf function with the given data, according to what I found here: http://landshape.org/enm/op

Re: [R] bwplot puts the bars in the wrong place

2010-04-17 Thread David Winsemius
After unzipping that file, http://dl.dropbox.com/u/537118/gdf.zip , I got a structure object that took what seemed to be an inordinately long time to eval-parse wehn assigned to gdf, but it did eventually produce: > str(gdf) 'data.frame': 2656 obs. of 21 variables: $ OnDate:Clas

Re: [R] bwplot puts the bars in the wrong place

2010-04-17 Thread Peter Ehlers
Well, finally we have something that we can respond to. Do note the following from the Posting Guide: # No binary attachments except for PS, PDF, and some image and archive formats (others are automatically stripped off because they can contain malicious software). Files in other formats and lar

[R] Question regarding R plot

2010-04-17 Thread Akito Y. Kawahara
Hi, I am new to R, and have a quick question regarding an R script that I received from a kind colleague. I am trying to determine the "peak" (maximum value) of the graph that is plotted when executing the following. There is an input file called "rates_values.txt" which begins as: rateValue 0.37

Re: [R] read.table behavior for Dates.

2010-04-17 Thread David Winsemius
On Apr 16, 2010, at 4:42 PM, Jeroen Ooms wrote: Ah Phil Spector is right, nothing is converted. I'm almost too embarrassed to admit it, but actually, it was Excel that tricked me. It displays date fields differently than they are stored in the csv file, and once you press 'save', it save

[R] Interacting with dendrogram plots, locator() or click()

2010-04-17 Thread David J. States
I would like to explore dendrogam plots interactively. For example, click on a node and return information about all of the children of that node. Is there a high level wrapper for locator() or click() that will return the nearest dendrogram node on a plot? If not, is there a way to obtain the

Re: [R] bwplot puts the bars in the wrong place

2010-04-17 Thread James Rome
The data are at http://dl.dropbox.com/u/537118/gdf.zip On 4/17/2010 1:42 AM, Deepayan Sarkar wrote: On Fri, Apr 16, 2010 at 1:54 PM, James Rome wrote: > Dear R-Help, > > With the attached data set, I am still getting incorrect bwplots > None of your attachments came through (presumably becaus

Re: [R] Is it ok to apply the z.test this way?

2010-04-17 Thread Atte Tenkanen
Hi, I thank you all who answered to my question. I think I learned a lot although there still remain things and concepts I have to ruminate. To the questions about the plots: In this case, I have segmented music into so-called pitch-class sets and further transformed them to 'set classes', equ

[R] adehabitat functions

2010-04-17 Thread helen . mills
Is there a way to just build a madifa function in adehabitat just using a .csv file with presences and the corresponding environmental data? I'm trying to model the species distribution of a species using 45 environmental grids and r crashes after loading just 5 of them. I'd like to develop the fun

Re: [R] Error message when trying to install Rcmdr

2010-04-17 Thread Romain Francois
Did you try to follow the advice R gives you 24 times ? Le 17/04/10 11:57, thedoctor81877 a écrit : I am trying to install Rcmdr on my ubuntu machine, but keep getting the following error messages: ERROR: failed to lock directory ‘/home/thedoctor/R/i486-pc-linux-gnu-library/2.10’ for modifying

[R] Error message when trying to install Rcmdr

2010-04-17 Thread thedoctor81877
I am trying to install Rcmdr on my ubuntu machine, but keep getting the following error messages: ERROR: failed to lock directory ‘/home/thedoctor/R/i486-pc-linux-gnu-library/2.10’ for modifying Try removing ‘/home/thedoctor/R/i486-pc-linux-gnu-library/2.10/00LOCK’ ERROR: failed to lock directory

Re: [R] how can I plot the histogram like this using R?

2010-04-17 Thread bbslover
thanks, it is ok! -- View this message in context: http://n4.nabble.com/how-can-I-plot-the-histogram-like-this-using-R-tp1839303p2013782.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.et

[R] Optimize nnet() for cross-validation error

2010-04-17 Thread l00lsupra
I would run 200 iterations of nnet() such that optimization is done for 'f', where f = error_cross_validation * (error_cross_validation / error_training_set). Any guidance on how to optimize for this per-cycle dependent variable (f) is appreciated. Thank you, supra [[alternative HTML vers