Re: [R] binary data

2009-11-25 Thread Gnanasivam
karuna m wrote: hi, I am trying to calculate distance matrices for binary data frame. I am using dist.binary in 'ade4' package. This is the code i run and get error message as 'missing value where True/False needed: clss - as.data.frame(cls) dist.binary(clss, method = 1, diag = FALSE,

[R] interior and exterior colors of a map

2009-11-25 Thread dxc13
Hi useR's, I have an image plot I want to overlay a map of the United States on, via map('usa'). The image is basically a large rectangular of various colors. When I overlay the United States map, the full rectangle of the image plot is visible, but I only want to display the image WITHIN the

Re: [R] reshape question

2009-11-25 Thread AC Del Re
Thanks for your help on this Hadley and David! Dennis Murphy also had a good solution (changing list(data.out2[-1])...etc to names(data.out2[-1]}...): data.out3 - reshape(data.out2, direction = 'long', varying = names(data.out2[-1]), + idvar = 'id') data.out4 - split(data.out3,

Re: [R] Eliminating 'Unprintable ASCII' characters

2009-11-25 Thread Prof Brian Ripley
I think you mean the control characters: there are other unprintable characters (del for example). They are the character range [\001-\037]. E.g. test - intToUtf8(1:40, multiple=TRUE) grepl([\001-\037], test) [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE [13]

[R] Kerning issues with CairoPDF

2009-11-25 Thread Karl Ove Hufthammer
Dear list members I'm using CairoPDF to generate PDF (because of its font embedding and support for transparent colours). However, at least on my (Windows) system, the text it outputs seems to have completely wrong kerning. Here's an example: CairoPDF(test.pdf) plot(rnorm(100),xlab=Ovreset)

[R] multiple regression model representation

2009-11-25 Thread Manuel Jesús López Rodríguez
Dear all, I have a problem when trying to fit a model to a dataset. The model I am fitting is: y~var1*var2*var3*var4*var5, with var3 and var4 having many 0´s. When I construct the model and I simplify it, it remains a model with 8 explicative variables (or interaction of them) and the intercept,

Re: [R] which to trust...princomp() or prcomp() or neither?

2009-11-25 Thread Jari Oksanen
Blair Smith b.smith at irl.cri.nz writes: According to R help: princomp() uses eigenvalues of covariance data. prcomp() uses the SVD method. yet when I run the (eg., USArrests) data example and compare with my own hand-written versions of PCA I get what looks like the opposite.

Re: [R] center of cluster of points in PCA

2009-11-25 Thread Jari Oksanen
phoebe kong sityeekong at gmail.com writes: Can someone tell me how to find the center of cluster points in PCA (PC1 vs PC2)? Can R find that out? If yes, how it's generated by R? Is the coordinate of center point equals (mean score of PC1, mean score of PC2)? Phoebe: Yes. Cheers, Jari

[R] ROCR Issue: Averaging Across Multiple Classifier Runs in ROC Curve

2009-11-25 Thread Na'im R. Tyson
Dear R-philes, I am having some trouble averaging across multiple runs of a classifier in an ROC Curve. I am using the ROCR package and the plot() method. First, I initialize a list with two elements where each element is a list of predictions and labels: vowel.ROC -

Re: [R] Scatter plot with margin distributions

2009-11-25 Thread Jose Narillos de Santos
Finally I get a plot manual...so I got the solution Sorry about inconveniences 2009/11/24, Jose Narillos de Santos narillosdesan...@gmail.com: Hi All, My doub I think is very simple. I hope it is. So you can again help, guide me. I´m trying to make a graph (scatter graph) about

[R] extract area in netcdf file

2009-11-25 Thread Izidine Pinto
Dear R users I am working with a netcf data. The data are from a big area and I would like to extract a small region to analyse. How can one extract a region? Any help is strongly appreciated, thank you in advance [[alternative HTML version deleted]]

[R] searching code for combination of vector

2009-11-25 Thread soeren . vogel
For a given numeric vector v of length n and sum s, is there a ready- to-run code that returns every combination of v in n summing up to s? Example for n=3 and s=2: v - c(2, 0, 0) # find some coding here that returns [1] 2 0 0 [2] 1 1 0 [3] 1 0 1 [4] 0 2 0 [5] 0 1 1 [6] 0 0 2 Thanks Sören

Re: [R] predict: remove columns with new levels automatically

2009-11-25 Thread Peter Ehlers
Andreas Wittmann wrote: Sorry for my bad description, i don't want get a constructed algorithm without own work. i only hoped to get some advice how to do this. i don't want to predict any sort of data, i reference only to newdata which variables are the same as in the model data. But if

[R] Plotting Stacked Bar

2009-11-25 Thread Julia Cains
Dear R helpers, I am trying to plot a stacked graph. I have following data Month  Core(%)   Non_core(%) 1 45    55 2 48    52 3 36    64 4 60    40 5 35    65 Then for

[R] extract area in netcdf file

2009-11-25 Thread Izidine Pinto
Dear R users I am working with a netcf data. The data are from a big area and I would like to extract a small region to analyse. How can one extract a region? Any help is strongly appreciated, thank you in advance [[alternative HTML version deleted]]

Re: [R] 11 distinguishable colors

2009-11-25 Thread Paul Hiemstra
Hi, Also take a look at the RColorBrewer package. cheers, Paul milton ruser wrote: Hi there, I picked it up from r.colors' grass manual: http://colorbrewer2.org/ The code bellow cold be usefull for you explore simbols and colors. x11(900,500) par(mfrow=c(1,2)) x-runif(20) y-runif(20)

Re: [R] R Packages Crack the 3,000 Mark!

2009-11-25 Thread Liviu Andronic
Hello On 11/24/09, Muenchen, Robert A (Bob) muenc...@utk.edu wrote: I don't know if this has been reported before, but according to Henrique Dallazuanna's program (below) the number of R packages has exceeded the 3,000 mark. The count today is 3,175. I ran this just a couple of months

Re: [R] Tests in Anova

2009-11-25 Thread Silvano
Sarah and Dennis, thank you for help and page reference. Thanks, -- Silvano Cesar da Costa Departamento de Estatística Universidade Estadual de Londrina Fone: 3371-4346 __ R-help@r-project.org mailing list

Re: [R] Re adline()

2009-11-25 Thread joris meys
I run your script from the windows console (evidently), and as said, I can't reproduce your error. Can you give me the exact command you use to run it from the windows console? Cheers Joris On Tue, Nov 24, 2009 at 7:33 PM, yonosoyelmejor yonosoyelme...@hotmail.com wrote: Sure,but my problem is

Re: [R] questions on the ff package

2009-11-25 Thread Ramon Diaz-Uriarte
Dear Jeff, This is not exactly what you are asking, but what I do is close the object, save it as RData, and then when I need to load the RData. The RData objects themselves are very small. Best, R. On Wed, Nov 25, 2009 at 2:28 AM, Hao Cen h...@andrew.cmu.edu wrote: Hi, I have two

[R] Plot and area below a line graph

2009-11-25 Thread Jose Narillos de Santos
Imagine I have a variable X I use plot (X, type=l). I want to show with colour the area between the line of X and the Zero Axis. So that if X have negative values the colored area will be below zero. I´m trying to make this with polygons() but I´m not able Can you guide me to do it? The

Re: [R] Plot and area below a line graph

2009-11-25 Thread Achim Zeileis
On Wed, 25 Nov 2009, Jose Narillos de Santos wrote: Imagine I have a variable X I use plot (X, type=l). I want to show with colour the area between the line of X and the Zero Axis. So that if X have negative values the colored area will be below zero. I?m trying to make this with polygons()

Re: [R] Method

2009-11-25 Thread yonosoyelmejor
Your suspicions were correct, I just try and works perfectly. Thank you very much for your help, :- Greetings, Ignacio. William Dunlap wrote: Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of David Winsemius Sent: Tuesday, November 24,

Re: [R] Method

2009-11-25 Thread yonosoyelmejor
You are right,but I´ll explain,my code creates a time series,after some transformations I need to make a prediction,which predicts 10values using the above,then written in a file,I put the code to see if it looks better: # TODO: Add comment # # Author: Ignacio2

Re: [R] Re adline()

2009-11-25 Thread yonosoyelmejor
Is that what I did is to link it directly, then I click on it and I was launching the console run,but try it another way, what I did was use vectors and so I saved it.So we can conclude the issue,thank you very much indeed for your help Cheers Ignacio. JorisMeys wrote: I run your script from

[R] Test Binary File

2009-11-25 Thread Jason Rupert
I've got an error with the way I'm using readBin on a binary file of unknown internal structure. I know the structure consists of rows and columns, but I'm not sure how many of each. So, does anyone know of a valid test set of binary data that I could reference while trying to figure out

Re: [R] predict from glmer

2009-11-25 Thread Ben Bolker
sj ssj1364 at gmail.com writes: predPN - model.matrix(terms(mod.PN),newDat) %*% fixef(mod.PN) this seems to work fine and the I print the predictions print(PredPN) [1] [2] 2.358722 2.312340 However I am not certain what I am looking at here, my best guess is

Re: [R] Test Binary File

2009-11-25 Thread jim holtman
Do you know how it is structured? Is it 64-bit floating point, 32-bit floating point, 64 bit integer, 32 bit integer, byte values, etc.? If we know the structure, then we can determine how to decode the information. On Wed, Nov 25, 2009 at 7:34 AM, Jason Rupert jasonkrup...@yahoo.com wrote:

[R] questions on the ff package

2009-11-25 Thread Jens Oehlschlägel
Jeff, I need to save a matrix as a memory-mapped file and load it back later. To save the matrix, I use mat = matrix(1:20, 4, 5) matFF = ff(mat, dim=dim(mat), filename=~/a.mat , overwrite=TRUE, dimnames = dimnames(mat)) # This stores the data in an ff file, # but not the metadata in R's

Re: [R] overdispersion and quasibinomial model

2009-11-25 Thread Ben Bolker
djpren wrote: Thanks for the reply. Naturally I already searched the site and help for the answers to these questions. I think I've figured out how to run a quasi-binomial model, but I cannot figure out how to test for over-dispersion or how to apply a shapiro-wilk test. This is not

Re: [R] Test Binary File

2009-11-25 Thread Duncan Murdoch
On 25/11/2009 7:34 AM, Jason Rupert wrote: I've got an error with the way I'm using readBin on a binary file of unknown internal structure. I know the structure consists of rows and columns, but I'm not sure how many of each. So, does anyone know of a valid test set of binary data that I

Re: [R] interior and exterior colors of a map

2009-11-25 Thread David Winsemius
Paul Murrell offered some worked examples of using paths from vector graphics in the articles and talks he has given for the grImport package: http://www.stat.auckland.ac.nz/~paul/Talks/import.pdf http://www.jstatsoft.org/v30/i04 http://cran.r-project.org/web/packages/grImport/grImport.pdf

Re: [R] predict: remove columns with new levels automatically

2009-11-25 Thread David Winsemius
On Nov 25, 2009, at 1:48 AM, Andreas Wittmann wrote: Sorry for my bad description, i don't want get a constructed algorithm without own work. i only hoped to get some advice how to do this. i don't want to predict any sort of data, i reference only to newdata which variables are the same

Re: [R] Reading from Google Docs

2009-11-25 Thread Farrel Buchinsky
I recently installed R 2.10 Now I get library(RGoogleDocs) Loading required package: RCurl Loading required package: bitops Loading required package: XML Attaching package: 'RGoogleDocs' The following object(s) are masked from package:methods : getAccess Warning message:

Re: [R] R Packages Crack the 3,000 Mark!

2009-11-25 Thread Muenchen, Robert A (Bob)
Hi Liviu, Yes, I selected all the repositories on the list, including things like CRAN (extras), the four Bioconductor (BioC) sites, and R-Forge. Cheers, Bob -Original Message- From: Liviu Andronic [mailto:landronim...@gmail.com] Sent: Wednesday, November 25, 2009 4:47 AM To:

[R] arg min ???

2009-11-25 Thread Peterko
Is there function what aproximate vector of parameters some function to minimum ? tet={tet1,tet2} i have they starting value and i want to find the tet what minimalizing some function of tet ? thanks -- View this message in context:

Re: [R] overdispersion and quasibinomial model

2009-11-25 Thread djpren
Thanks for the reply. Naturally I already searched the site and help for the answers to these questions. I think I've figured out how to run a quasi-binomial model, but I cannot figure out how to test for over-dispersion or how to apply a shapiro-wilk test. This is not homework, neither do I

Re: [R] XML package example code?

2009-11-25 Thread Tony B
Cls59 is correct that there is a lot of example code, just look in ? htmlTreeParse and you'll get most of what you need i think. here's some simplified code I use a lot of (XPath expressions are used to parse the code): # libraries library(RCurl) library(XML) # google url my.url -

Re: [R] Plotting Stacked Bar

2009-11-25 Thread Richard M. Heiberger
## Your original data is already the result of table(). ## Here are two versions, one using barchart and one barplot. tmpc - textConnection( Month Core(%) Non_core(%) 1 4555 2 4852 3 3664 4

Re: [R] arg min ???

2009-11-25 Thread David Winsemius
On Nov 25, 2009, at 9:15 AM, Peterko wrote: Is there function what aproximate vector of parameters some function to minimum ? tet={tet1,tet2} i have they starting value and i want to find the tet what minimalizing some function of tet ? ?which.min Perhaps: which.min( fn(tet) )

Re: [R] Error in text.rpart(fit) : fit is not a tree, just a root

2009-11-25 Thread Terry Therneau
I've tried to make a decision tree for the following data set: I don't get a tree... The rpart routine has decided that the best model it can find is the intercept only model, i.e., a tree with no branches at all. Stepwise regression can have the same outcome, by the way, if no variables

[R] Random data

2009-11-25 Thread mentor_
Hi, how can I produce random data which lies around a straight line with angle 45 degree. Similar to this image: http://zoonek2.free.fr/UNIX/48_R/g134.png Cheers -- View this message in context: http://old.nabble.com/Random-data-tp26513822p26513822.html Sent from the R help mailing list

Re: [R] overdispersion and quasibinomial model

2009-11-25 Thread David Winsemius
On Nov 25, 2009, at 7:04 AM, djpren wrote: Thanks for the reply. Naturally I already searched the site and help for the answers to these questions. I think I've figured out how to run a quasi-binomial model, but I cannot figure out how to test for over-dispersion or how to apply a

Re: [R] Random data

2009-11-25 Thread Dimitris Rizopoulos
one way is: x - sort(rnorm(100)) y - rnorm(100, mean = x, sd = 0.3) plot(x, y) abline(a = 0, b = 1) I hope it helps. Best, Dimitris mentor_ wrote: Hi, how can I produce random data which lies around a straight line with angle 45 degree. Similar to this image:

Re: [R] Random data

2009-11-25 Thread Erik Iverson
One option, first, generate the range of x data that you want, then add normally distributed noise to each x, these will be your y data. n - 20 x - sample(20:50, n) y - rnorm(n, mean = x, sd = 3) plot(y ~ x) Erik -Original Message- From: r-help-boun...@r-project.org

Re: [R] Random data

2009-11-25 Thread Sarah Goslee
That's not a 45-degree angle: the x and y scales are quite different. But you can use corgen from the ecodist package to create correlated x and y variables, and then adjust the scale as needed. Sarah On Wed, Nov 25, 2009 at 9:42 AM, mentor_ ment...@gmx.net wrote: Hi, how can I produce

Re: [R] problem in building an R package

2009-11-25 Thread Uwe Ligges
clue_less wrote: i am trying to build an R package and submit to CRAN. i am using - package.skeleton(name=xxzz, code_files = H:\xxzz.R) to build package xxzz. --- The code above generates 'xxzz' folder. It seems that I have to manually edit the files generated in xxzz

Re: [R] searching code for combination of vector

2009-11-25 Thread Peter Ehlers
soeren.vo...@eawag.ch wrote: For a given numeric vector v of length n and sum s, is there a ready-to-run code that returns every combination of v in n summing up to s? Example for n=3 and s=2: v - c(2, 0, 0) # find some coding here that returns [1] 2 0 0 [2] 1 1 0 [3] 1 0 1 [4] 0 2 0 [5] 0 1

Re: [R] R Packages Crack the 3,000 Mark!

2009-11-25 Thread Gabor Grothendieck
Note that: - there are also 199 R packages on google code: http://code.google.com/hosting/search?q=label:R - some (many?) of the packages on R-Forge and on google code are also on CRAN On Wed, Nov 25, 2009 at 9:11 AM, Muenchen, Robert A (Bob) muenc...@utk.edu wrote: Hi Liviu, Yes, I selected

[R] Re-arrange Columns in data frame

2009-11-25 Thread Jabez Wilson
Hi, I have a data frame which is 24 columns by 10 rows. This is essentially 6 groups of 4 columns. I want to re-arrange the columns into the following order 1,7,13,19,2,8,14,20,3,9,15,21,4,10,16,22,5,11,17,23,6,12,18,24 i.e. first of each group of 6 grouped together, then 2nd of each group of

Re: [R] XML package example code?

2009-11-25 Thread Peng Yu
On Wed, Nov 25, 2009 at 12:19 AM, cls59 ch...@sharpsteen.net wrote: Peng Yu wrote: I'm interested in parsing an html page. I should use XML, right? Could you somebody show me some example code? Is there a tutorial for this package? Did you try looking through the help pages for the XML

[R] Structural Equation Models(SEM)

2009-11-25 Thread Ralf Finne
Hi R-colleagues. In the sem-package i have a problem to introduce hidden variables. As a simple example I take an ordinary factor analysis. The program: cmat=c(0.14855886, 0.05774635, 0.08003300, 0.04900990, 0.05774635, 0.18042029, 0.11213013, 0.03752475, 0.08003300,

Re: [R] Re-arrange Columns in data frame

2009-11-25 Thread Gabor Grothendieck
Try this: # first case ix - c(matrix(1:24, 4, byrow = TRUE)) DF[ix] # second case ix - c(matrix(1:16, 4, byrow = TRUE)) DF[ix] On Wed, Nov 25, 2009 at 11:16 AM, Jabez Wilson jabez...@yahoo.co.uk wrote: Hi, I have a data frame which is 24 columns by 10 rows. This is essentially 6 groups of 4

Re: [R] arg min ???

2009-11-25 Thread Peterko
This is nice, but i have to define vector of possible theta, this is not what i want to do. I have vector of unknow parameters theta. I have som estimate of theta, but i want to do better estimate of them, using some criterion function. I mean it is clasical argmin f(x_1,x_2,...x_n) to fit

[R] difference of two rows

2009-11-25 Thread clion
Dear R user, I'd like to calculate the difference of two rows, where ID is the same. eg.: I've got the following dataframe: ID YEAR 13 2007 15 2003 15 2006 15 2008 21 2006 21 2007 and I'd like to get the difference, like this: ID YEAR diff 13 2007 NA 15 2003 3 15 2006 2 15

Re: [R] Reading from Google Docs

2009-11-25 Thread David M Smith
If your goal is solely to download data from a Google Spreadsheet into R, it is possible to configure the Google Docs access so that only read.csv is needed. The details are here: http://blog.revolution-computing.com/2009/09/how-to-use-a-google-spreadsheet-as-data-in-r.html But if you need any

[R] Concave hull

2009-11-25 Thread Corrado
Dear friends, Do you know how to calculate the CONCAVE hull of a set of points (2- dimensional or n-dimensional)? is that possible in R? (With a smoothing parameter of course). Best, -- Corrado Topi Global Climate Change Biodiversity Indicators Area 18,Department of Biology University of

Re: [R] Re-arrange Columns in data frame

2009-11-25 Thread Jabez Wilson
Thanks very much. Using the matrix function and then DF[,ix] gives me exactly what I wanted. Jabez --- On Wed, 25/11/09, Gabor Grothendieck ggrothendi...@gmail.com wrote: From: Gabor Grothendieck ggrothendi...@gmail.com Subject: Re: [R] Re-arrange Columns in data frame To: Jabez Wilson

[R] fitting mixture of normals distribution to asset return data

2009-11-25 Thread John Seppänen
Hi, I have a 15 years of monthly return data (180 observations) from instruments that have non-normal return distributions. Thus, I would like to fit a mixture of normal distribution to each of the series. So, that I would be able to simulate from the marginal distributions like this:

[R] rattle(): unable to load shared library

2009-11-25 Thread Matthieu Stigler
Hi I'm trying to install the rattle GUI on winwos 2000, with last version R 2.10. I had a first problem using the rattle package, as it was asking pkg XMl, which is no more in the CRAN repo. I instead simply install in R/libraries the XML pkg from:

[R] Importing many files from a single code

2009-11-25 Thread ram basnet
Dear R users,   Does somebody know the way to import many files by a single command in R ? I have 50 files in a directory and now, i am importing the files repeatedly (one by one). If there is a way to import all files at a time, it makes much more easy and save times too. Thanks in advance.    

Re: [R] difference of two rows

2009-11-25 Thread R Help
You want to use tapply ?tapply This is a simple example dat = data.frame(a=sample(1:10,100,T),b=rnorm(100,0,1)) tapply(dat$b,dat$a,mean) Hope that helps, Sam On Wed, Nov 25, 2009 at 11:55 AM, clion birt...@hotmail.com wrote: Dear R user, I'd like to calculate the difference of two rows,

Re: [R] XML package example code?

2009-11-25 Thread Duncan Temple Lang
Peng Yu wrote: On Wed, Nov 25, 2009 at 12:19 AM, cls59 ch...@sharpsteen.net wrote: Peng Yu wrote: I'm interested in parsing an html page. I should use XML, right? Could you somebody show me some example code? Is there a tutorial for this package? Did you try looking through the help

[R] tick marks on fold change versus fold change plot

2009-11-25 Thread Alla Bulashevska
Dear R users, i try to produce the fold change versus fold change plot where i have the values for x and y ranging from 0.01 to 100. So i start with plot(x,y,xlim=c(0.01,100),ylim=c(0.01,100), axes=F). Then i would like both axes to have tick marks as c(0.01,0.1,1,10,100) but they should appear

Re: [R] R 2.9.1: Error building target 'front'

2009-11-25 Thread Loris Bennett
Loris Bennett loris.benn...@fu-berlin.de writes: Bad news: I found no solution to this problem. Good news: The problem does not occur with version 2.10.0. Loris Loris Bennett loris.benn...@fu-berlin.de writes: I get the same problem using R version 2.9.2. I would be very grateful if

[R] Unique observations

2009-11-25 Thread John Lipkins
Hey R list, A beginners question. How can I do the following: In my research population it is possible that several items can appear several times, measured on different moments in time. This is being supplied in a total list with all observations identified by a number (per item) and a moment

Re: [R] XML package example code?

2009-11-25 Thread Tony B
Not sure if my code was attached in that last post: library(RCurl) library(XML) html - getURL(http://www.omegahat.org/RSXML/index.html;) html.tree - htmlTreeParse(html, useInternalNodes = TRUE, error = function(...){}) On 25 Nov, 16:21, Peng Yu pengyu...@gmail.com wrote: On Wed, Nov 25, 2009

[R] R: Re: R: Re: chol( neg.def.matrix ) WAS: Re: Choleski and Choleski with pivoting of matrix fails

2009-11-25 Thread simona.racio...@libero.it
Dear Peter, thank you very much for your answer. My problem is that I need to calculate the following quantity: solve(chol(A)%*%Y) Y is a 3*3 diagonal matrix and A is a 3*3 matrix. Unfortunately one eigenvalue of A is negative. I can anyway take the square root of A but when I multiply it by

Re: [R] XML package example code?

2009-11-25 Thread Tony B
It's been a long time since i read the tutorials, but 'I think', the reason you get those notifications is because the html code is malformed, meaning that some of the opening tags 'dd' don't have corresponding end tags /dd etc. The XML package seems rather good at working with malformed code,

Re: [R] tick marks on fold change versus fold change plot

2009-11-25 Thread jim holtman
It sounds like you want to plot 'log' on both axis: plot(..., log='xy') On Wed, Nov 25, 2009 at 12:24 PM, Alla Bulashevska alla.bullashev...@fdm.uni-freiburg.de wrote: Dear R users, i try to produce the fold change versus fold change plot where i have the values for x and y ranging from 0.01

Re: [R] Natural colours for topographic data

2009-11-25 Thread Karl Ove Hufthammer
Tysdag 24. november 2009 11.08.08 skreiv du: I would be happy with a simple one, that just mapped negative values to water colours and positive values to land colours. Have you tried my colourscheme package? Its not on CRAN but you can get it from here: Thanks for the suggestion. It looks

Re: [R] Importing many files from a single code

2009-11-25 Thread jim holtman
Exactly what do you mean by import? What commands are you using? You can get a list of the files in a directory and then iterate through reading each one in. If you use 'lapply', you can 'read.table' in some data frames and then 'rbind' them into a single data frame. You need to be more

Re: [R] Unique observations

2009-11-25 Thread jim holtman
shouldn't the first observation for Tree1 be Tree1 leaves 01-01-2009? x - read.table(textConnection(Tree disease date + Tree1 leaves 01-01-2009 + Tree2 roots 13-09-2009 + Tree1 roots 24-10-2009), header=TRUE) closeAllConnections() # split by Tree and take first observation

Re: [R] Unique observations

2009-11-25 Thread David Winsemius
On Nov 25, 2009, at 9:44 AM, John Lipkins wrote: Hey R list, A beginners question. How can I do the following: In my research population it is possible that several items can appear several times, measured on different moments in time. This is being supplied in a total list with all

Re: [R] difference of two rows

2009-11-25 Thread jim holtman
Try this: x - read.table(textConnection(ID YEAR + 13 2007 + 15 2003 + 15 2006 + 15 2008 + 21 2006 + 21 2007), header=TRUE) x$diff - ave(x$YEAR, x$ID, FUN=function(a) c(diff(a), NA)) x ID YEAR diff 1 13 2007 NA 2 15 20033 3 15 20062 4 15 2008 NA 5 21 20061 6 21 2007 NA On

Re: [R] R Packages Crack the 3,000 Mark!

2009-11-25 Thread Muenchen, Robert A (Bob)
I thought that the unique function would eliminate duplicate package names. Is there a better way to count the number of packages? Thanks, Bob -Original Message- From: Gabor Grothendieck [mailto:ggrothendi...@gmail.com] Sent: Wednesday, November 25, 2009 10:40 AM To: Muenchen, Robert A

Re: [R] Importing many files from a single code

2009-11-25 Thread Erik Iverson
See the example in ?source, which does exactly this... or make a package depending on your needs. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of ram basnet Sent: Wednesday, November 25, 2009 8:35 AM To: R help Subject: [R]

Re: [R] fitting mixture of normals distribution to asset return data

2009-11-25 Thread Christian Hennig
Dear John, I don't know what the exp stuff in your line below is about, but mclustBIC in package mclust does fit normal mixtures. Try for a start library(mclust) mmm - mclustBIC(data,G=2) mmms - summary(mmm) mmms If you want to learn more, read the documentation. Christian On Wed, 25 Nov

Re: [R] Structural Equation Models(SEM)

2009-11-25 Thread Viechtbauer Wolfgang (STAT)
The model you have specified there is not an ordinary factor analysis model. This may be closer to what you are thinking of: model.RLIM - specify.model() f1 - R, laddR, NA f1 - L, laddL, NA f1 - I, laddI, NA f1 - M, laddM, NA R - R, dR, NA L - L, dL, NA

Re: [R] Importing many files from a single code

2009-11-25 Thread David Winsemius
On Nov 25, 2009, at 9:35 AM, ram basnet wrote: Dear R users, Does somebody know the way to import many files by a single command in R ? I have 50 files in a directory and now, i am importing the files repeatedly (one by one). If there is a way to import all files at a time, it makes

Re: [R] Structural Equation Models(SEM)

2009-11-25 Thread William Revelle
Ralf, If you are representing this as a factor model, you need to have the factors lead to the variables: model.RLIM - specify.model() f1 - R , laddR, NA f1 - L, laddL, NA f1 - I, laddI, NA f1 - M, laddM, NA R - R, dR,NA L - L, dL,NA I - I, dI,NA

[R] order of panels in xyplots

2009-11-25 Thread Titus Malsburg
I'd like do a simple xyplot with customized order of panels and try to understand how to use index.cond for that. Several attempts didn't deliver the correct results. Now, I noticed the following: p - xyplot(dur~roi|trial, data) p$index.cond [[1]] [1] 1 2 3 4 5 6 7 8 9 10 These

[R] draw circle on PCA plot

2009-11-25 Thread phoebe kong
Hi, I have a hard time in drawing circle on PCA. I have 60 samples. The corresponding PC1 scores and PC2 scores were stored as mergedata. Here are the summary of PCs scores. range(mergedata[,PC1]) [1] 0.0085 0.0100 range(mergedata[,PC2]) [1] 0.0032 0.0075 mean(mergedata[,PC1]) [1] 0.009241667

[R] augPred and nlme

2009-11-25 Thread Sam Albers
Hello there, Using 'The R Book' (p675-677) I am following instructions on performing a series of nonlinear regressions fitting the same model to a set of groups. I have been to able to fit the model to my data using the following call to nlme: library(nlme) inorg.model-nlme(inorg.grv ~ a*exp( -

Re: [R] order of panels in xyplots

2009-11-25 Thread Titus Malsburg
On Wed, Nov 25, 2009 at 7:03 PM, Titus Malsburg malsb...@gmail.com wrote:  I was expecting that this should plot the panels in the order in which the levels occur in the data frame:  xyplot(dur~roi|trial, data, index.cond=unique(as.integer(data$trial))) The answer is apparently:

[R] help writing for loop

2009-11-25 Thread Jessica Schedlbauer
Hi, I’d like to ask for some help in writing a loop. My situation is the following: I have a matrix (matrix.A) containing 3 columns and 100 rows. The columns represent parameter estimates a, b, and c. The rows contain different values for these parameter estimates. Each row is unique. I

Re: [R] order of panels in xyplots

2009-11-25 Thread S Devriese
On 11/25/2009 07:33 PM, Titus Malsburg wrote: On Wed, Nov 25, 2009 at 7:03 PM, Titus Malsburg malsb...@gmail.com wrote: I was expecting that this should plot the panels in the order in which the levels occur in the data frame: xyplot(dur~roi|trial, data,

[R] Grouped Barplot

2009-11-25 Thread Gary
Hi R Users, I tried plotting a similar boxplot as it is on the FOLLOWING LINK: http://www.imachordata.com/wp-content/uploads/2009/09/boxplot.png Sample data is attached -- there are 9 years and 5 cities. In my case I'm looking to plot Year on x-axis and grouping boxplots by City. I tried the

Re: [R] R: Re: R: Re: chol( neg.def.matrix ) WAS: Re: Choleski and Choleski with pivoting of matrix fails

2009-11-25 Thread Ravi Varadhan
I do not understand what the problem is, as it works just fine for me: A - matrix(c(0.5401984,-0.3998675,-1.3785897,-0.3998675,1.0561872, 0.8158639,-1.3785897, 0.8158639, 1.6073119), 3, 3, byrow=TRUE) eA - eigen(A) chA - eA$vec %*% diag(sqrt(eA$val+0i)) %*% t(eA$vec) all.equal(A, Re(chA %*%

[R] Sampling dataframe

2009-11-25 Thread Ronaldo Reis Júnior
Hi, I have a table like that: datatest var1 var2 var3 1 111 2 312 3 813 4 614 51015 6 221 7 422 8 623 9 824 10 1025 I need to create another table based on that with

Re: [R] overdispersion and quasibinomial model

2009-11-25 Thread Peter Ehlers
djpren wrote: Thanks for the reply. Naturally I already searched the site and help for the answers to these questions. I think I've figured out how to run a quasi-binomial model, but I cannot figure out how to test for over-dispersion or how to apply a shapiro-wilk test. This is not homework,

Re: [R] Is there a package for generating standardized R script command line options?

2009-11-25 Thread Trevor . L . Davis
Hi, In python, there is a package that helps generating command line options. I am wondering if there is such a package in R that helps generating the command options for a R script? http://docs.python.org/library/optparse.html Regards, Peng I recently put a package on CRAN that tries

[R] multi variate plot with string data

2009-11-25 Thread frenchcr
Ive got two columns in data_set that are strings the first column is called character and has levels: good, bad, ugly the second column is called abusive and has levels: aggressive, moderately aggressive, mildly aggressive I want to do a stacked boxplot that has this sort of structure:

[R] Feature request for as.Date() function

2009-11-25 Thread nabble . 30 . miller_2555
Hello - I have a csv file with a few date columns. Some of the records have an NA character string instead of the date. When I attempt to use read.csv() and typecast the columns using colClasses, I receive the following error: Error in charToDate(x) : character string is not in a

Re: [R] Grouped Barplot

2009-11-25 Thread S Devriese
On 11/25/2009 07:48 PM, Gary wrote: Hi R Users, I tried plotting a similar boxplot as it is on the FOLLOWING LINK: http://www.imachordata.com/wp-content/uploads/2009/09/boxplot.png Sample data is attached -- there are 9 years and 5 cities. In my case I'm looking to plot Year on x-axis and

Re: [R] help writing for loop

2009-11-25 Thread Steven McKinney
Hi, The great thing about the S language is that it is 'vectorized', so you can do a lot of matrix manipulations without loops. Here's a smaller example of what you describe. matrix A with 3 columns and 10 rows (instead of 100) matrix B with 3 columns and 15 rows (instead of 1500)

Re: [R] Reading from Google Docs

2009-11-25 Thread Charlie Sharpsteen
On Wed, Nov 25, 2009 at 5:39 AM, Farrel Buchinsky fjb...@gmail.com wrote: I recently installed R 2.10 Now I get library(RGoogleDocs) Loading required package: RCurl Loading required package: bitops Loading required package: XML Attaching package: 'RGoogleDocs'        The following

Re: [R] Grouped Barplot

2009-11-25 Thread David Winsemius
On Nov 25, 2009, at 1:48 PM, Gary wrote: Hi R Users, I tried plotting a similar boxplot as it is on the FOLLOWING LINK: http://www.imachordata.com/wp-content/uploads/2009/09/boxplot.png Looks like a product of a function from ggplot2. In fact trimming that URL brings you to a page with

Re: [R] predict: remove columns with new levels automatically

2009-11-25 Thread Andreas Wittmann
Thank you all for the good advice. Now i did a fast hack, which does want i was looking for, maybe anyone else finds this usefull set.seed(0) x - rnorm(9) y - x + rnorm(9) training - data.frame(x=x, y=y, z1=c(rep(A, 3), rep(B, 3), rep(C, 3)),

Re: [R] Feature request for as.Date() function

2009-11-25 Thread jim holtman
Seems to work fine in my testing: x - read.csv(textConnection(date,value + 2009-01-01,10 + 2009-02-01,1 + 'NA', 3), colClasses=c(Date, 'integer')) str(x) 'data.frame': 3 obs. of 2 variables: $ date :Class 'Date' num [1:3] 14245 14276 NA $ value: int 10 1 3 x -

  1   2   >