[R] Is there a convenient way of extracting the matrix `solve(X %*% t(X) + PENALTY)` from an additive model fit in mgcv?

2015-06-17 Thread Andrew Crane-Droesch
The title says it all. An additive model can be fit by `solve(X %*% t(X) + PENALTY)%*%t(X)%*%y` (though of course there are more efficient ways to do it). I want the matrix `solve(X %*% t(X) + PENALTY)` from a fitted gam object. GAM objects can be a bit tricky to navigate -- is there a convenie

Re: [R] Read text file

2015-06-17 Thread Olivier Crouzet
Hi, I think that you need scan() but you should at least give us an example of your text data. Olivier. -- Olivier Crouzet LLING - Laboratoire de Linguistique de Nantes - EA3827 Université de Nantes -Original Message- From: Steven Yen Sender: "R-help" Date: Thu, 18 Jun 2015 01:10:39

Re: [R] Read text file

2015-06-17 Thread William Dunlap
I am not sure what you mean by "a block", but you can probably use scan() instead of read.table(): > txt <- "1 21 41 61 81" > d <- data.frame(Numbers=scan(text=txt, what="numeric", quiet=TRUE)) > d Numbers 1 1 2 21 3 41 4 61 5 81 Bill Dunlap TIBCO Sof

[R] Read text file

2015-06-17 Thread Steven Yen
How do I read a block of space-delimited numbers into a column vector using the read.table command? Thank you. -- Steven Yen __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do re

[R] generating a data frame for plm regression

2015-06-17 Thread T.Riedle
Hi everybody, I am working with the plm package. I am struggling with the generation of the data frame in the plm() function. An example of my data are found in the attachment and I want to run a pooled regression on those. Hence, I need to generate a data frame using pdata.frame() function and

Re: [R] how to call rbind using arguments from a list

2015-06-17 Thread Rolf Turner
I *think* you want: ZC <- do.call(rbind,lapply(a,get)) But why do you make "a" a *list* of names rather than a vector of names? Generally one uses lists to hold "complicated" structures. A sequence of character scalars is best stored in an atomic vector. cheers, Rolf Turner P. S. Thank

Re: [R] Replace values in a dataframe

