Re: [R] zero truncated poisson regression

2011-08-01 Thread Achim Zeileis
On Sun, 31 Jul 2011, Iasonas Lamprianou wrote: Thanks Pscl seems to be a sensible option. I have the counts variable with the name N. This variable can only take values bigger than zero! I have two explanatory variables with the names type and diam but when I run hpm - hurdle(n ~

Re: [R] Use dump or write? or what?

2011-08-01 Thread Dieter Menne
oaxacamatt wrote: I am calculating two t-test values for each of many files then save it to file calculate another set and append, repeat. You did not tell use what you want to do with the data in the file. If you just want a copy of the output, bracketing with sink(file) and sink() can be

Re: [R] Use dump or write? or what?

2011-08-01 Thread Jeffrey Dick
Hi Matt, I assume that you want a tabular text file of the results. Since I don't know what your tempA and tempB are I'll steal some examples from ?t.test t.example.1 - t.test(1:10,y=c(7:20)) t.example.2 - t.test(1:10,y=c(7:20, 200)) Now looking at ?dump, the first argument needs to be

[R] Help with modFit of FME package

2011-08-01 Thread Paola Lecca
Dear R users, I'm trying to fit a set an ODE to an experimental time series. In the attachment you find the R code I wrote using modFit and modCost of FME package and the file of the time series. When I run summary(Fit) I obtain this error message, and the values of the parameters are equal to

Re: [R] Plot frame color and linewidth

2011-08-01 Thread Dieter Menne
marcel wrote: I have a figure with a lattice plot and a basic plot. Is there a way to select the color and line width of the surrounding boxes for each of these? I could not find any documentation on this. Thanks for providing a nice self-contained example. There was nothing wrong

Re: [R] export/import matrix

2011-08-01 Thread Dieter Menne
Rosario Garcia Gil-2 wrote: I have a problem on keeping the format when I export a matrix file with the write.table() function. When I import the data volcano from rgl package it looks like this in R: data[1:5,] [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]

Re: [R] Problems with ks.test()

2011-08-01 Thread Peter Ehlers
(I'm replying to your original post because your follow-up omits the context.) The K-S test is designed for continuous distributions. You have far too many zeros in your data to get anything reasonable out of the test. For your data, the K-S statistic is the difference in the (e)cdfs at zero.

[R] Beta fit returns NaNs

2011-08-01 Thread baxy77
Hi, sorry for repeating the question but this is kind of important to me and i don't know whom should i ask. So as noted before when I do a parameter fit to the beta distr i get: fitdist(vectNorm,beta); Fitting of the distribution ' beta ' by maximum likelihood Parameters: estimate

Re: [R] zero truncated poisson regression

2011-08-01 Thread Iasonas Lamprianou
Thank you, it works! And the estimates (as well as the standard errors) seem to be more reasonable now, compared to the normal Poisson model. Thank you. However, I tried to find a manual  (although I did manage to find the paper published in the Journal of Statistical Software. For example, how

Re: [R] Beta fit returns NaNs

2011-08-01 Thread peter dalgaard
On Aug 1, 2011, at 10:33 , baxy77 wrote: Hi, sorry for repeating the question but this is kind of important to me and i don't know whom should i ask. So as noted before when I do a parameter fit to the beta distr i get: fitdist(vectNorm,beta); Fitting of the distribution ' beta '

Re: [R] Beta fit returns NaNs

2011-08-01 Thread Peter Ehlers
On 2011-08-01 01:33, baxy77 wrote: Hi, sorry for repeating the question but this is kind of important to me and i don't know whom should i ask. So as noted before when I do a parameter fit to the beta distr i get: fitdist(vectNorm,beta); Fitting of the distribution ' beta ' by maximum

Re: [R] Spatial Data Interpolation

2011-08-01 Thread Paul Hiemstra
Dear Peter, The spatial taskview lists a number of interpolation methods [1]. Some of those support spatio-temporal interpolation. For example gstat supports spatio-temporal kriging [2,3,4]. regards, Paul [1] http://cran.r-project.org/web/views/Spatial.html [2]

Re: [R] Beta fit returns NaNs

2011-08-01 Thread baxy77
yes it is the fitdistrplus package. Sorry form not mentioning it earlier. Usually i do those things but this time it somehow slipped my mind , sorry and Thank you both! -- View this message in context: http://r.789695.n4.nabble.com/Beta-fit-returns-NaNs-tp3709139p3709277.html Sent from the R

Re: [R] Legend for 2 plots on same screen

2011-08-01 Thread Jim Lemon
On 08/01/2011 04:52 AM, Cheryl Johnson wrote: Hello, I have two plots on the same screen. I use the command par(mfrow=c(1,2)) in order to do this. When I try to make a legend for both plots, it only puts the legend in the plot on the right side. If I would like a legend that is outside of both

Re: [R] R-help Digest, Vol 102, Issue 1

2011-08-01 Thread fraenzi . korner
Wir sind bis am 20. August in den Ferien und werden keine e-mails beantworten. Bei dringenden Fällen melden Sie sich bei Stefanie von Felten steffi.vonfel...@oikostat.ch We are on vacation until 20. August. In urgent cases, please contact Stefanie von Felten steffi.vonfel...@oikostat.ch

[R] axes label

2011-08-01 Thread ogbos okike
Dear All, I am trying to put 10^-8 st km^-2day^-1 on x-axis of my plot. I tried using : ylab = expression(paste(st / , plain(km)^2, / day)) to see if I can at least get the unit before thinking about the power of 10 (10^-8). However, ylab = expression(paste(st / , plain(km)^2, / day)) didn't

Re: [R] Save generic plot to file (before rendering to device)

2011-08-01 Thread Jeroen Ooms
Bumping this one up because the 'before.plot.new' solution turned out to be sub-optimal after all. It should be possible to do this with a before.plot.new hook, right? Yes, sure, if you treat the first and last plot separately. It turns out that the before.plot.new hook does not is not

Re: [R] help with algorithm

2011-08-01 Thread Paul Hiemstra
On 07/31/2011 05:57 PM, r student wrote: I'm wondering if anyone can give some basic advice about how to approach a specific task in R. I'm new to R but have used SAS for many years, and while I can muscle through a lot of the code details, I'm unsure of a few things. Specific questions:

[R] Odp: converting factor to numeric gives NAs introduced by coercion

2011-08-01 Thread Petr PIKAL
Hi Hi, I have a dataframe that I imported from a .txt file by: skogTemp - read.delim2(Skogaryd_shoot_data.txt, header=TRUE, fill=TRUE) and the data are factors, how can avoid factors from the beginning? Although the file contains both characters and numbers. You have got an answer

Re: [R] axes label

2011-08-01 Thread Peter Ehlers
On 2011-08-01 03:32, ogbos okike wrote: Dear All, I am trying to put 10^-8 st km^-2day^-1 on x-axis of my plot. I tried using : ylab = expression(paste(st / , plain(km)^2, / day)) to see if I can at least get the unit before thinking about the power of 10 (10^-8). However, ylab =

[R] ivreg and structural change

2011-08-01 Thread 敷田治誠 クラウジオ
Hello, I am looking for some help with this question: how could I test structural breaks in a instrumental variables´s model? For example, I was trying to do something with my model with three time series. tax_ivreg - ivreg(l_y ~ l_x2 + l_x1+ dl_y | lag(l_x2, -1)+lag(l_x2, -2)+ lag(l_x1,

Re: [R] Help with modFit of FME package

2011-08-01 Thread David Winsemius
On Aug 1, 2011, at 3:41 AM, Paola Lecca wrote: Dear R users, I'm trying to fit a set an ODE to an experimental time series. In the attachment you find the R code I wrote using modFit and modCost of FME package and the file of the time series. This is getting a bit tiresome. None of the

[R] Help with modFit of FME package 2

2011-08-01 Thread Paola Lecca
* Apologies for multiple posting * I attached to my previous e-mail a .r file, and it was not permitted by the rules of the mailing lis. Again, please receive my sincere apologies for this. I re-send again the e-mail with .txt attachemnt in the hope someone an help me to solve my problem. I'm

Re: [R] Odp: converting factor to numeric gives NAs introduced by coercion

2011-08-01 Thread jim holtman
If you are not going to be using factors, then you can keep everything a character (if there are non-numerics in a column) by adding 'as.is=TRUE' as a parameter on the 'rad.table' functions. On Mon, Aug 1, 2011 at 7:55 AM, Petr PIKAL petr.pi...@precheza.cz wrote: Hi Hi, I have a dataframe

Re: [R] export/import matrix

2011-08-01 Thread David Winsemius
On Jul 31, 2011, at 7:54 PM, Rosario Garcia Gil wrote: Hello I have a problem on keeping the format when I export a matrix file with the write.table() function. The quick answer is ... don't do that. Use save() if you want to preserve the attributes of an R object. And that especially

Re: [R] export/import matrix

2011-08-01 Thread jim holtman
If you are just exporting it so you can read it back into R later, it is better to use save/load since it keep the data in the internal format so it will look the same. Can you describe what you are going to be doing with the data that you 'export'; that might help us come up with a solution to

Re: [R] Use dump or write? or what?

2011-08-01 Thread jim holtman
Can you define better exactly what you what to do with the data. I would suggest that you keep each of the outputs (objects) of the test in a 'list' that way you can access each one and do what you need. You can also 'save' the list and later 'load' it into another session. On Sun, Jul 31, 2011

Re: [R] Is R the right choice for simulating first passage times of random walks?

2011-08-01 Thread Paul Menzel
Am Sonntag, den 31.07.2011, 23:32 -0500 schrieb R. Michael Weylandt : Glad to help -- I haven't taken a look at Dennis' solution (which may be far better than mine), but if you do want to keep going down the path outlined below you might consider the following: I will try Dennis’ solution

[R] Problem Fixed: axes label

2011-08-01 Thread ogbos okike
Hi Peter, Many thanks. It worked. Regards Ogbos On 1 August 2011 14:05, Peter Ehlers ehl...@ucalgary.ca wrote: On 2011-08-01 03:32, ogbos okike wrote: Dear All, I am trying to put 10^-8 st km^-2day^-1 on x-axis of my plot. I tried using : ylab = expression(paste(st / , plain(km)^2, /

Re: [R] Use dump or write? or what?

2011-08-01 Thread Matt Curcio
Greetings all, Thanks for all your help so far. Let me give a better idea of what I am doing. I have hundreds of files that I need to plow thru with a t-test and correlation test. BTW, 'tempA' and tempB' are simply columns of numbers from a gene-chip experiment that spits out dna 'amounts'. So I

[R] formula used by R to compute the t-values in a linear regression

2011-08-01 Thread Samuel Le
Hello, I was wondering if someone knows the formula used by the function lm to compute the t-values. I am trying to implement a linear regression myself. Assuming that I have K variables, and N observations, the formula I am using is: For the k-th variable, t-value= b_k/sigma_k With

Re: [R] formula used by R to compute the t-values in a linear regression

2011-08-01 Thread David Winsemius
On Aug 1, 2011, at 9:27 AM, Samuel Le wrote: Hello, I was wondering if someone knows the formula used by the function lm to compute the t-values. I am trying to implement a linear regression myself. Assuming that I have K variables, and N observations, the formula I am using is: For

Re: [R] formula used by R to compute the t-values in a linear regression

2011-08-01 Thread peter dalgaard
On Aug 1, 2011, at 15:27 , Samuel Le wrote: Hello, I was wondering if someone knows the formula used by the function lm to compute the t-values. I am trying to implement a linear regression myself. Assuming that I have K variables, and N observations, the formula I am using

Re: [R] Reading name-value data

2011-08-01 Thread Hadley Wickham
Yes! Would you mind filing an issue so I dont forget? Hadley On Friday, July 29, 2011, Stavros Macrakis macra...@alum.mit.edu wrote: Perfect! Thanks! By the way, I see that, unlike base rbind, it does not work for vectors and lists: rbind(c(a=1),c(b=2)) =

Re: [R] formula used by R to compute the t-values in a linear regression

2011-08-01 Thread S Ellison
-Original Message- [mailto:r-help-boun...@r-project.org] On Behalf Of Samuel Le Subject: [R] formula used by R to compute the t-values in a linear regression I was wondering if someone knows the formula used by the function lm to compute the t-values. Typing summary.lm I

Re: [R] formula used by R to compute the t-values in a linear regression

2011-08-01 Thread Samuel Le
Exactly. My formula holds only for k=1, this is how I generated it. Do you have any references concerning the rather more careful algorithms? Thanks, Samuel -Original Message- From: peter dalgaard [mailto:pda...@gmail.com] Sent: 01 August 2011 14:45 To: Samuel Le Cc:

Re: [R] formula used by R to compute the t-values in a linear regression

2011-08-01 Thread Samuel Le
Yes, that's what I was looking for. Many thanks, Samuel -Original Message- From: S Ellison [mailto:s.elli...@lgcgroup.com] Sent: 01 August 2011 15:16 To: Samuel Le; r-h...@stat.math.ethz.ch Subject: RE: formula used by R to compute the t-values in a linear regression -Original

[R] General indexing in multidimensional arrays

2011-08-01 Thread Jannis
Dear R community, I have a general question regarding indexing in multidiemensional arrays. Imagine I have a three dimensional array and I only want to extract on vector along a single dimension from it: data- array(rnorm(64),dim=c(4,4,4)) result - data[1,1,] If I want to extract

Re: [R] memory problem; Error: cannot allocate vector of size 915.5 Mb

2011-08-01 Thread Dimitris.Kapetanakis
Thanks a lot for the help. Actually, I am using a mac which (R for Mac OS X GUI 1.40-devel Leopard build 32-bit (5751)) but I think I can find access on windows 7 64-bit. What I am trying to do is a maximization through grid search (because I am not sure that any of the optim() methods works

[R] Problem with gam()

2011-08-01 Thread pjura
Dear group, I experience some problems with gam() function after R update to version 2.13.1 The function in both gam and mgcv packages stopped to work. Before, with the same code I used, everything was fine. The function from gam package yields following warning: Residual degrees of freedom are

[R] Problem with gam() after R update

2011-08-01 Thread Przemek Jura
Dear group, I experience some problems with gam() function after R update to version 2.13.1 The function in both gam and mgcv packages stopped to work. Before, with the same code I used, everything was fine. The function from gam package yields following warning: Residual degrees of freedom

[R] Plotting question

2011-08-01 Thread Andrew McCulloch
Hi, I use R to draw my graphs. I have 100 points on a simple xy-plot. The points are distinguished by a third variable which is categorical with 10 levels. I have been plotting x against y and using gray scales to distinguish the level of the categorical variable for each point. It looks ok

[R] How to colour specific edges in a dendrogram

2011-08-01 Thread Jan Teichmann
Dear Mailing-list I used hclust to make a dendrogram of 2613 leafs. I also have a list with the names of certain labels which are of interest and I would like to visualize their appearance within the dendrogram. I found an example how to use dendrapply to colour the labels but the problem is that

[R] Impact of multiple imputation on correlations

2011-08-01 Thread lifty . gere
Dear all, I have been attempting to use multiple imputation (MI) to handle missing data in my study. I use the mice package in R for this. The deeper I get into this process, the more I realize I first need to understand some basic concepts which I hope you can help me with. For example, let

Re: [R] [R-Forge] R 2.13.1 can't find package binaries on R-Forge

2011-08-01 Thread Stefan Theussl
Dear all, this must have been a temporary problem. In this case I assume that the build cycle did not finish in time, i.e., binaries were synced to the staging area although not all were built. best, stefan On 07/31/2011 05:52 PM, David Winsemius wrote: On Jul 31, 2011, at 11:26 AM,

Re: [R] General indexing in multidimensional arrays

2011-08-01 Thread Duncan Murdoch
On 11-08-01 5:38 AM, Jannis wrote: Dear R community, I have a general question regarding indexing in multidiemensional arrays. Imagine I have a three dimensional array and I only want to extract on vector along a single dimension from it: data- array(rnorm(64),dim=c(4,4,4)) result-

[R] error message jpeg62.dll missing

2011-08-01 Thread Rocky Hyacinth
Dear R-help We are getting an error message `jpeg62.dll missing'. We are running Windows 7 64-bit, from a Mac using Boot Camp. Do you know of this error message, and can you give us help trying to resolve the problem? many thanks Rocky Rocky Hyacinth Technician Department of Archaeology

Re: [R] Plotting question

2011-08-01 Thread Duncan Murdoch
On 11-08-01 5:44 AM, Andrew McCulloch wrote: Hi, I use R to draw my graphs. I have 100 points on a simple xy-plot. The points are distinguished by a third variable which is categorical with 10 levels. I have been plotting x against y and using gray scales to distinguish the level of the

Re: [R] fitting a sinus curve

2011-08-01 Thread Marianne.ZEYRINGER
Dear David and Hans- Werner, Thank you very much for your help. I would like to compare now if a polynomial or the sinus model fits better. How can I see R-squared or the F- Statistic for the sinus regression, so as to be able to compare it with the polynomial model? Thanks a lot and have a nice

Re: [R] memory problem; Error: cannot allocate vector of size 915.5 Mb

2011-08-01 Thread David Winsemius
On Aug 1, 2011, at 3:04 AM, Dimitris.Kapetanakis wrote: Thanks a lot for the help. Actually, I am using a mac which (R for Mac OS X GUI 1.40-devel Leopard build 32-bit (5751)) but I think I can find access on windows 7 64- bit. I don't think that was what Holtman was advising. You just

Re: [R] Plotting problems directional or rose plots

2011-08-01 Thread kitty
Hi again, I have tried playing around with the code given to me by Alan and Jim, thank you for the code but unfortunatelyI can't seem to get either of them to work... Alans does not work with the sample data and Jims is giving the error : Error in radial.grid(labels = labels, label.pos =

Re: [R] General indexing in multidimensional arrays

2011-08-01 Thread David Winsemius
On Aug 1, 2011, at 10:50 AM, Duncan Murdoch wrote: On 11-08-01 5:38 AM, Jannis wrote: Dear R community, I have a general question regarding indexing in multidiemensional arrays. Imagine I have a three dimensional array and I only want to extract on vector along a single dimension

Re: [R] Reorganize(stack data) a dataframe inducing names

2011-08-01 Thread Francesca
Dear Contributors thanks for any help you can provide. I searched the threads but I could not find any query that satisfied my needs. This is my database: index time values 13732 27965 DATA.Q211.SUM.Index04/08/11 1.42 13733 27974 DATA.Q211.SUM.Index05/10/11 1.45

Re: [R] Plotting question

2011-08-01 Thread Gene Leynes
plot(1:10, pch=letters[1:10]) On Mon, Aug 1, 2011 at 4:44 AM, Andrew McCulloch amccu...@yahoo.co.ukwrote: Hi, I use R to draw my graphs. I have 100 points on a simple xy-plot. The points are distinguished by a third variable which is categorical with 10 levels. I have been plotting x

[R] Write.table Question

2011-08-01 Thread Margaux Keller
Hi, I'm trying to create an abbreviated data file from a larger version. I can use the subset command to create a value for this data: dat -subset(raw.data, select=c(SNP, Pvalue)) head (dat) SNP Pvalue 1 rs11 0.6516 2 rs12 0.3311 3 rs13 0.5615 but when I try to write.table using:

[R] 5 arguments passed to .Internal(matrix) which requires 7

2011-08-01 Thread Robert Pfister
Hello, I am having a problem with the function matrix. Specifically, when I pass three arguments (two more being instantiated in the function), I get the following error message: Error in matrix(0, 30, 10) : 5 arguments passed to .Internal(matrix) which requires 7 I looked into it, and

Re: [R] Problem with gam() after R update

2011-08-01 Thread David Winsemius
On Aug 1, 2011, at 5:01 AM, Przemek Jura wrote: Dear group, I experience some problems with gam() function after R update to version 2.13.1 The function in both gam and mgcv packages stopped to work. Before, with the same code I used, everything was fine. Reports like this often turn

Re: [R] Plotting question

2011-08-01 Thread Bert Gunter
IMHO: On Mon, Aug 1, 2011 at 7:51 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 11-08-01 5:44 AM, Andrew McCulloch wrote: Hi, I use R to draw my graphs. I have 100 points on a simple xy-plot. The points are distinguished by a third variable which is categorical with 10 levels. I

Re: [R] General indexing in multidimensional arrays

2011-08-01 Thread Gene Leynes
What do you think about this? apply(data, 3, '[', indices) On Mon, Aug 1, 2011 at 4:38 AM, Jannis bt_jan...@yahoo.de wrote: Dear R community, I have a general question regarding indexing in multidiemensional arrays. Imagine I have a three dimensional array and I only want to extract on

Re: [R] Write.table Question

2011-08-01 Thread Ivan Calandra
Hi Margaux, Check the row.names and col.names arguments of write.table. See ?write.table write.table (dat, file = /path/to/my/data.txt, sep = , col.names=FALSE, row.names=FALSE) HTH, Ivan Le 8/1/2011 17:18, Margaux Keller a écrit : Hi, I'm trying to create an abbreviated data file from

Re: [R] How to make a nomogam and Calibration plot

2011-08-01 Thread Frank Harrell
Kindly do not attach questions in a separate document. Install and read the documentation for the R rms package, and see handouts at http://biostat.mc.vanderbilt.edu/rms Frank sytangping wrote: Dear R users, I am a new R user and something stops me when I try to write a academic article.

[R] possible reason for merge not working

2011-08-01 Thread world peace
Hi Guys, working on a merge for 2 data frames. Using the command: x - merge(annotatedData, UCSCgenes, by.x=names, by.y=Ensembl.Gene.ID, all.x=TRUE) names and Ensembl.Gene.ID are columns with similar elements from the x and y data frames. annotatedData has 8909 entries, so has x(as expected).

[R] How to make a nomogam and Calibration plot

2011-08-01 Thread sytangping
Dear R users, I am a new R user and something stops me when I try to write a academic article. I want to make a nomogram to predict the risk of prostate cancer (PCa) using several factors which have been selected from the Logistic regression run under the SPSS. Always, a calibration plot is

Re: [R] Reorganize(stack data) a dataframe inducing names

2011-08-01 Thread jim holtman
Try this: had to add extra names to your data since it was not clear how it was organized. Next time use 'dput' to enclose data. x - read.table(textConnection( index time key date values + 13732 27965 DATA.Q211.SUM.Index04/08/11 1.42 + 13733 27974 DATA.Q211.SUM.Index

Re: [R] possible reason for merge not working

2011-08-01 Thread jim holtman
What you see and what the data really is may be two different things. You should have at least enclosed an 'str' of the two data frames; even better would be a subset of the data using 'dput'. Most likely your problem is that your data is not what you 'expect' it to be. On Mon, Aug 1, 2011 at

Re: [R] possible reason for merge not working

2011-08-01 Thread Jean V Adams
Dan, If the variables you are merging by are character variables, there may be subtle differences that you haven't noticed, e.g., capitalization or spacing. You can look for differences by listing off the unique values: table(c(annotatedData$names, UCSCgenes$Ensembl.Gene.ID)) Jean `·.,,

Re: [R] possible reason for merge not working

2011-08-01 Thread David Winsemius
On Aug 1, 2011, at 12:17 PM, world peace wrote: Hi Guys, working on a merge for 2 data frames. Using the command: x - merge(annotatedData, UCSCgenes, by.x=names, by.y=Ensembl.Gene.ID, all.x=TRUE) names and Ensembl.Gene.ID are columns with similar elements from the x and y data frames.

Re: [R] Is R the right choice for simulating first passage times of random walks?

2011-08-01 Thread R. Michael Weylandt michael.weyla...@gmail.com
I've only got a 20 minute layover, but three quick remarks: 1) Do a sanity check on your data size: if you want a million walks of a thousand steps, that already gets you to a billion integers to store--even at a very low bound of one byte each, thats already 1GB for the data and you still

Re: [R] possible reason for merge not working

2011-08-01 Thread world peace
the answer was indeed in subtle differences, and 'str' did help. Problem is solved. Thanks everybody for comments which was all very useful. Best, On Mon, Aug 1, 2011 at 12:25 PM, jim holtman jholt...@gmail.com wrote: What you see and what the data really is may be two different things.  You

Re: [R] Impact of multiple imputation on correlations

2011-08-01 Thread Joshua Wiley
Hi Tina, That is quite a bit of missingness, especially considering the sample size is not large to begin with. This would make me treat *any* result cautiously. That said, if you have a reasonable idea what the mechanism causing the missingness is or if from additional variables in your study,

[R] 5 arguments passed to .Internal(matrix) which requires 7

2011-08-01 Thread Robert Pfister
Hello, I am having a problem with the function matrix. Specifically, when I pass three arguments (two more being instantiated in the function), I get the following error message: Error in matrix(0, 30, 10) : 5 arguments passed to .Internal(matrix) which requires 7 I looked into it, and

[R] Inserting column in between

2011-08-01 Thread Bansal, Vikas
Dear all, I have a very simple question.I have data frame of 50 columns and i want to insert a column in 30th position.But i do not want to delete that column.Is it possible to include a column in between, so that new values are in 30th column and 30 th column is now 31st and 31st is

Re: [R] 5 arguments passed to .Internal(matrix) which requires 7

2011-08-01 Thread Jean V Adams
Robert, What code did you run to get that error? Do you get the error if the only code that you run is ... matrix(0, 30, 10) You gave three arguments to matrix, which requires none, but can take up to five. In the function matrix there is a call to .Internal(matrix) which requires 7

Re: [R] 5 arguments passed to .Internal(matrix) which requires 7

2011-08-01 Thread Jeff Newmiller
Y'know, you aren't likely to get many responses with this kind of request. Why don't you go read the posting guidelines and come back with: R version info Sample data Actual commands used, so we can reproduce the problem ---

Re: [R] Limited number of principal components in PCA

2011-08-01 Thread David L Carlson
Providing the data will help, but the first thing I noted is that you have more columns (variables) than rows (cases). PCA will return a maximum of (the number of columns) or (the number of rows-1) whichever is less. With 84 columns and 66 rows means you can get no more than 65 components. If

Re: [R] Inserting column in between

2011-08-01 Thread Sarah Goslee
x - cbind(x[,1:29], newcolumn, x[,30:ncol(x)]) On Mon, Aug 1, 2011 at 12:59 PM, Bansal, Vikas vikas.ban...@kcl.ac.uk wrote: Dear all, I have a very simple question.I have data frame of 50 columns and i want to insert a column in 30th position.But i do not want to delete that column.Is it

Re: [R] Inserting column in between

2011-08-01 Thread Bert Gunter
Doesn't work -- you lose column names. Try this instead: yourframe[,30:51] - cbind( newcolumn,yourframe[,30:50]) Adjust column names after via: names(yourframe) [30:51] - c(newcolname,names(yourframe[30:50]) Cheers, Bert On Mon, Aug 1, 2011 at 10:10 AM, Sarah Goslee sarah.gos...@gmail.com

Re: [R] Plotting problems directional or rose plots

2011-08-01 Thread David L Carlson
Searching R Graphical Manual (http://www.oga-lab.net/RGM2/, mirror http://www.oga-lab.net/RGM2/) shows possible candidates in packages circular (windrose), IDPmisc (plot.rose), climatol (rosavent), openair (windRose), and oce (as.windrose). -- David L

Re: [R] Inserting column in between -- better way?

2011-08-01 Thread Bert Gunter
Folks: I consider my reply below rather clumsy: One has to keep track of index numbers other than that which is inserted and must separately change column names. Is there as essentially better way to do this, either via base R or via an R package. I leave it to you to define essentially better.

Re: [R] Accessing the index of factor in by() function

2011-08-01 Thread Merik Nanish
Since I didn't get an answer to this question, I'm rephrasing my question in simpler terms: I have a dataframe and I want to split it based on the levels of one of its columns, and apply a function to each section of the data. Output of the function may be drawing a plot, returning a value,

Re: [R] Inserting column in between

2011-08-01 Thread David L Carlson
Not when I do it. a - data.frame(A=1:10, B=11:20, D=31:40, E=41:50) a A B D E 1 1 11 31 41 2 2 12 32 42 3 3 13 33 43 4 4 14 34 44 5 5 15 35 45 6 6 16 36 46 7 7 17 37 47 8 8 18 38 48 9 9 19 39 49 10 10 20 40 50 b - cbind(a[,1:2], C=21:30, a[,3:4]) b A B C D E 1

Re: [R] Inserting column in between

2011-08-01 Thread Sarah Goslee
Bert, On Mon, Aug 1, 2011 at 1:17 PM, Bert Gunter gunter.ber...@gene.com wrote: Doesn't work -- you lose column names. But I don't lose column names: x - data.frame(A=1:3, B=1:3, C=1:3, D=1:3, E=1:3) x A B C D E 1 1 1 1 1 1 2 2 2 2 2 2 3 3 3 3 3 3 newcol - 4:6 cbind(x[,1:2], newcol,

Re: [R] Inserting column in between -- better way?

2011-08-01 Thread Sarah Goslee
Bert, On Mon, Aug 1, 2011 at 1:27 PM, Bert Gunter gunter.ber...@gene.com wrote: Folks: I consider my reply below rather clumsy: One has to keep track of index numbers other than that which is inserted and must separately change column names. Is there as essentially better way to do this,

Re: [R] Inserting column in between -- better way?

2011-08-01 Thread Ista Zahn
On Mon, Aug 1, 2011 at 1:43 PM, Sarah Goslee sarah.gos...@gmail.com wrote: Bert, On Mon, Aug 1, 2011 at 1:27 PM, Bert Gunter gunter.ber...@gene.com wrote: Folks: I consider my reply below rather clumsy: One has to keep track of index numbers other than that which is inserted and must

Re: [R] Accessing the index of factor in by() function

2011-08-01 Thread Sarah Goslee
Merik, You did get an answer to the question, and it's even included in the material below. What doesn't work for you in Ista's suggestion? id- c(1,1,1,1,1,2,2,2,3,3,3) month - c(1, 1, 2, 3, 6, 2, 3, 6, 1, 3, 5) value - c(10, 12, 11, 14, 16, 12, 10, 8, 14, 11, 15) dat.tmp - data.frame(id,

Re: [R] Inserting column in between

2011-08-01 Thread Bert Gunter
Thanks Sarah and David. Yes, but note this: z - data.frame(a=1:2,b=3:4) z a b 1 1 3 2 2 4 newdat - 5:6 cbind(z[,1],newdat,z[,2]) newdat [1,] 1 5 3 [2,] 2 6 4 cbind.data.frame(z[,1],newdat,z[,2]) z[, 1] newdat z[, 2] 1 1 53 2 2 64

[R] fill Matrix quicker

2011-08-01 Thread monk
dear all, i have a quite simple question, i want to fill up a Matrix like done in the following function, but the performance is very bad for large dimensions is there a way to do this like with apply or something similar? makeMatrix - function(a, b,dim) { X=matrix(0,ncol=dim,nrow=dim)

Re: [R] error message jpeg62.dll missing

2011-08-01 Thread Prof Brian Ripley
See the footer of this and every R-help message. In particular, that DLL is not used by R itself, so this is probably something called from a third-party package. A number of packages used to use that DLL (which is rather out of date), but no longer, so is your R actually current (the

Re: [R] fill Matrix quicker

2011-08-01 Thread Jean V Adams
Making use of the row() and col() functions speeds things up a bit. makeMatrix2 - function(a, b, dim) { X - matrix(NA, ncol=dim, nrow=dim) X - exp( (-1*abs(row(X) - col(X)))/(3*b) ) diag(X) - a X } system.time(makeMatrix(1, 2, 1000))

Re: [R] 5 arguments passed to .Internal(matrix) which requires 7

2011-08-01 Thread Robert Pfister
Yes, even if I only run the command matrix(0,30,10) I get the error. I am running R with Ubuntu 10.10 (maverick) with R version: R version 2.13.1 (2011-07-08) When I check the function matrix, I can see that it is only passing five arguments to the function .Internal() (shown below). function

Re: [R] 5 arguments passed to .Internal(matrix) which requires 7

2011-08-01 Thread Jean V Adams
That's interesting. My function matrix() looks like this: function (data = NA, nrow = 1, ncol = 1, byrow = FALSE, dimnames = NULL) { if (is.object(data) || !is.atomic(data)) data - as.vector(data) .Internal(matrix(data, nrow, ncol, byrow, dimnames, missing(nrow),

Re: [R] fill Matrix quicker

2011-08-01 Thread Patrick Burns
Most certainly you can speed it up: X - exp(-abs(row(X) - col(X)) / (3*b)) diag(X) - a should do what you want. This is called 'vectorization' and is discussed lots of places -- for instance, in the two documents mentioned below in my signature. On 01/08/2011 19:12, monk wrote: dear all,

Re: [R] Inserting column in between -- better way?

2011-08-01 Thread David L Carlson
Actually Sara's method fails if the insertion is after the first or before the last column: x - data.frame(A=1:3, B=1:3, C=1:3, D=1:3, E=1:3) newcol - 4:6 cbind(x[,1], newcol, x[,2:ncol(x)]) x[, 1] newcol B C D E 1 1 4 1 1 1 1 2 2 5 2 2 2 2 3 3 6 3 3 3 3

[R] Identifying US holidays

2011-08-01 Thread Dimitri Liakhovitski
Hello! I am trying to identify which ones of a vector of dates are US holidays. And, ideally, which is which. And I do not know (a-priori) which dates those should be. I have, for example: x-seq(as.Date(2011-01-01),as.Date(2011-12-31),by=day) (x) I think chron should help me here - but maybe I

Re: [R] error in self-made function - cannot deal with objects of length = 1

2011-08-01 Thread Berend Hasselman
bjmjarrett wrote: ... rate - function(x){ storage - matrix(nrow=length(x),ncol=1) ifelse(length(x)==1,storage[1,] - NA,{ storage[1,] - x[1]/max(x) for(i in 2:length(x)){ p - i-1 storage[i,] - ((x[i] - x[p]) / max(x)) }

Re: [R] example package for devel newcomers

2011-08-01 Thread Brian Diggs
On 7/31/2011 6:24 PM, Alexandre Aguiar wrote: Em Domingo 31 Julho 2011, você escreveu: My memory is that this question gets asked every few months and one of the stock answers is to use the function 'package.skeleton' in the utils package as a starting point. Got that from docs. And actually

[R] Error while trying to install a package

2011-08-01 Thread Sushil Amirisetty
Hi Everyone, When i try to install a package using install.packages(agricolae) --- Please select a CRAN mirror for use in this session --- | The cursor keeps blinking i dont get a popup menu to choose a CRAN mirror? Is it due to my proxy server settings? I tried to echo $http_proxy ,

Re: [R] fill Matrix quicker

2011-08-01 Thread monk
thanks a lot , that will do the trick -- View this message in context: http://r.789695.n4.nabble.com/fill-Matrix-quicker-tp3710428p3710533.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

[R] error in self-made function - cannot deal with objects of length = 1

2011-08-01 Thread bjmjarrett
I have a function to calculate the rate of increase (the difference between the value and the previous value divided by the total number of eggs in a year) of egg production over the course of a year: rate - function(x){ storage - matrix(nrow=length(x),ncol=1) storage[1,] - x[1] /

Re: [R] 5 arguments passed to .Internal(matrix) which requires 7

2011-08-01 Thread Robert Pfister
It looks like I had been missing an update needed for Ubuntu systems. All I needed was the following. Thank you. update.packages(lib.loc = /usr/local/lib/R/site-library) On Mon, Aug 1, 2011 at 2:39 PM, Jean V Adams jvad...@usgs.gov wrote: That's interesting. My function matrix() looks like

  1   2   >