Re: [R] How can we let "multiplot.R" return a plot?

2016-01-14 Thread Jim Lemon
Hi Miao, If I understand your question correctly, you want to get a return value from the "multiplot" function that you have copied into your message. You could simply add: return(plotlist) just before the final right brace in the function and it would return the list of plots that you have creat

Re: [R] How can we let "multiplot.R" return a plot?

2016-01-14 Thread David Winsemius
> On Jan 14, 2016, at 9:26 PM, jpm miao wrote: > > Hi, > > The function "ggplot" does plot and return a plot. For example, we can > write: > > y = ggplot(.. .) Then y is a plot. > > How can we modify the multiplot function so that it can also return a > plot? Multiplot.R is here: >

[R] How can we let "multiplot.R" return a plot?

2016-01-14 Thread jpm miao
Hi, The function "ggplot" does plot and return a plot. For example, we can write: y = ggplot(.. .) Then y is a plot. How can we modify the multiplot function so that it can also return a plot? Multiplot.R is here: http://www.cookbook-r.com/Graphs/Multiple_graphs_on_one_page_(ggp

[R] Multiplication of high dimensional array

2016-01-14 Thread guoxiong via R-help
In one of my applications, I need to perform following task in R: svector <- array(0, dim=c(5, 10, 360), dimnames=list(c('s1','s2','s3','s4','s5'), NULL, NULL))) tmatrix <- array(0, dim=c(10, 360, 5, 5), dimnames=list(NULL, NULL, c('s1','s2','s3','s4','s5'), c('s1','

Re: [R] Problem with rJava

2016-01-14 Thread ProfJCNash
Your post does not have the requested session information that will tell us your computing environment, nor the version of R. However, I'm experiencing at least a related problem, as this morning I updated R (in Linux Mind Rafaela 17.2, so I get an operating system notice to update via the package

[R] Problem with rJava

2016-01-14 Thread AASHISH JAIN
Hello, I am using an R package called Rknots, which uses rJava (and others like rSymPy, rjson, rJython) and I am getting some error due to rJava. When I run my R code, the execution gets halted with the following error: Error in .jcheck() : No running JVM detected. Maybe .jinit() would help. (f

[R] Tukey and extracting letters in multcomp

2016-01-14 Thread Lauren Moscoe
Hello, I have the following model: model <- lmer (Y ~ gen + (1|env) + (1|gen:env)) I would like to use Tukey's method to identify significant pairwise differences among levels of the factor gen, which has 18 levels. (Env has 3 levels.) I have been trying to do this using glht and cld in t

[R] Updating a Time Series After Forecast()

2016-01-14 Thread Lorenzo Isella
Dear All, Perhaps I am drowning in a cup of water, since I am positive that the answer will be a one-liner. Consider the following short script library(forecast) ts2<-structure(c(339130, 356462, 363234, 378179, 367864, 378337, 392157, 402

Re: [R] read.xlsx - write.xlsx: reading/writing numbers as character

2016-01-14 Thread jim holtman
That is what usually caused me problems in the past. Excel does not have the requirement that a column contain the same 'mode' of a variable. You can mix numeric and character in the same column and things will work fine in Excel; conversion to a data.frame does require the same mode in a column.

Re: [R] read.xlsx - write.xlsx: reading/writing numbers as character

2016-01-14 Thread Mohsen Jafarikia
Hi Jim, I found where the problem is. I had some characters in my list. Thanks very much for your attention and help! Mohsen On Thu, Jan 14, 2016 at 12:17 PM, Jim Holtman wrote: > Write it out as a csv from excel and see what the data looks like. That > may help in seeing what the problem i

Re: [R] read.xlsx - write.xlsx: reading/writing numbers as character

2016-01-14 Thread Mohsen Jafarikia
It looks okay on CSV too. On Thu, Jan 14, 2016 at 12:17 PM, Jim Holtman wrote: > Write it out as a csv from excel and see what the data looks like. That > may help in seeing what the problem is. > > > Sent from my Verizon Wireless 4G LTE Smartphone > > > Original message > Fr

Re: [R] Problems with data structure when using plsr() from package pls

2016-01-14 Thread David Winsemius
> On Jan 14, 2016, at 2:33 AM, CG Pettersson > wrote: > > Dear Jeff, > thanks for the effort, but the use of I() when preparing the dataset is > suggested by the authors (Mevik & Wehrens, section 3.2): > > +If Z is a matrix, it has to be protected by the ‘protect function’ I() in > calls >

Re: [R] read.xlsx - write.xlsx: reading/writing numbers as character

2016-01-14 Thread jim holtman
Take a look at the data coming in since you may have something that looks like characters (maybe 'blanks'). What you think is numeric in EXCEL might not be.​ Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. O

Re: [R] read.xlsx - write.xlsx: reading/writing numbers as character

2016-01-14 Thread Jim Holtman
Write it out as a csv from excel and see what the data looks like.  That may help  in seeing what the problem is. Sent from my Verizon Wireless 4G LTE Smartphone Original message From: Mohsen Jafarikia Date:01/14/2016 11:36 (GMT-05:00) To: jim holtman Cc: r-help Subject

Re: [R] R: layout() affects margin size in subfigures [unexpected behaviour]

2016-01-14 Thread Sarah Goslee
You're setting margin using mar, which is in terms of lines, which is, well, difficult to manage properly. ‘mar’ A numerical vector of the form ‘c(bottom, left, top, right)’ which gives the number of lines of margin to be specified on the four sides of the plot. The defau

Re: [R] read.xlsx - write.xlsx: reading/writing numbers as character

2016-01-14 Thread Mohsen Jafarikia
Thanks for the comment Jim. There is no blank cell. All have numbers. Mohsen On Thu, Jan 14, 2016 at 11:29 AM, jim holtman wrote: > Take a look at the data coming in since you may have something that looks > like characters (maybe 'blanks'). What you think is numeric in EXCEL might > not be.​

[R] R: layout() affects margin size in subfigures [unexpected behaviour]

2016-01-14 Thread Malcolm Perry
The absolute margin size of figures in R seems to be affected by the layout of the plot, which i think is surprising (not sure if it qualifies as a bug). The following plots have different margins sizes, with the 1x3 plot margins being smaller (thus giving a larger plot area). This is causing havoc

[R] parameter constraints in glm() and Bayesian version

2016-01-14 Thread mara . pfleiderer
Hello, I'm a mathematics student at Ulm University and currently I am working on my bachelor thesis about a Poisson regression model. For this, I am using the function glm () in R which is working very well. But still I have two questions to improve my model and I hope that you could help m

[R] read.xlsx - write.xlsx: reading/writing numbers as character

2016-01-14 Thread Mohsen Jafarikia
Hello: I am reading some excel files (each with one sheet) and trying to write them all in one file. I am not sure if read.xlsx reads some of the columns as character or write.xlsx writes them as character where they are not characters. I have 12 columns (2 character and 10 numbers). From 10 numbe

[R] zyp Vs. kendall package for Time Series Trend

2016-01-14 Thread Morteza Firouzi via R-help
Dear members, I need to detect trends in time series. To remove the effect of "Lag-1 serial correlation", it is suggested to use either Yue&Pilon or Zhang method. Both methods are available in "zyp" package. The package uses "kendall" package for trend analysis.   Based on Yue&Pilon (2002), if

Re: [R] Overlapping subject-specific histograms

2016-01-14 Thread Frank S.
Many thanks Petr! Best, Frank > From: petr.pi...@precheza.cz > To: f_j_...@hotmail.com; r-help@r-project.org > Subject: RE: [R] Overlapping subject-specific histograms > Date: Thu, 14 Jan 2016 12:03:16 + > > Hi > > change > > points( factor(names(tab)) + dist.overlap, data$sim[kat == i

[R] unexpected behaviour of an extended time series (using packages spuRs and xts)

2016-01-14 Thread Olivier ETERRADOSSI
Hi list, I thought I knew how to use extended time series (package xts), but I was wrong J � While preparing a toy example for something else, using data provided in R, I run into an unexpected problem and can�t figure by myself what is happening below, can anyone of you tell ? I searched t

Re: [R] Overlapping subject-specific histograms

2016-01-14 Thread PIKAL Petr
Hi change points( factor(names(tab)) + dist.overlap, data$sim[kat == i] , > type="h", col=2, lw =4) to points( 1:length(data$count[kat == i]) + dist.overlap, data$sims[kat == i] , type="h", col=2, lw =4) And do not use html post, your code could be scrammbled. Cheers Petr > -Original M

[R] Overlapping subject-specific histograms

2016-01-14 Thread Frank S.
Dear R users, First of all, excuse me if my doubt is very trivial, but so far I haven't been able to solve it. My question is this: I have a data frame which contains repeated measurements on 4 subjects coded as "id", and I want to plot, for each subject, not only the corresponding "counts" va

Re: [R] printing a data.frame that contains a list-column of S4 objects

2016-01-14 Thread boB Rudis
Martin, I'm pretty sure the use of Matrix here (actually by someone else than Dr Bryan) was to make an easy, inline, reproducible example. The actual "ugh" column comes from using git2r. I'm assuming there's an API call returning some pretty gnarly structures that are getting shoehorned into a data

Re: [R] Writing a matrix of lists as a CSV file

2016-01-14 Thread Jim Lemon
Hi Teo, Your "list" looks suspiciously like a vector. It might help if you provided the output of: str(my_matrix) (or whatever your matrix is named) as that would ensure that we were talking about the same objects. Jim On Thu, Jan 14, 2016 at 7:10 PM, TJUN KIAT TEO wrote: > > > I > have a ma

Re: [R] Writing a matrix of lists as a CSV file

2016-01-14 Thread PIKAL Petr
Hi I have no idea what you do want. You have several options how to save data in R. First three hits after my search "R save data" are https://stat.ethz.ch/R-manual/R-devel/library/base/html/save.html https://stat.ethz.ch/R-manual/R-devel/library/base/html/write.html http://www.statmethods.net/i

Re: [R] Problems with data structure when using plsr() from package pls

2016-01-14 Thread CG Pettersson
Dear Jeff, thanks for the effort, but the use of I() when preparing the dataset is suggested by the authors (Mevik & Wehrens, section 3.2): +If Z is a matrix, it has to be protected by the ‘protect function’ I() in calls +to data.frame: mydata <- data.frame(..., Z = I(Z)). Otherwise, it will be

Re: [R] printing a data.frame that contains a list-column of S4 objects

2016-01-14 Thread Martin Maechler
> boB Rudis > on Tue, 12 Jan 2016 13:51:50 -0500 writes: > I wonder if something like: > format.list <- function(x, ...) { > rep(class(x[[1]]), length(x)) > } > would be sufficient? (prbly needs more 'if's though) Dear Jenny, for a different perspective (and a lo

[R] Writing a matrix of lists as a CSV file

2016-01-14 Thread TJUN KIAT TEO
I have a matrix of lists in R that looks like this Crabs Glass nnet List,2 List,2rf List,1 List,1 An example of what a list looks like in the matrix size decay63 0.1 How can I write it into a csv file in R so I can retrieve it in the same format? Thanks