Re: [R] irregular sequence of events

2015-02-23 Thread PIKAL Petr
Thanks to all who responded. I like Sarah's solution best, although it did provide only a clue. It just needed a little of tweak to finish with suitable solution. For the record I put here this tweak (it is not fully reproducible but I hope it is understandable and can help others too). #

Re: [R] colours in ggplot2

2015-02-23 Thread Jose Iparraguirre
Dear Antonello, How about this? Obviously, you can change the background colours for the confidence levels (deprespal) and for the regression lines, etc. Surely, many in the list can improve on my rough and ready solution. deprespal=c(#CC,#99) p2 - ggplot(data = df, aes(x

Re: [R] Split a dataframe by rownames and/or colnames

2015-02-23 Thread Tim Richter-Heitmann
Thank you very much for the line. It was doing the split as suggested. However, i want to release all the dataframes to the environment (later on, for each dataframe, some dozen lines of code will be carried out, and i dont know how to do it w lapply or for-looping, so i do it separately):

Re: [R] Split a dataframe by rownames and/or colnames

2015-02-23 Thread Sergio Fonda
Did you try dplyr package? Sergio Il 23/feb/2015 13:05 Tim Richter-Heitmann trich...@uni-bremen.de ha scritto: Thank you very much for the line. It was doing the split as suggested. However, i want to release all the dataframes to the environment (later on, for each dataframe, some dozen lines

[R] Save rules with asRules() from Rattle into dataframe

2015-02-23 Thread Kim C.
Hello,  I use asRules from the Rattle package to make rules of a rpart decision tree: asRules(rpart1). It gives a rule such as (don't mind the data, it's merely testdata):   Rule number: 18 [Product=153 cover=3 (1%) prob=0.00]    TotalChildren=4.5    Education=Bachelors,Partial

Re: [R] convert number back to point separated date

2015-02-23 Thread peter dalgaard
On 23 Feb 2015, at 15:06 , Alain D. dialva...@yahoo.de wrote: Dear R-List I have a date column formatted dd.mm. separated by points that was converted into a number using as.integer(date). Now I wish to convert the number back into the original date. Something like:

[R] convert number back to point separated date

2015-02-23 Thread Alain D.
Dear R-List I have a date column formatted dd.mm. separated by points that was converted into a number using as.integer(date). Now I wish to convert the number back into the original date. Something like: date-as.factor(c(07.12.2010,29.04.2013)) dd-as.integer(date) as.Date(dd,

Re: [R] Split a dataframe by rownames and/or colnames

2015-02-23 Thread David Winsemius
On Feb 23, 2015, at 4:03 AM, Tim Richter-Heitmann wrote: Thank you very much for the line. It was doing the split as suggested. However, i want to release all the dataframes to the environment (later on, for each dataframe, some dozen lines of code will be carried out, and i dont know how

[R] [offtopic] nice R related domains to give away

2015-02-23 Thread Hans-Peter Suter
Since some years I have the following domains which I don't need any longer (and in fact never used despite some plans) - developr.org - editr.org - helpr.org It makes no sense to hoard domains and I plan to give them away for a 'good cause'. I'd like to have a small fee for the costs but

Re: [R] Not finding superclass in library

2015-02-23 Thread Ramiro Barrantes
Thank you for pointing this out. I had no idea about the distinction but there are some good references on the matter (http://www.r-bloggers.com/packages-v-libraries-in-r/). I am pasting the corrected version below, any suggestions appreciated: I have a package that I created that defines a

[R] Basic data frame manipulation

2015-02-23 Thread Jon BR
Hi R-help, Although I know that variations of this question are frequently asked, I searched and haven't found an answer for this specific variant, and wonder if any of you know this off the top of your head: df1 - data.frame(a = 1:5, row.names = letters[1:5]) # letters a to

[R] Problem installing with devtools

2015-02-23 Thread Conklin, Mike (GfK)
I am trying to install the swirl library via devtools with the following results devtools::install_github(c(swirldev/swirl, swirldev/swirlify)) Installing github repo swirl/master from swirldev Downloading master.zip from https://github.com/swirldev/swirl/archive/master.zip Installing package

[R] dplyr: producing a good old data frame

2015-02-23 Thread John Posner
I'm using the dplyr package to perform one-row-at-a-time processing of a data frame: rnd6 = function() sample(1:300, 6) frm = data.frame(AA=rnd6(), BB=rnd6(), CC=rnd6()) frm AA BB CC 1 123 50 45 2 12 30 231 3 127 147 100 4 133 32 129 5 66 235 71 6 38 264 261 The interface is

Re: [R] Replacing 9999 and 999 values with NA

2015-02-23 Thread David L Carlson
Just for the record, you do not need cbind(): wind - data.frame(windSpeed,windDirec) Using cbind() does not create a problem as long as the columns are all numeric, but if your data frame contains a mixture of numeric, factor, and character columns, cbind() will mess things up.

[R] Not finding superclass in library

2015-02-23 Thread Ramiro Barrantes
Hello, I have a library that I created that defines a parent class, assayObject. I created other classes that inherit from it, say assayObjectDemo. Each one of those classes I wanted to make in its own directory separate from where the assayObject is defined (there are reasons for that). But

Re: [R] Not finding superclass in library

2015-02-23 Thread Rolf Turner
On 24/02/15 09:35, Ramiro Barrantes wrote: Hello, I have a library that I created . SNIP No you ***DO NOT***. You have a ***PACKAGE***. If you cannot even get your terminology straight, what hope is there for you? cheers, Rolf Turner -- Rolf Turner Technical Editor ANZJS

Re: [R] Extracting Factor Pattern Matrix Similar to Proc Factor

2015-02-23 Thread David L Carlson
Function principal() in psych takes a correlation matrix so use cov2cor() to convert: library(psych) iris.pca - principal(cov2cor(cov(iris[,-5])), nfactors=4, rotate=none) print(iris.pca$Structure, cutoff=0) David -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On

Re: [R] Replacing 9999 and 999 values with NA

2015-02-23 Thread Sarah Goslee
Hi, On Monday, February 23, 2015, Alexandra Catena amc5...@gmail.com wrote: The command, data[data ==] - NA, worked! Thank you! But just in case you wanted to know, I'm downloading the data and unzipping it through readLines. I then concatenate two columns ( wind speed and direction)

Re: [R] Extracting Factor Pattern Matrix Similar to Proc Factor

2015-02-23 Thread Scott Colwell
Thanks David. What do you do when the input is a covariance matrix rather than a dataset? -- View this message in context: http://r.789695.n4.nabble.com/Extracting-Factor-Pattern-Matrix-Similar-to-Proc-Factor-tp4703704p4703719.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Basic data frame manipulation

2015-02-23 Thread Ista Zahn
Something like tmp - merge(df1, df2, by = row.names, all.x = TRUE) merge(tmp, df3, by.x = Row.names, by.y = row.names, all.x = TRUE) perhaps? On Mon, Feb 23, 2015 at 4:25 PM, Jon BR jonsle...@gmail.com wrote: Hi R-help, Although I know that variations of this question are frequently

[R] Extracting Factor Pattern Matrix Similar to Proc Factor

2015-02-23 Thread Scott Colwell
Hello, I am fairly new to R and coming from SAS IML. I am rewriting one of my MC simulations in R and am stuck on extracting a factor pattern matrix as would be done in IML using Proc Factor. I have found the princomp() command and read through the manual but can't seem to figure out how to

Re: [R] Extracting Factor Pattern Matrix Similar to Proc Factor

2015-02-23 Thread David L Carlson
The pattern matrix is easy to compute from the results of princomp(). First we need a reproducible example so we'll use the iris data set (use ?iris for details) that comes with R. data(iris) iris.pc - princomp(iris[,-5], cor=TRUE) print(iris.pc$loadings, cutoff=0) Loadings:

Re: [R] Extracting Factor Pattern Matrix Similar to Proc Factor

2015-02-23 Thread William Revelle
David and Scott, principal will also take a covariance matrix (set the cover option to TRUE) library(psych) C - cov(iris[-5]) pc4 - principal(C,4,covar=TRUE,rotate=none”) However, in the case of no rotation or orthogonal rotations, the structure matrix and the pattern matrix are identical.

Re: [R] Not finding superclass in library

2015-02-23 Thread Charles C. Berry
On Mon, 23 Feb 2015, Ramiro Barrantes wrote: Thank you for pointing this out. I had no idea about the distinction but there are some good references on the matter (http://www.r-bloggers.com/packages-v-libraries-in-r/). I am pasting the corrected version below, any suggestions appreciated:

Re: [R] Error with using windRose function from the open air package

2015-02-23 Thread Jeff Newmiller
I have no magic answer for you, just some suggestions until you can clarify your problem. Your description of loading one column in at a time is a bit odd... It is much more typical to use one of the read.table variants. Don't use cbind to make data frames. If you have any non-numeric columns

[R] Error with using windRose function from the open air package

2015-02-23 Thread Alexandra Catena
Hello All, I have a data frame called windSFO of four columns, wind speed, wind direction, station number, and date (mmdd). I downloaded the gz data from a site online and then unzipped it using readLines. I then concatenated these four columns from the unzipped data into a dataframe using

[R] how to standardize raster image (GeoTiff) in R?

2015-02-23 Thread Angela Smith
Hi R user, Would you give me some hints on to standardize the raster image (GeoTiff). I used the following code but did not work. would you give me some hints on it? #-- #code # center with 'apply()' center_apply - function(x) { apply(x, 2, function(y) y -

Re: [R] how to standardize raster image (GeoTiff) in R?

2015-02-23 Thread Bert Gunter
Take a look at im1 and im2. You will find that they are just the quoted names. You have imported nothing. Have you made any effort to read R's or the GeoTiff's tutorials? -- you appear to not have a clue about how either works. Also see ?scale, which will do what you appear to want much much