[R] a for loop to lapply

2011-03-30 Thread Alaios
Dear all, I am trying to learn lapply. I would like, as a test case, to try the lapply alternative for the Shadowlist-array(data=NA,dim=c(dimx,dimy,dimmaps)) for (i in c(1:dimx)){ Shadowlist[,,i]-i } ---so I wrote the following--- returni -function(i,ShadowMatrix) {ShadowMatrix-i}

[R] Class noquote to matrix

2011-03-30 Thread Mark Ebbert
Hi, I apologize if the solution is right in front of me, but I can't find anything on how to convert a class of 'noquote' to 'matrix'. I've tried as.matrix and I've tried coercing it by 'class(x)-matrix', but of course that didn't work. I've been using the function 'symnum' which returns an

Re: [R] Structural equation modeling in R(lavaan,sem)

2011-03-30 Thread yrosseel
On 03/29/2011 10:49 PM, jouba wrote: Dear all I have an error mesage « error message : the MLM estimator can not be used when data are incomplete » When i use the function sem(package lavaan) and when i fill the paramters estimator and missing estimator=MLM, missing=ml i understand

Re: [R] Problem with Snowball RWeka

2011-03-30 Thread Jean-Pierre Müller
Dear Forum, I have also problems Snowball (macos, fresh install of rJava, RWeka, RWekajars, Snowball from http://cran.ch.r-project.org/bin/macosx/leopard/ ): library(Snowball) example(SnowballStemmer) SnwblS ## Test the supplied vocabulary for the default stemmer ('porter'): SnwblS source -

Re: [R] a for loop to lapply

2011-03-30 Thread Andreas Borg
Hi Alaios, there are some problems with your code: 1. In the expression Shadowlist[,,i]-i, i corresponds to dimmaps, not dimx. The for loop should be either for (i in c(1:dimmaps)){ Shadowlist[,,i]-i } or for (i in c(1:dimx)){ Shadowlist[i,,]-i } 2. in lapply, the function must be

Re: [R] a for loop to lapply

2011-03-30 Thread Nick Sabbe
Hello Alex. A few issues: * you want seq(dimx) instead of seq(1:dimx) (d'oh) * I think you have problems with your dimensions in the original code as well: you use i, which runs up to dimx as an indexer for your third dimension, of size dimmaps. If dimx dimmaps, you're in for unexpected results.

Re: [R] a for loop to lapply

2011-03-30 Thread Kenn Konstabel
Hi Alex, lapply is not a substitute for for, so it not only does things differenly, it does a different thing. Shadowlist-array(data=NA,dim=c(dimx,dimy,dimmaps)) for (i in c(1:dimx)){    Shadowlist[,,i]-i } Note that your test case is not reproducible as you haven't defined dimx, dimy,

Re: [R] a for loop to lapply

2011-03-30 Thread Dieter Menne
alaios wrote: I am trying to learn lapply. I would like, as a test case, to try the lapply alternative for the Shadowlistlt;-array(data=NA,dim=c(dimx,dimy,dimmaps)) for (i in c(1:dimx)){ Shadowlist[,,i]lt;-i } ---so I wrote the following--- returni lt;-function(i,ShadowMatrix)

Re: [R] new syntax: bash-like pipe operator

2011-03-30 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 29/03/11 18:00, Gabor Grothendieck wrote: On Tue, Mar 29, 2011 at 9:56 AM, Robert Sugar robert.su...@ebi.ac.uk wrote: Dear R Community, One thing that always bugged me about R is the abundance of multi-level nested statements, like:

Re: [R] Using graphics straight from R into published articles

2011-03-30 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 29/03/11 19:52, Philipp Pagel wrote: On Tue, Mar 29, 2011 at 09:31:18AM -0700, blanco wrote: I was just wondering if people use graphics from R straight into articles or are they always edited in some way; fonts, headers, axis, color etc?

Re: [R] calculating the mode in R...

2011-03-30 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 30/03/11 02:47, Fernando Marmolejo Ramos wrote: Dear R users I?m aware that the package ?modest? is useful to find the mode in an array. However, I?d like to know if someone has translated the ?mode? function built-in in MATLAB into R

Re: [R] lattice: wireframe eats up points; how to make points on wireframe visible?

2011-03-30 Thread Deepayan Sarkar
On Fri, Mar 4, 2011 at 1:47 PM, Marius Hofert m_hof...@web.de wrote: Dear expeRts, I would like to add two points to a wireframe plot. The points have (x,y,z) coordinates where z is determined to be on the wireframe [same z-value]. Now something strange happens. One point is perfectly

Re: [R] Using graphics straight from R into published articles

2011-03-30 Thread ONKELINX, Thierry
Large snip. Absolutely vector - no jpeg, png, ... although it takes sometimes some convincing of co-authors... That depends on the kind of graph. I aggree that you should try vector at first. But when it generates very larges files (e.g. scatterplots with thousands of points) then you

Re: [R] calculating the mode in R...

2011-03-30 Thread Tal Galili
Hello Rainer and Fernando, Actually, I think this function should involve the which.max (not max): Here is a tiny function to perform this (with smarter handeling of multiple modes and giving proper warning in such cases) The.mode - function(x, show_all_modes = F) { x_freq - table(x)

Re: [R] Not all rows are being read-in

2011-03-30 Thread Philipp Pagel
On Tue, Mar 29, 2011 at 06:58:59PM -0400, Dimitri Liakhovitski wrote: I have a tab-delimited .txt file (size 800MB) with about 3.4 million rows and 41 columns. About 15 columns contain strings. Tried to read it in in R 2.12.2 on a laptop that has Windows XP:

Re: [R] Class noquote to matrix

2011-03-30 Thread Peter Ehlers
On 2011-03-29 19:12, Mark Ebbert wrote: Hi, I apologize if the solution is right in front of me, but I can't find anything on how to convert a class of 'noquote' to 'matrix'. I've tried as.matrix and I've tried coercing it by 'class(x)-matrix', but of course that didn't work. I've been using

Re: [R] Using graphics straight from R into published articles

2011-03-30 Thread Philipp Pagel
On Wed, Mar 30, 2011 at 08:48:55AM +, ONKELINX, Thierry wrote: Large snip. Absolutely vector - no jpeg, png, ... although it takes That depends on the kind of graph. I aggree that you should try vector at first. But when it generates very larges files (e.g. scatterplots with

Re: [R] Using graphics straight from R into published articles

2011-03-30 Thread Prof Brian Ripley
On Wed, 30 Mar 2011, Philipp Pagel wrote: On Wed, Mar 30, 2011 at 08:48:55AM +, ONKELINX, Thierry wrote: Large snip. Absolutely vector - no jpeg, png, ... although it takes That depends on the kind of graph. I aggree that you should try vector at first. But when it generates very

Re: [R] Using graphics straight from R into published articles

2011-03-30 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 30/03/11 11:12, Philipp Pagel wrote: On Wed, Mar 30, 2011 at 08:48:55AM +, ONKELINX, Thierry wrote: Large snip. Absolutely vector - no jpeg, png, ... although it takes That depends on the kind of graph. I aggree that you should try

[R] How to put line linking two plots

2011-03-30 Thread Mario Valle
Hello! Suppose I have three charts like below. The top chart is a general overview and the bottom charts are related so some point of this chart. To make clear this relationship I want to draw a line between (4,0.9) in the top chart and (10,1) in the bottom-left one. Currently I add it

[R] save ordinary numerical calculations as pdf

2011-03-30 Thread Maas James Dr (MED)
I'd like to save some calculation outputs as a pdf, to incorporate with others in a document. I've tried pdf(filename) name_of_object_to_output dev.off() but it doesn't seem to work, appears that this pdf function is for graphics? Is there a way to output numerical objects to pdf? Thanks J

Re: [R] Creating 3 vectors that sum to 1

2011-03-30 Thread Petr Savicky
On Tue, Mar 29, 2011 at 01:42:18PM -0600, Greg Snow wrote: Or we could expand a bit more: require(TeachingDemos) require(gtools) n - 1000 rtrg - matrix(NA, n, 3) for (i in 1:n) rtrg[i,] - diff(c(0, sort(runif(2)), 1)) rtrg2 - matrix(NA, n, 3) for (i in 1:n) { tmp - runif(3)

[R] offset in gam

2011-03-30 Thread Lucia Rueda
Hi, we are modelling dusky grouper distribution using underwater visual census. Our response variable is the abundance of groupers but we want to see differences in habitat related to maturity because dusky groupers use different habitats when they're juveniles versus adults. So we're using the %

Re: [R] calculating the mode in R...

2011-03-30 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 30/03/11 10:59, Tal Galili wrote: Hello Rainer and Fernando, Actually, I think this function should involve the which.max (not max): Right - was not awarw of which.max - I would have used which(max(...)) - which.max is much more elegant.

[R] Violin Plot - using ggplot2

2011-03-30 Thread JP
Hi there, I am trying to create a violin plot with ggplot2 (which looks awesome by the way). I am probably not understanding the code correctly by this is what I am trying (this works if you want to copy and paste it in R) library(ggplot2) p - rep(c(rep(condition_a, 4), rep(condition_b, 4)), 2)

[R] glm: modelling zeros as binary and non-zeroes as coming from a continuous distribution

2011-03-30 Thread a11msp
Hello, I'd like to implement a regression model for extremely zero-inflated continuous data using a conditional approach, whereby zeroes are modelled as coming from a binary distribution, while non-zero values are modelled as log-normal. So far, I've come across two solutions for this: one, in

[R] Loading a package without having to install it?

2011-03-30 Thread David Lindelöf
Dear UseRs, If I build an R package, is there a way to load it without having to install it? Kind regards, -- David Lindelöf, Ph.D. +41 (0)79 415 66 41 or skype:david.lindelof Better Software for Tomorrow's Cities:   http://computersandbuildings.com

Re: [R] Violin Plot - using ggplot2

2011-03-30 Thread ONKELINX, Thierry
Dear JP, Please do not cross post between lists. Here is a possible solution. library(ggplot2) p - rep(c(rep(condition_a, 4), rep(condition_b, 4)), 2) q - c(rep(grp_1, 8), rep(grp_2, 8)) r - sample(1:5, 16, rep = T) d - data.frame(p, q, r) ggplot(d, aes(x = r)) + geom_ribbon(aes(ymax =

Re: [R] Connect observed values by a smooth curve, is there any method to get coordinate value of arbitrary point on the curve?

2011-03-30 Thread Duncan Murdoch
On 11-03-29 9:32 PM, Zhipeng Wang wrote: Dear all, I have the problem as the title shows. It is time series of measurements. I want to estimate the value at time point when we have no actual measured value (Only in the time range, not for prediction in future time). Hope you could give me

Re: [R] Violin Plot - using ggplot2

2011-03-30 Thread JP
Sorry for the cross post - but I will post your answer in the other place too for completeness And thanks for your answer... that is brilliant especially the second transparent plot Fantastic On 30 March 2011 12:21, ONKELINX, Thierry thierry.onkel...@inbo.be wrote: Dear JP, Please do not

Re: [R] Dirichlet surface

2011-03-30 Thread David Winsemius
On Mar 29, 2011, at 4:45 PM, Kehl Dániel wrote: Dear list members, I want to draw surfaces of Dirichlet distributions with different parameter settings. My code is the following: #begin code a1 - a2 - a3 - 2 #a2 - .5 #a3 - .5 x1 - x2 - seq(0.01, .99, by=.01) f - function(x1, x2){

Re: [R] Connect observed values by a smooth curve, is there any method to get coordinate value of arbitrary point on the curve?

2011-03-30 Thread David Winsemius
On Mar 29, 2011, at 9:32 PM, Zhipeng Wang wrote: Dear all, I have the problem as the title shows. It is time series of measurements. I want to estimate the value at time point when we have no actual measured value (Only in the time range, not for prediction in future time). Hope you

Re: [R] glm: modelling zeros as binary and non-zeroes as coming from a continuous distribution

2011-03-30 Thread Dennis Murphy
Hi: You might want to consider hurdle models in the pscl package. HTH, Dennis On Wed, Mar 30, 2011 at 2:41 AM, a11msp absorbt...@gmail.com wrote: Hello, I'd like to implement a regression model for extremely zero-inflated continuous data using a conditional approach, whereby zeroes are

Re: [R] glm: modelling zeros as binary and non-zeroes as coming from a continuous distribution

2011-03-30 Thread Mikhail Spivakov
Hi Dennis, Thanks - these were the first things I tried, but the problem is that they refuse to work with non-count data... Mikhail On Wed, Mar 30, 2011 at 12:56 PM, Dennis Murphy djmu...@gmail.com wrote: Hi: You might want to consider hurdle models in the pscl package. HTH, Dennis On

Re: [R] glm: modelling zeros as binary and non-zeroes as coming from a continuous distribution

2011-03-30 Thread Mark Difford
On Mar 30, 2011; 11:41am Mikhail wrote: I'm wondering if there's any way to do the same in R (lme can't deal with this, as far as I'm aware). You can do this using the pscl package. Regards, Mark. -- View this message in context:

[R] wrong calculation of R-squared in summary.lm

2011-03-30 Thread Stefan Schlager
Dear all, I just stumbled upon the fact, that when I perform a regression on multivariate responses, that are not centred, I get a ricilulously high R-squared value. After reading the code of summary.lm, I found a bug in the function summary.lm: mss is calculated by: mss -sum((f -

Re: [R] glm: modelling zeros as binary and non-zeroes as coming from a continuous distribution

2011-03-30 Thread Mikhail Spivakov
Update: turns out there was a sister posting to mine two years ago: http://r.789695.n4.nabble.com/Zinb-for-Non-interger-data-td898206.html It was then suggested to use a zero-inflated distribution from the gamlss package. It turns out that they do have a zero-adjusted (albeit not strictly

[R] fonts in mosaic

2011-03-30 Thread Erich Neuwirth
I need to change the font(s) used in mosaic from package vcd. The help file and the vignette do not give very explicit examples for doing that. The easiest solution would be changing the font for everything on the graph: var labels, var names, title, subtitle, and cell labels. What is the easiest

Re: [R] maximum likelihood accuracy - comparison with Stata

2011-03-30 Thread Arne Henningsen
On 28 March 2011 17:08, Peter Ehlers ehl...@ucalgary.ca wrote: On 2011-03-27 21:37, Alex Olssen wrote: Hi everyone, I am looking to do some manual maximum likelihood estimation in R.  I have done a lot of work in Stata and so I have been using output comparisons to get a handle on what is

Re: [R] save ordinary numerical calculations as pdf

2011-03-30 Thread Robert Baer
I'm not sure about .pdf, but look at ?sink to create a text file. You could then print this as a .pdf if you so desired. Rob -- Robert W. Baer, Ph.D. Professor of Physiology Kirksville College of Osteopathic Medicine A. T. Still University of Health

Re: [R] wrong calculation of R-squared in summary.lm

2011-03-30 Thread Prof Brian Ripley
This is user error: that fit has class c(mlm, lm) and you should be calling summary() on it, which will dispatch the mlm method. For multiple-response linear models, there is also summary.manova. On Wed, 30 Mar 2011, Stefan Schlager wrote: Dear all, I just stumbled upon the fact, that when

[R] Quick recode of -999 to NA in R

2011-03-30 Thread Christopher Desjardins
Hi, I am trying to write a loop to recode my data from -999 to NA in R. What's the most efficient way to do this? Below is what I'm presently doing, which is inefficient. Thanks, Chris dat0 - read.table(time1.dat) colnames(dat0) - c(e1dq, e1arcp, e1dev, s1prcp, s1nrcp, s1ints, a1gpar,

Re: [R] Quick recode of -999 to NA in R

2011-03-30 Thread Henrique Dallazuanna
Try: dat0 - read.table('tim1.dat', na = -999) On Wed, Mar 30, 2011 at 10:15 AM, Christopher Desjardins cddesjard...@gmail.com wrote: Hi, I am trying to write a loop to recode my data from -999 to NA in R. What's the most efficient way to do this? Below is what I'm presently doing, which is

Re: [R] Quick recode of -999 to NA in R

2011-03-30 Thread Uwe Ligges
On 30.03.2011 15:15, Christopher Desjardins wrote: Hi, I am trying to write a loop to recode my data from -999 to NA in R. What's the most efficient way to do this? Below is what I'm presently doing, which is inefficient. Thanks, Chris I think read.table(na.string=-999.) is. Uwe

Re: [R] Quick recode of -999 to NA in R

2011-03-30 Thread Bernd Weiss
Am 30.03.2011 09:15, schrieb Christopher Desjardins: Hi, I am trying to write a loop to recode my data from -999 to NA in R. What's the most efficient way to do this? Below is what I'm presently doing, which is inefficient. Thanks, Chris dat0- read.table(time1.dat) colnames(dat0)- c(e1dq,

Re: [R] Quick recode of -999 to NA in R

2011-03-30 Thread Gavin Simpson
On Wed, 2011-03-30 at 08:15 -0500, Christopher Desjardins wrote: Hi, I am trying to write a loop to recode my data from -999 to NA in R. What's the most efficient way to do this? Below is what I'm presently doing, which is inefficient. Thanks, Chris dat0 - read.table(time1.dat) dat0

Re: [R] Quick recode of -999 to NA in R

2011-03-30 Thread Kenn Konstabel
It could be done in a large number of ways depending on how often you need it etc. You might take a look at defmacro in package gtools: # library(gtools) setNA - macro(df, var, values) { df$var[df$var %in% values] - NA } then instead of dat0[dat0$e1dq==-999.,e1dq] - NA you could

Re: [R] save ordinary numerical calculations as pdf

2011-03-30 Thread Henrique Dallazuanna
Take a look in ?Sweave On Wed, Mar 30, 2011 at 6:51 AM, Maas James Dr (MED) j.m...@uea.ac.uk wrote: I'd like to save some calculation outputs as a pdf, to incorporate with others in a document.  I've tried pdf(filename) name_of_object_to_output dev.off() but it doesn't seem to work,

Re: [R] How to regress data into coefficients for a gamma function

2011-03-30 Thread JLucke
Regression for the gamma distribution can be expressed as a generalized linear model. Check Chapter 8 of McCullagh, P. Nelder, J. A. (1989), Generalized linear models, Chapman Hall, London, UK. Walter Anderson wandrso...@gmail.com Sent by: r-help-boun...@r-project.org 03/29/2011 09:57

Re: [R] Not all rows are being read-in

2011-03-30 Thread Dimitri Liakhovitski
Philipp, you are a savior! That's exactly what has been happening - and it was driving me crazy. quote= fixed things. Thank you very much! Dimitri On Wed, Mar 30, 2011 at 5:01 AM, Philipp Pagel p.pa...@wzw.tum.de wrote: On Tue, Mar 29, 2011 at 06:58:59PM -0400, Dimitri Liakhovitski wrote: I

Re: [R] save ordinary numerical calculations as pdf

2011-03-30 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 30/03/11 11:51, Maas James Dr (MED) wrote: I'd like to save some calculation outputs as a pdf, to incorporate with others in a document. I've tried pdf(filename) name_of_object_to_output dev.off() but it doesn't seem to work, appears

Re: [R] Quick recode of -999 to NA in R

2011-03-30 Thread Muhammad Rahiz
Try using a loop like the following dat0 - read.table(time1.dat) id - c(e1dq, e1arcp, e1dev, s1prcp, s1nrcp,s1ints,a1gpar, a1pias, a1devt) for (a in 1:length(id)) { dat0[dat0$id[a]==-999.,as.character(id[a])] - NA } -- Muhammad Rahiz Researcher DPhil Candidate (Climate Systems

Re: [R] save ordinary numerical calculations as pdf

2011-03-30 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 30/03/11 15:42, Rainer M Krug wrote: On 30/03/11 11:51, Maas James Dr (MED) wrote: I'd like to save some calculation outputs as a pdf, to incorporate with others in a document. I've tried pdf(filename) name_of_object_to_output dev.off()

Re: [R] Quick recode of -999 to NA in R

2011-03-30 Thread Christopher Desjardins
Ah ... yes. I knew that but clearly didn't at the time of my question or script writing. Thanks, Chris On Wed, Mar 30, 2011 at 8:22 AM, Henrique Dallazuanna www...@gmail.comwrote: Try: dat0 - read.table('tim1.dat', na = -999) Ah ... yes. I knew that but clearly didn't at the time of my

Re: [R] save ordinary numerical calculations as pdf

2011-03-30 Thread Rmh
The latex() function in the Hmisc package will typeset your objects. Embed that in a tex document and run pdflatex. Rich Sent from my iPhone On Mar 30, 2011, at 5:51, Maas James Dr (MED) j.m...@uea.ac.uk wrote: I'd like to save some calculation outputs as a pdf, to incorporate with others

[R] summing values by week - based on daily dates - but with some dates missing

2011-03-30 Thread Dimitri Liakhovitski
Dear everybody, I have the following challenge. I have a data set with 2 subgroups, dates (days), and corresponding values (see example code below). Within each subgroup: I need to aggregate (sum) the values by week - for weeks that start on a Monday (for example, 2008-12-29 was a Monday). I find

[R] Using xlevels

2011-03-30 Thread Terry Therneau
I'm working on predict.survreg and am confused about xlevels. The model.frame method has the argument, but none of the standard methods (model.frame.lm, model.frame.glm) appear to make use of it. The documentation for model.matrix states: xlev: to be used as argument of model.frame if data has

Re: [R] fonts in mosaic

2011-03-30 Thread Achim Zeileis
On Wed, 30 Mar 2011, Erich Neuwirth wrote: I need to change the font(s) used in mosaic from package vcd. The help file and the vignette do not give very explicit examples for doing that. The easiest solution would be changing the font for everything on the graph: var labels, var names, title,

[R] sampling design runs with no errors but returns empty data set

2011-03-30 Thread Simon Kiss
Dear colleagues, I'm working with the 2008 Canada Election Studies (http://www.queensu.ca/cora/_files/_CES/CES2008.sav.zip), trying to construct a weighted national sample using the survey package. Three weights are included in the national survey (a household weight, a provincial weight and a

[R] VECM with UNRESTRICTED TREND

2011-03-30 Thread Grzegorz Konat
Dear All, My question is: how can I estimate VECM system with unrestricted trend (aka case 5) option as a deterministic term? As far as I know, ca.jo in urca package allows for restricted trend only [vecm - ca.jo(data, type = trace/eigen, ecdet = trend, K = n, spec = transitory/longrun)].

Re: [R] Multiple area plots to share the same x-axis

2011-03-30 Thread Werner Heijstek
I'm going to go ahead and shamelessly bump this question up the list. I saw that out of the 34 posts yesterday, only 9 did not receive an answer. Perhaps someone who finds this question trivial is checking his e-mail right now :) Werner On Tue, Mar 29, 2011 at 10:20 AM, jovian

Re: [R] Using xlevels

2011-03-30 Thread Prof Brian Ripley
On Wed, 30 Mar 2011, Terry Therneau wrote: I'm working on predict.survreg and am confused about xlevels. The model.frame method has the argument, but none of the standard methods (model.frame.lm, model.frame.glm) appear to make use of it. But I see this in predict.lm: m -

Re: [R] Multiple area plots to share the same x-axis

2011-03-30 Thread Ista Zahn
Use facetting: sets - rbind(cbind(set=set1, set), cbind(set=set2, set2)) ggplot(sets, aes(x = time, y = hours)) + geom_area(colour = 'red', fill = 'red', alpha = 0.5) + geom_area(stat = 'smooth', span = 0.2, alpha = 0.3) + ylim(0,40) + facet_grid(set ~ .) Best, Ista On Wed, Mar 30, 2011

Re: [R] Degrees of freedom for lm in logLik and AIC

2011-03-30 Thread peter dalgaard
On Mar 28, 2011, at 16:53 , Ben Bolker wrote: Rubén Roa rroa at azti.es writes: However, shouldn't _free parameters_ only be counted for degrees of freedom and for calculation of AIC? The sigma parameter is profiled out in a least-squares linear regression, so it's not free, it's

Re: [R] VECM with UNRESTRICTED TREND

2011-03-30 Thread Pfaff, Bernhard Dr.
Hello Greg, you can exploit the argument 'dumvar' for this. See ?ca.jo Best, Bernhard -Ursprüngliche Nachricht- Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Im Auftrag von Grzegorz Konat Gesendet: Mittwoch, 30. März 2011 16:46 An: r-help@r-project.org

Re: [R] Quick recode of -999 to NA in R

2011-03-30 Thread peter dalgaard
On Mar 30, 2011, at 16:05 , Christopher Desjardins wrote: dat0 - read.table('tim1.dat', na = -999) Ah ... yes. I knew that but clearly didn't at the time of my question or script writing. Thanks, Chris Depending on where your data came from, you could get caught by the fact that the

Re: [R] Quick recode of -999 to NA in R

2011-03-30 Thread Clint Bowman
Amen. Ditto for -999.000, -999.00 and all of the other ones that various (usually Fortran) programmers have used. Has the most recent Fortran standard come around to understanding NA? -- Clint BowmanINTERNET: cl...@ecy.wa.gov Air Quality Modeler

[R] Multistep forecasting with neural networks

2011-03-30 Thread Sara Szeremeta
HI! Would anybody suggest what function/package/method can I use to obtain forecasts for horizons longer than 1 period ahead? I want to do multistep forecasts with multilayer feedforward networks. I have tried several packages, but it turned out that the functions yield only one-step

[R] optim and optimize are not finding the right parameter

2011-03-30 Thread Dimitri Liakhovitski
Dear all, I have a function that predicts DV based on one predictor pred: pred-c(0,300,780,1560,2340,13120) DV-c(0,500,1000,1400,1700,1900) ## I define Function 1 that computes the predicted value based on pred values and parameters a and b: calc_DV_pred - function(a,b) {

Re: [R] Quick recode of -999 to NA in R

2011-03-30 Thread Gabor Grothendieck
On Wed, Mar 30, 2011 at 11:51 AM, peter dalgaard pda...@gmail.com wrote: On Mar 30, 2011, at 16:05 , Christopher Desjardins wrote: dat0 - read.table('tim1.dat', na = -999) Ah ... yes. I knew that but clearly didn't at the time of my question or script writing. Thanks, Chris Depending

Re: [R] summing values by week - based on daily dates - but with somedates missing

2011-03-30 Thread Martyn Byng
Hi, How about something like: sum.by.day - function(ff) { by.day - split(ff$value,weekdays(ff$dates)) lapply(by.day,sum) } by.grp - split(myframe,myframe$group) lapply(by.grp,sum.by.day) Martyn -Original Message- From: r-help-boun...@r-project.org

Re: [R] Dirichlet surface

2011-03-30 Thread Kehl Dániel
Dear David, I think that is a small bug too, maybe because the function is constant? is there a nice way to put the c(0,2.1) argument optionally, only if all the parameters are 1? Should I post the problem somewhere else (developers maybe?) thanks: Daniel 2011-03-30 04:42 keltezéssel, David

Re: [R] summing values by week - based on daily dates - but with somedates missing

2011-03-30 Thread Dimitri Liakhovitski
Thank you, Martyn. But it looks like this way we are getting sums by day - i.e., across all Mondays, all Tuesdays, etc. Maybe I did not explain well, sorry! The desired output would contain sums for each WHOLE week - across all days that comprise that week - Monday through Sunday. Makes sense?

Re: [R] optim and optimize are not finding the right parameter

2011-03-30 Thread Bert Gunter
Not sure it's the case here, but numeric optimizers are well-known to be subject to scaling issues. -- Bert On Wed, Mar 30, 2011 at 9:45 AM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Dear all, I have a function that predicts DV based on one predictor pred:

Re: [R] Quick recode of -999 to NA in R

2011-03-30 Thread Christopher Desjardins
On Wed, Mar 30, 2011 at 10:51 AM, peter dalgaard pda...@gmail.com wrote: On Mar 30, 2011, at 16:05 , Christopher Desjardins wrote: dat0 - read.table('tim1.dat', na = -999) Ah ... yes. I knew that but clearly didn't at the time of my question or script writing. Thanks, Chris

Re: [R] Using xlevels

2011-03-30 Thread Terry Therneau
I see the logic now. I think that more sentences in the document would be very helpful, however. What is written is very subtle. I suggest the following small expansion for model.matrix.Rd: \item{data}{a data frame. If the object has a \code{terms} attribute then it is assumed to be the

Re: [R] Quick recode of -999 to NA in R

2011-03-30 Thread Marc Schwartz
On Mar 30, 2011, at 11:52 AM, Gabor Grothendieck wrote: On Wed, Mar 30, 2011 at 11:51 AM, peter dalgaard pda...@gmail.com wrote: On Mar 30, 2011, at 16:05 , Christopher Desjardins wrote: dat0 - read.table('tim1.dat', na = -999) Ah ... yes. I knew that but clearly didn't at the time

Re: [R] Dirichlet surface

2011-03-30 Thread Gavin Simpson
On Wed, 2011-03-30 at 09:55 -0700, Kehl Dániel wrote: Dear David, I think that is a small bug too, maybe because the function is constant? is there a nice way to put the c(0,2.1) argument optionally, only if all the parameters are 1? Should I post the problem somewhere else (developers

Re: [R] Dirichlet surface

2011-03-30 Thread Kehl Dániel
It helped a lot indeed, thank you very much! Now I understand why it was a problem for persp! Daniel 2011-03-30 10:31 keltezéssel, Gavin Simpson írta: On Wed, 2011-03-30 at 09:55 -0700, Kehl Dániel wrote: Dear David, I think that is a small bug too, maybe because the function is constant? is

Re: [R] optim and optimize are not finding the right parameter

2011-03-30 Thread Ravi Varadhan
Try this: pred - pred/1e06 DV - DV/1e03 opt1 - optim(fn=my.function, par=1.0) opt2 - optim(fn=my.function, par=1.0, method=BFGS) opt3 - optim(fn=my.function, par=1.0, method=L-BFGS-B, lower=0, upper=1) opt1 opt2 opt3 Ravi. --- Ravi Varadhan,

Re: [R] Dirichlet surface

2011-03-30 Thread Kehl Dániel
Actually, it works for the a=1 case, not for the others. It still gives the invalid 'zlim argument' error. I'll try to work it out maybe instead of NULL giving a c which is dependent on the max(z). Daniel 2011-03-30 10:42 keltezéssel, Kehl Dániel írta: It helped a lot indeed, thank you very

Re: [R] Using xlevels

2011-03-30 Thread William Dunlap
Terry, The fact that model.frame attaches xlevels to the terms based on factors in the input data.frame (and attaches dataClass based on the input data.frame), but the subsequent call to model.matrix is responsible for turning character vectors in the data.frame into factors (and then into

Re: [R] fonts in mosaic

2011-03-30 Thread Erich Neuwirth
Achim I simply want to replace the font R uses on mosaic (whatever it is) by a font of my choice (say Calibri or Arial) because I need to embed the R charts in a PowerPoint presentation and want the fonts to match. And I want the most simple way of accomplishing this. I worked my way through the

Re: [R] optim and optimize are not finding the right parameter

2011-03-30 Thread Dimitri Liakhovitski
Thank you, Ravi - definitely better! On Wed, Mar 30, 2011 at 2:06 PM, Ravi Varadhan rvarad...@jhmi.edu wrote: Try this: pred - pred/1e06 DV - DV/1e03 opt1 - optim(fn=my.function, par=1.0) opt2 - optim(fn=my.function, par=1.0, method=BFGS) opt3 - optim(fn=my.function, par=1.0,

Re: [R] fonts in mosaic

2011-03-30 Thread Henrique Dallazuanna
Try this: windowsFonts(calibri = windowsFont(Calibri)) mosaic(UCBAdmissions, labeling_args = list( gp_labels = gpar(fontsize = 12, fontfamily = calibri), gp_varnames = gpar(fontsize = 16, fontfamily = calibri) )) On Wed, Mar 30, 2011 at 3:25 PM, Erich Neuwirth erich.neuwi...@univie.ac.at

Re: [R] save ordinary numerical calculations as pdf

2011-03-30 Thread baptiste auguie
Hi, If you want grid graphics: For data.frames and matrices, gridExtra has a grid.table() function. For strings (paragraph), Rgraphics has a function too, whose name i forget. It could be possible to combine the two and define a method to display lists as well. HTH, baptiste On 30 March

Re: [R] Dirichlet surface

2011-03-30 Thread Gavin Simpson
On Wed, 2011-03-30 at 11:12 -0700, Kehl Dániel wrote: Actually, it works for the a=1 case, not for the others. It still gives the invalid 'zlim argument' error. I'll try to work it out maybe instead of NULL giving a c which is dependent on the max(z). Sorry, I misread the helpfile - the

Re: [R] fonts in mosaic

2011-03-30 Thread Achim Zeileis
On Wed, 30 Mar 2011, Erich Neuwirth wrote: Achim I simply want to replace the font R uses on mosaic (whatever it is) by a font of my choice (say Calibri or Arial) because I need to embed the R charts in a PowerPoint presentation and want the fonts to match. Ah, ok, sorry I misread your mail.

Re: [R] summing values by week - based on daily dates - but with some dates missing

2011-03-30 Thread Henrique Dallazuanna
Try this: aggregate(value ~ group + format(dates, %Y.%W), myframe, FUN = sum) On Wed, Mar 30, 2011 at 11:23 AM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Dear everybody, I have the following challenge. I have a data set with 2 subgroups, dates (days), and corresponding

Re: [R] Using graphics straight from R into published articles

2011-03-30 Thread blanco
Wow - thanks all for your helpful replies. Awesome forum. Am I right to assume that you use the postscript function to create .ps and .pdf files from R? blanco -- View this message in context:

[R] How to define new operator in R?

2011-03-30 Thread Chuanlong Du
Hello, everyone! Does anyone know how make some symbols have special means in R? For example, we know that + in R means the sum of the two operand on its left and right. I want to define some operators in R by myself. Is this possible? Regards! -- Chuanlong Du Department of Statistcis Iowa

[R] How can we modify attributes of files in Windows Systems using R?

2011-03-30 Thread Chuanlong Du
Hello! Does any one know how to modify attributes of files (hide, read only and etc) in Windows Systems using R? I tried to use shell to call system command, but it seems that it doesn't work well. Sometimes it works but sometimes not. Regards! -- Chuanlong Du Department of Statistcis Iowa

[R] Noble America Announcement for Summer Internship 2011

2011-03-30 Thread Wang Yu
# Noble America Announcement for Summer Internship 2011 ## Organization Name: Noble America, http://www.thisisnoble.com/ Location: Stamford, Connecticut, USA Period: 10-12 Weeks for

[R] Is there a function to save the content in R console to some file?

2011-03-30 Thread Chuanlong Du
Hello, everyone! Does anyone know whether there's a function in R which can save the content in R console to some file? I'm using Windows system and the usual R console instead of Rstudio. Regards! -- Chuanlong Du Department of Statistcis Iowa State University Ames, IA, US 50011

[R] postscript rotation (bug?)

2011-03-30 Thread Wayne Lee
Dear Marc, Your answer on post https://stat.ethz.ch/pipermail/r-help/2005-March/067634.html has a broken link. Thank you, W __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] VECM with UNRESTRICTED TREND

2011-03-30 Thread Grzegorz Konat
Hello Bernhard, Thank You very much. Unfortunately I'm still not really sure how should I use dummy vars in this context... If I have a system of three variables (x, y, z), lag order = 2 and 1 cointegrating relation, what should I do? I mean, what kind of 'pattern' should be used to create those

Re: [R] Class noquote to matrix

2011-03-30 Thread Mark Ebbert
I knew there had to be a simple solution. Thank you! On Mar 30, 2011, at 3:04 AM, Peter Ehlers wrote: On 2011-03-29 19:12, Mark Ebbert wrote: Hi, I apologize if the solution is right in front of me, but I can't find anything on how to convert a class of 'noquote' to 'matrix'. I've tried

Re: [R] How to define new operator in R?

2011-03-30 Thread David Winsemius
On Mar 30, 2011, at 11:04 AM, Chuanlong Du wrote: Hello, everyone! Does anyone know how make some symbols have special means in R? For example, we know that + in R means the sum of the two operand on its left and right. I want to define some operators in R by myself. Is this possible?

Re: [R] postscript rotation (bug?)

2011-03-30 Thread Marc Schwartz
On Mar 30, 2011, at 11:51 AM, Wayne Lee wrote: Dear Marc, Your answer on post https://stat.ethz.ch/pipermail/r-help/2005-March/067634.html has a broken link. Thank you, W Wayne, here is the original thread being referenced from March of 2005:

Re: [R] Using graphics straight from R into published articles

2011-03-30 Thread Philipp Pagel
On Wed, Mar 30, 2011 at 09:56:09AM -0700, blanco wrote: Wow - thanks all for your helpful replies. Awesome forum. Am I right to assume that you use the postscript function to create .ps and .pdf files from R? almost: postscript(..., onefile=FALSE) # for eps pdf() # for PDF And don't

  1   2   >