Re: [R] Help with the plot function

2017-06-20 Thread André Luis Neves
Dear all, I found the last example of this link ( https://sites.ualberta.ca/~lkgray/uploads/7/3/6/2/7362679/6c_-_line_plots_with_error_bars.pdf) very similar to the one I need to make for my paper, and I think I got what I wanted by applying some of the suggestions of this mail list. Here it is t

[R] New book: Spatial, Temporal and Spatial-Temporal Ecological Data Analysis with R-INLA

2017-06-20 Thread Highland Statistics Ltd
We are pleased to announce the following book: Spatial, Temporal and Spatial-Temporal Ecological Data Analysis with R-INLA Authors: Zuur, Ieno, Saveliev Book website: www.highstat.com Paperback or EBook can be order (exclusively) from www.highstat.com TOC: http://highstat.com/Books/BGS/SpatialTe

Re: [R] Help with the plot function

2017-06-20 Thread André Luis Neves
Hi, Petr, Indeed, your code is much better than the one I presented. I made small editings. par(mfrow = c(2, 1)) par(cex = 0.6) par(mar = c(0, 0, 0, 0), oma = c(7, 7, 0.5, 5)) par(tcl = -0.25) par(mgp = c(2, 0.6, 0)) plot(BUD~YEAR, type="o", ann=F, axes=F, pch=19, ylim=c(60,100),data=g1) axis(2,

[R] Help

2017-06-20 Thread Leonardo Malaguti
Dear expert friends, I'm pretty young of this world and my question at your eyes can be petty easy. I'll need to change the name of the levels inside a column of my data-frame levels(ind.davis$Ageclass) <- c("adult", "Juvanile", "sub-adult") names(ind.davis$Ageclass) <- c("Adult", "Juvenile", "Su

[R] How to write an estimated seasonal ARIMA model from R output?

2017-06-20 Thread Y S
I'm trying to use the following command. arima (x, order = c(p,d,q), seasonal =list(order=c(P,D,Q), period=s) How can I write an estimated seasonal ARIMA model from the outputs. To be specifically, which sign to use? I know R uses a different signs from S plus. Is it correct that the model is: (

[R] Can I use tabu search for minimization problem ?

2017-06-20 Thread Mars Xu
Hi all, I want to use tabu search to solve my minimization problem. but tabu search in R is for maximization, so I turn my function from f to -f, but the eUtilityKeep always be 0 from the second position. I have go through a part of source code found that it always give the default value

[R] error while creating a simple graph

2017-06-20 Thread Yogesh Gupta
Dear All, I am learning R so it's a very simple problem but I do not understand while I am not able to generate a graph from two vectors. when I type this code, it generates a very nice graph. pdf("mygraph.pdf") > attach(mtcars) > plot(wt,mpg) > abline(lm(mpg~wt)) > title("Regreesion of mpg") >

Re: [R] Help

2017-06-20 Thread Christopher W Ryan
Leonardo-- R-help can be a very useful resource. Some suggestions to use it well: 1. use an informative subject line, not "help" 2. include a "minimal working example:" a *little* data, the code that, with those data, reproduces your problem, and the error message that resulted. As to your parti

Re: [R] Help

2017-06-20 Thread Adrian Dușa
One solution, among many, involving recoding. There is a function in package QCA called recode() (similar, but in my opinion more flexible than the same function recode() in package car) > library(QCA) > ind.davis$Ageclass <- recode(ind.davis$Ageclass, "adult = Adult; Juvanile = Juvenile; sub-adu

Re: [R] Can I use tabu search for minimization problem ?

2017-06-20 Thread Enrico Schumann
Zitat von Mars Xu : Hi all, I want to use tabu search to solve my minimization problem. but tabu search in R is for maximization, so I turn my function from f to -f, but the eUtilityKeep always be 0 from the second position. I have go through a part of source code found that it always gi

Re: [R] translate formula into R code

2017-06-20 Thread Jeff Newmiller
This is an excellent exercise for you, the beginner. If you explicitly want a line-by-line translation and don't want to use the strengths of R (vectorization/functions) then there isn't much point in asking us to read the Introduction to R document that comes with the software for you. Please

Re: [R] error while creating a simple graph

2017-06-20 Thread PIKAL Petr
Hi Did you close pdf device by dev.off() ? Cheers Petr > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Yogesh Gupta > Sent: Tuesday, June 20, 2017 7:18 AM > To: r-help@r-project.org > Subject: [R] error while creating a simple graph > > Dear All,

Re: [R] error while creating a simple graph

2017-06-20 Thread Rui Barradas
Hello, You don't need dev.new, but you need to tell R that the plot is finished by calling dev.off after the plot command. Hope this helps, Rui Barradas Em 20-06-2017 06:18, Yogesh Gupta escreveu: Dear All, I am learning R so it's a very simple problem but I do not understand while I am no

Re: [R] translate formula into R code

2017-06-20 Thread Jeff Newmiller
Cc'd back to the list... always use reply-all. You say res should have been LSS but LSS is a scalar so the for loop will only run once. What does a successful output look like for a sample input? How do you (we) know when success has been achieved? In fact, what is the formula you want to imple

Re: [R] Help

2017-06-20 Thread David L Carlson
As Chris points out, we do not know what the factor labels were before you tried to change them. The levels() function should have worked as long as it included all of the factor levels in the same order. The names() function lists the names of an object. For a data frame that is the column head

[R] by can not find transpose function

2017-06-20 Thread Sorkin, John
I am trying to transpose a dataframe by its first column using the by statement using the t function. When I use the by function, I get a message, Error in FUN(X[[i]], ...) : could not find function "FUN" I don't think I have a syntax error in my by statement because the by statment works using

Re: [R] error while creating a simple graph

2017-06-20 Thread Rainer Krug
> On 20 Jun 2017, at 07:18, Yogesh Gupta wrote: > > Dear All, > > I am learning R so it's a very simple problem but I do not understand while > I am not able to generate a graph from two vectors. > > when I type this code, it generates a very nice graph. > > pdf("mygraph.pdf") >> attach(mtcar

Re: [R] by can not find transpose function

2017-06-20 Thread David Winsemius
> On Jun 20, 2017, at 7:19 AM, Sorkin, John wrote: > > I am trying to transpose a dataframe by its first column using the by > statement using the t function. When I use the by function, I get a message, > > Error in FUN(X[[i]], ...) : could not find function "FUN" > > I don't think I have a

Re: [R] by can not find transpose function

2017-06-20 Thread Rui Barradas
Hello, Works fine also with me: > by(phonydata2[,2:3],phonydata2[,1],t) phonydata2[, 1]: CONTROL 1 2 3 5 6 7 8 11 12 13 17 20 22 23 25 26 27 29 HGDOM1_MW1 NA NA NA NA NA 17 30 16 16 14 12 NA NA 13.5 1 NA 12 NA HGDOM1_W1 8 NA NA NA NA 18 NA 14 8 NA 15 9 NA 14.0 2 NA 18 NA

Re: [R] translate formula into R code

2017-06-20 Thread David L Carlson
The attached png file shows the expected output. The loop is complicated because the values multiplied shift in value and sign so your effort to sum the values along the way fails. It we compute the first two values directly and create arrays to handle the changing multipliers, the loop is prett

[R] 3D plot with coordinates

2017-06-20 Thread Alaios via R-help
HelloI have three x,y,z vectors (lets say each is set as  rnorm(360)). So each one is having 360 elements each one correpsonding to angular coordinates (1 degree, 2 degrees, 3 degrees, 360 degrees) and I want to plot those on the xyz axes that have degress. Is there a function or library to

Re: [R] 3D plot with coordinates

2017-06-20 Thread Uwe Ligges
package rgl. Best, Uwe Ligges On 20.06.2017 21:29, Alaios via R-help wrote: HelloI have three x,y,z vectors (lets say each is set as rnorm(360)). So each one is having 360 elements each one correpsonding to angular coordinates (1 degree, 2 degrees, 3 degrees, 360 degrees) and I want to

Re: [R] R_using non linear regression with constraints

2017-06-20 Thread J C Nash
I took another look at the problem. Essentially there isn't enough information in the data to estimate the parameters. What there is doesn't have the right shape for the model. You can see this by plotting the data -- essentially a straight line. Get the slope as follows: rr <- mean(mydata

[R] fitting cosine curve

2017-06-20 Thread lily li
Hi R users, I have a question about fitting a cosine curve. I don't know how to set the approximate starting values. Besides, does the method work for sine curve as well? Thanks. Part of the dataset is in the following: y=c(16.82, 16.72, 16.63, 16.47, 16.84, 16.25, 16.15, 16.83, 17.41, 17.67, 17.

Re: [R] fitting cosine curve

2017-06-20 Thread Jim Lemon
Hi lily, You can get fairly good starting values just by eyeballing the curves: plot(y) lines(supsmu(1:20,y)) lines(0.6*cos((1:20)/3+0.6*pi)+17.2) Jim On Wed, Jun 21, 2017 at 9:17 AM, lily li wrote: > Hi R users, > > I have a question about fitting a cosine curve. I don't know how to set the >

Re: [R] fitting cosine curve

2017-06-20 Thread lily li
Thanks, that is cool. But would there be a way that can approximate the curve by trying more starting values automatically? On Tue, Jun 20, 2017 at 5:45 PM, Jim Lemon wrote: > Hi lily, > You can get fairly good starting values just by eyeballing the curves: > > plot(y) > lines(supsmu(1:20,y)) >

Re: [R] [FORGED] How to write an estimated seasonal ARIMA model from R output?

2017-06-20 Thread Rolf Turner
On 20/06/17 17:21, Y S wrote: I'm trying to use the following command. arima (x, order = c(p,d,q), seasonal =list(order=c(P,D,Q), period=s) How can I write an estimated seasonal ARIMA model from the outputs. To be specifically, which sign to use? I know R uses a different signs from S plus. Is

[R] Problem with shortestPath in igraph and qgraph

2017-06-20 Thread Zahra Tofighi
hello, I have a graph and i use qgraph package to calculate centrality parameters. Now I want to know the maximum value of shortest path for each vertex with discarding the Inf value in short pathes. For this I use the ShortestPathLengths of centrality function in qgraph. but when I want to get th

Re: [R] fitting cosine curve

2017-06-20 Thread Jim Lemon
What I did was to plot your initial values, then plot the smoothed values and guess the constants. That is, I got an "eyeball" fit to the smoothed values. As I have described this as "gross cheating" in the past, you should either split your data, estimate on one subset and then test on another, or

[R] customizing color key with plot3D

2017-06-20 Thread Waichler, Scott R
Hi, I am doing composite plots with the package plot3D. One of my variables is qualitative and indexed to integers, and I would like the legend for it to have labels located at the integer values (midpoints), and not at the breaks between classes. In the example below, the Elev Classes legend

Re: [R] fitting cosine curve

2017-06-20 Thread lily li
Thanks. I will do a trial first. Also, is it okay to have the datasets that have only part of the cycle, or better to have equal or more than one cycle? That is to say, I cannot have the complete datasets sometimes. On Tue, Jun 20, 2017 at 7:37 PM, Don Cohen wrote: > > If you know the period and

Re: [R] fitting cosine curve

2017-06-20 Thread lily li
I'm trying the different parameters, but don't know what the error is: Error in nlsModel(formula, mf, start, wts) : singular gradient matrix at initial parameter estimates Thanks for any suggestions. On Tue, Jun 20, 2017 at 7:37 PM, Don Cohen wrote: > > If you know the period and want to fit

Re: [R] fitting cosine curve

2017-06-20 Thread Charles C. Berry
On Tue, 20 Jun 2017, lily li wrote: Hi R users, I have a question about fitting a cosine curve. I don't know how to set the approximate starting values. See Y.L. Tong (1976) Biometrics 32:85-94 The method is known as `cosinor' analysis. It takes advantage of the *intrinsic* linear

Re: [R] fitting cosine curve

2017-06-20 Thread Don Cohen
If you know the period and want to fit phase and amplitude, this is equivalent to fitting a * sin + b * cos > >>> > I don't know how to set the approximate starting values. I'm not sure what you meant by that, but I suspect it's related to phase and amplitude. > >>> > Besides, does the method

Re: [R] Problem with shortestPath in igraph and qgraph

2017-06-20 Thread Jeff Newmiller
Hard to follow data analysis without data. Try making your example reproducible [1][2][3] and post in plain text (a setting in your emailer). Read the Posting Guide mentioned in the footer to avoid other posting pitfalls. [1] http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-rep