2015-06-17 Thread Grams Robins via R-help
Try this:  dat=structure(list(Color = c("5", "<4","5", "<5", "5"), Unit = c("Hazen","Hazen","Hazen", "Hazen", "Hazen")), .Names = c("Color", "Unit"), row.names =c("1:2","1:3", "1:4", "1:5","1:6"), class = "data.frame") dat=as.data.frame(dat)dat$col2 <- rep(" ", nrow(dat))dat[dat$Color == "<4", ][

[R] Proc Mixed variance of random effects in R

2015-06-17 Thread Grams Robins
Hi, I'm trying to convert the following SAS code in R to get the same result that I get from SAS. Here is the SAS code: DATA plants; INPUT sample $ treatmt $ y ; cards; 1 trt16.426264755 1 trt16.95419631 1 trt16.64385619 1 trt27.34872815

[R] help

2015-06-17 Thread Sarah Bazzocco
Hello, � I am a R-beginner and I need some help.�The question is very simple: I need to do a pearson correlations (r,p-value and FDR with BH) from an Expression array (with several thousand genes for lets say 20 cell lines)�with some features of those cell lines. My problem I have is

[R] Problems using nlmrt package

2015-06-17 Thread Carlos Ortiz Oñate
Hello to everybody, I want to implement a non-linear least square curve fitting and I am using the package "nlmrt", concretely the function nlxb. I have a dataset with three variables and 176 values, one response variables (R) and two predicting variables (T and H). When I fit a model of the form

[R] mlogit.effects()

2015-06-17 Thread Simon Kiss
Dear colleagues, I am struggling mightily with the mlogit package. First, the reason that I am using mlogit as opposed to multinom() in nnet is because my data is ranked, not just ordinal. So, I’m really trying to fit an exploded logit or rank-ordered model. All of the covariates of interest

Re: [R] Replace values in a dataframe

2015-06-17 Thread Bert Gunter
Is the following what you want: (z is your data frame) > change <-c("2","2.5") > names(change) <- c("<4","<5") (note: this can be automated using regular expressions and will work for lots more values to change. Sarah's ifelse() solution is fine for the example, but becomes too cumbersome (as sh

Re: [R] Replace values in a dataframe

2015-06-17 Thread Sarah Goslee
Hi Shane, On Wed, Jun 17, 2015 at 1:31 PM, Shane Carey wrote: > Hey all, > > I have a dataframe that consists of: > > structure(list(Color = c("5", "<4","5", "<5", "5"), Unit = c("Hazen", > "Hazen", > "Hazen", "Hazen", "Hazen")), .Names = c("Color", "Unit"), row.names = > c("1:2", > "1:3", "1:4",

[R] Replace values in a dataframe

2015-06-17 Thread Shane Carey
Hey all, I have a dataframe that consists of: structure(list(Color = c("5", "<4","5", "<5", "5"), Unit = c("Hazen", "Hazen", "Hazen", "Hazen", "Hazen")), .Names = c("Color", "Unit"), row.names = c("1:2", "1:3", "1:4", "1:5","1:6"), class = "data.frame") I need to find the <4 and have a new colum

[R] Merra hourly data

2015-06-17 Thread Alemu Tadesse
I am wondering if any has a script to download hourly Merra data (I am interested in wind speed and temperature) Thank you for your help AT [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, s

[R] problem in function specieslevel of bipartite

2015-06-17 Thread Bernardo Santos
Dear all, I have data for an bipartite mutualistic interaction network and I am trying to generate network metrics for this data set. All metrics could be calculated correctly. However, when trying to run specieslevel function of the package "bipartite", I have the following problem: xx <- specie

Re: [R] how to call rbind using arguments from a list

2015-06-17 Thread Bert Gunter
1. It should be: a<-as.list(ls(pattern= "^Z.")) to get "Z" at the beginning and 1 further character. 2. Use do.call() instead of call(). The latter does not evaluate the call; the former does. 3. But most important, the "args" argument of do.call() must be a list of names, not character strin

[R] how to call rbind using arguments from a list

2015-06-17 Thread Matteo
Hello R users, I am trying to run the command rbind gathering the name of tables to bind from a list argument. Unfortunately I am not able to obtain it. I would appreciate any suggestions. Below is a reproducible example with the problem. Thanks Matteo

Re: [R] Error bars and CI

2015-06-17 Thread Mohan.Radhakrishnan
I think it could be something like this. But the mean is for the entire set. Not groups. I get a graph with this code but error bars are not there. p<-ggplot(jc,aes(IDX,V1,colour=V1)) p <- p + stat_summary(fun.y=mean,geom="point") p <- p + stat_summary(fun.y=mean,geom="line") p <- p + stat_summa

Re: [R] Error bars and CI

2015-06-17 Thread Mohan.Radhakrishnan
Your sample code is working. But I am missing the logic when my dataset is involved. My full dataset is this. It is the V1 column I am interested in. I am not 'grouping' here. V1 IDX 1 0.796 1 2 0.542 2 3 0.510 3 4 0.617 4 5 0.482 5 6 0.387 6 7 0.272 7 8 0.536 8 9

Re: [R] Restricting Decimal Places in the Output

2015-06-17 Thread PIKAL Petr
Hi It does not make sense. How you can get same result counting mean and sum? The only way I can imagine is that you have only one value per date. So aggregate does virtually nothing. round gives you n decimal places based on its second parameter. > set.seed(111) > x<-rnorm(1) > x<-x*1000 > ro

Re: [R] Restricting Decimal Places in the Output

2015-06-17 Thread Michael Dewey
Dear Shivi On 17/06/2015 13:15, Shivi82 wrote: Hi Petr, The solution you shared worked though it does not show any decimal values. The output is Group.1 x 11/1/2015309450 2 1/10/2015 332780 Instead of mean i used sum & i think that should be fine. aggr<-aggregate(retail

Re: [R] Restricting Decimal Places in the Output

2015-06-17 Thread Shivi82
Hi Petr, The solution you shared worked though it does not show any decimal values. The output is Group.1 x 11/1/2015309450 2 1/10/2015 332780 Instead of mean i used sum & i think that should be fine. aggr<-aggregate(retail$weight,list(retail$ship.date),function(x) round

Re: [R] Polysomnographic data analysis with R?

2015-06-17 Thread Charles Novaes de Santana
Dear Jim, Thank you for your response. Yes, it is the European Data Format you mention. Actually we can read the data correctly, but I was wondering if there is any package that can identify different sleep phases automatically based on the data. I supposed such a package does not exist, it is rea

Re: [R] Polysomnographic data analysis with R?

2015-06-17 Thread Jim Lemon
Hi Charles, This looks like the European Data Format (EDF and EDF+), which has a complete file specification. If there is no existing R package, it might be possible to write an import function from the specification, something like the functions in the "foreign" package. Jim On Wed, Jun 17, 201

Re: [R] Aggregating on date at Monthly Level

2015-06-17 Thread PIKAL Petr
Hi > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Shivi82 > Sent: Wednesday, June 17, 2015 9:19 AM > To: r-help@r-project.org > Subject: [R] Aggregating on date at Monthly Level > > HI All, > I have situation where i am aggregating weight on monthly

Re: [R] cluster analysis

2015-06-17 Thread PIKAL Petr
Hi > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Venky > Sent: Wednesday, June 17, 2015 8:43 AM > To: R Help R > Subject: [R] cluster analysis > > Hi friends, > > I have data like this > In R or elsewhere? > > > Group > Employee size WOE Employe

Re: [R] Restricting Decimal Places in the Output

2015-06-17 Thread PIKAL Petr
Hi > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Shivi82 > Sent: Wednesday, June 17, 2015 7:50 AM > To: r-help@r-project.org > Subject: [R] Restricting Decimal Places in the Output > > Good Morning All, > > I have working on a data set where I am fi

[R] Aggregating on date at Monthly Level

2015-06-17 Thread Shivi82
HI All, I have situation where i am aggregating weight on monthly and quarterly level. I need to summarize weight on variable ship date i.e. shipping date . As this date is in a character format so used the conversion as: Shipdate<-as.Date("retail$ship.date", format="%m-%d-%Y"). But when i see th