Re: [R] date and time data on x axis

2018-11-03 Thread snowball0916
Hi, Bert
I will check those two, by the way, how can you find the two function? have you 
used them before?
Thanks very much.
 


 
From: Bert Gunter
Date: 2018-11-04 10:07
To: snowball0916
CC: MacQueen, Don; R-help
Subject: Re: [R] date and time data on x axis
See ?identify and ?locator

Cheers,
Bert

Bert Gunter

"The trouble with having an open mind is that people keep coming along and 
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Sat, Nov 3, 2018 at 6:47 PM snowball0916  wrote:
Hi, Don
After I've tried 1 month data. It show me like attachment.

The problem is it's hard to identify the the high point from the graph.
Is there possible, when my cursor move on some point , it will show me both x 
axis and y axis data?
OR 
Is there other way to get the same goal?

Thanks very much.





From: MacQueen, Don
Date: 2018-10-30 00:01
To: snowball0916; r-help
Subject: Re: [R] date and time data on x axis
Here's an example of 24 hours of data at one second intervals.

npts <- 24*60*60

df <- data.frame(
 tm = seq( Sys.time(), by='1 sec', length=npts),
 yd = round(runif(npts),2)
 )

head(df)

with(df, plot(tm,yd))

The x axis appears to me to be displayed in a neat and clean way. I don't 
understand what the problem is.
(The data itself is illegible, but that's a different problem.)

The default axis may not be what you want, but it is neat and clean. To choose 
the axis tick marks and labels yourself, use axis() or axis.POSIXct, as Rui 
mentioned.  help(axis.POSIXct) provides examples of actual use.

I prefer to do as much as possible with base R, so look at this example:

> as.POSIXct( '20181028_10:00:00' , format='%Y%m%d_%H:%M:%S')
[1] "2018-10-28 10:00:00 PDT"

Therefore 
  xdata <- as.POSIXct(mydata$V1, format='%Y%m%d_%H:%M:%S')
is perfectly adequate (the lubridate package is not essential here)


par() is the function that sets graphical parameters. There are many graphical 
parameters.
"mar" is the parameter that specifies the sizes of the plot margins  ( see ?par 
)

This expression
   op <- par(mar = c(4, 0, 0, 0) + par("mar"))
is a way to modify the values of the "mar" parameter.

Type the following commands
   par('mar')
   par()$mar## an alternative
   c(4,0,0,0) + par('mar')
   par(mar = c(4, 0, 0, 0) + par("mar"))
   par('mar')## to see that the margins have been changed

--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
Lab cell 925-724-7509

On 10/28/18, 8:16 AM, "R-help on behalf of snowball0916" 
 wrote:

Hi, guys
How do you guys deal with the date and time data on x axis?
I have some trouble with it. Could you help with this?

=
Sample Data
=
The sample data look like this:

20181028_10:00:00 600 
20181028_10:00:01 500 
20181028_10:00:02 450 
20181028_10:00:03 660
..

=
My Code
=

library(lubridate)
mydata <- read.table("e:/R_study/graph_test2.txt")
xdata <- ymd_hms(mydata$V1)
ydata <- mydata$V2
plot(xdata, ydata, type="o")


=
Questions:
=

1. Why my x axis does not show me the correct date time like ""2018-10-28 
10:00:00 UTC" ?
2. If my data is very huge(like data in every second and the data has the 
whole day , even the whole month), how can I display the x axis in a neat and 
clean way?

Thanks very much.




[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] date and time data on x axis

2018-11-03 Thread Bert Gunter
See ?identify and ?locator

Cheers,
Bert

Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Sat, Nov 3, 2018 at 6:47 PM snowball0916  wrote:

> Hi, Don
> After I've tried 1 month data. It show me like attachment.
>
> The problem is it's hard to identify the the high point from the graph.
> Is there possible, when my cursor move on some point , it will show me
> both x axis and y axis data?
> OR
> Is there other way to get the same goal?
>
> Thanks very much.
>
>
>
>
>
> From: MacQueen, Don
> Date: 2018-10-30 00:01
> To: snowball0916; r-help
> Subject: Re: [R] date and time data on x axis
> Here's an example of 24 hours of data at one second intervals.
>
> npts <- 24*60*60
>
> df <- data.frame(
>  tm = seq( Sys.time(), by='1 sec', length=npts),
>  yd = round(runif(npts),2)
>  )
>
> head(df)
>
> with(df, plot(tm,yd))
>
> The x axis appears to me to be displayed in a neat and clean way. I don't
> understand what the problem is.
> (The data itself is illegible, but that's a different problem.)
>
> The default axis may not be what you want, but it is neat and clean. To
> choose the axis tick marks and labels yourself, use axis() or axis.POSIXct,
> as Rui mentioned.  help(axis.POSIXct) provides examples of actual use.
>
> I prefer to do as much as possible with base R, so look at this example:
>
> > as.POSIXct( '20181028_10:00:00' , format='%Y%m%d_%H:%M:%S')
> [1] "2018-10-28 10:00:00 PDT"
>
> Therefore
>   xdata <- as.POSIXct(mydata$V1, format='%Y%m%d_%H:%M:%S')
> is perfectly adequate (the lubridate package is not essential here)
>
>
> par() is the function that sets graphical parameters. There are many
> graphical parameters.
> "mar" is the parameter that specifies the sizes of the plot margins  ( see
> ?par )
>
> This expression
>op <- par(mar = c(4, 0, 0, 0) + par("mar"))
> is a way to modify the values of the "mar" parameter.
>
> Type the following commands
>par('mar')
>par()$mar## an alternative
>c(4,0,0,0) + par('mar')
>par(mar = c(4, 0, 0, 0) + par("mar"))
>par('mar')## to see that the margins have been changed
>
> --
> Don MacQueen
> Lawrence Livermore National Laboratory
> 7000 East Ave., L-627
> Livermore, CA 94550
> 925-423-1062
> Lab cell 925-724-7509
>
> On 10/28/18, 8:16 AM, "R-help on behalf of snowball0916" <
> r-help-boun...@r-project.org on behalf of snowball0...@163.com> wrote:
>
> Hi, guys
> How do you guys deal with the date and time data on x axis?
> I have some trouble with it. Could you help with this?
>
> =
> Sample Data
> =
> The sample data look like this:
>
> 20181028_10:00:00 600
> 20181028_10:00:01 500
> 20181028_10:00:02 450
> 20181028_10:00:03 660
> ..
>
> =
> My Code
> =
>
> library(lubridate)
> mydata <- read.table("e:/R_study/graph_test2.txt")
> xdata <- ymd_hms(mydata$V1)
> ydata <- mydata$V2
> plot(xdata, ydata, type="o")
>
>
> =
> Questions:
> =
>
> 1. Why my x axis does not show me the correct date time like
> ""2018-10-28 10:00:00 UTC" ?
> 2. If my data is very huge(like data in every second and the data has
> the whole day , even the whole month), how can I display the x axis in a
> neat and clean way?
>
> Thanks very much.
>
>
>
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] date and time data on x axis

2018-11-03 Thread snowball0916
Hi, Don
After I've tried 1 month data. It show me like attachment.

The problem is it's hard to identify the the high point from the graph.
Is there possible, when my cursor move on some point , it will show me both x 
axis and y axis data?
OR 
Is there other way to get the same goal?

Thanks very much.
 
 


 
From: MacQueen, Don
Date: 2018-10-30 00:01
To: snowball0916; r-help
Subject: Re: [R] date and time data on x axis
Here's an example of 24 hours of data at one second intervals.
 
npts <- 24*60*60
 
df <- data.frame(
 tm = seq( Sys.time(), by='1 sec', length=npts),
 yd = round(runif(npts),2)
 )
 
head(df)
 
with(df, plot(tm,yd))
 
The x axis appears to me to be displayed in a neat and clean way. I don't 
understand what the problem is.
(The data itself is illegible, but that's a different problem.)
 
The default axis may not be what you want, but it is neat and clean. To choose 
the axis tick marks and labels yourself, use axis() or axis.POSIXct, as Rui 
mentioned.  help(axis.POSIXct) provides examples of actual use.
 
I prefer to do as much as possible with base R, so look at this example:
 
> as.POSIXct( '20181028_10:00:00' , format='%Y%m%d_%H:%M:%S')
[1] "2018-10-28 10:00:00 PDT"
 
Therefore 
  xdata <- as.POSIXct(mydata$V1, format='%Y%m%d_%H:%M:%S')
is perfectly adequate (the lubridate package is not essential here)
 
 
par() is the function that sets graphical parameters. There are many graphical 
parameters.
"mar" is the parameter that specifies the sizes of the plot margins  ( see ?par 
)
 
This expression
   op <- par(mar = c(4, 0, 0, 0) + par("mar"))
is a way to modify the values of the "mar" parameter.
 
Type the following commands
   par('mar')
   par()$mar## an alternative
   c(4,0,0,0) + par('mar')
   par(mar = c(4, 0, 0, 0) + par("mar"))
   par('mar')## to see that the margins have been changed
 
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
Lab cell 925-724-7509
 
On 10/28/18, 8:16 AM, "R-help on behalf of snowball0916" 
 wrote:
 
Hi, guys
How do you guys deal with the date and time data on x axis?
I have some trouble with it. Could you help with this?

=
Sample Data
=
The sample data look like this:

20181028_10:00:00 600 
20181028_10:00:01 500 
20181028_10:00:02 450 
20181028_10:00:03 660
..

=
My Code
=

library(lubridate)
mydata <- read.table("e:/R_study/graph_test2.txt")
xdata <- ymd_hms(mydata$V1)
ydata <- mydata$V2
plot(xdata, ydata, type="o")


=
Questions:
=

1. Why my x axis does not show me the correct date time like ""2018-10-28 
10:00:00 UTC" ?
2. If my data is very huge(like data in every second and the data has the 
whole day , even the whole month), how can I display the x axis in a neat and 
clean way?

Thanks very much.
 



[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

 
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] cox model

2018-11-03 Thread David Winsemius
It's also "well described" in the help materials for the obvious 
recommended package that ships with every copy of R. My copy sits at 
http://127.0.0.1:29434/library/survival/doc/timedep.pdf. Therneau's S 
package was first ported to R by Thomas Lumley and later Therneau took 
over maintenance.


--

David.

On 11/3/18 12:51 PM, Medic wrote:

I need a R-code for a situation that is well described in the sas help. I
would be very grateful for the help!
"Time-dependent variables can be used to model the effects of subjects
transferring from one treatment group to another. One example of the need
for such strategies is the Stanford heart transplant program. Patients are
accepted if physicians judge them suitable for heart transplant. Then, when
a donor becomes available, physicians choose transplant recipients
according to various medical criteria. A patient’s status can be changed
during the study from waiting for a transplant to being a transplant
recipient. Transplant status can be defined by the time-dependent covariate
function z=z(t) as:
z(t)= 0 (if the patient has not received the transplant at time t)
and 1 (if has received)

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Predict follow up time using parametric model in r

2018-11-03 Thread David Winsemius



On 11/3/18 12:59 PM, Israel Ortiz wrote:

I am trying to predict follow-up time using several survival models, both
parametric and semi-parametric. I achieve it for semi parametric models
using predict.coxph function in R from survival package using type =
"expected" as indicated in help. However, for parametric models, this
option doesn't exist for the predict.survreg function. Is there any other
option? Maybe using rms package?


I would imagine that the author thought that you should be able to 
rather simple construct a function that would return an estimate simply 
from the coefficients and the parametric equation for S(t).



That was also what Harrell does in his "Regression  Modeling Strategies" 
text. In the first edition the code is on page 437.


--

David




[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Predict follow up time using parametric model in r

2018-11-03 Thread David Winsemius



On 11/3/18 12:59 PM, Israel Ortiz wrote:

I am trying to predict follow-up time using several survival models, both
parametric and semi-parametric. I achieve it for semi parametric models
using predict.coxph function in R from survival package using type =
"expected" as indicated in help. However, for parametric models, this
option doesn't exist for the predict.survreg function. Is there any other
option? Maybe using rms package?


I would imagine that the author thought that you should be able to 
rather simple construct a function that would return an estimate simply 
from the coefficients and the parametric equation for S(t).



That was also what Harrell does in his "Regression  Modeling Strategies" 
text. In the first edition the code is on page 437.


--

David




[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] cox model

2018-11-03 Thread Jeff Newmiller
Stop re-posting this question.  It only irritates people... it does not improve 
your chances of getting help.

What does improve your chances is reading the Posting Guide and following the 
advice given there. Your question amounts to asking someone to figure out what 
theory you should apply to a problem domain... which is not really on topic 
here, though someone might recommend something to you anyway.

The better strategy would be to seek out (elsewhere) what textbook/papers you 
want to apply (SAS should suggest references if they claim to implement 
solutions) and then use Google or rseek.org to find contributed packages that 
implement some or all of the steps in that approach. You can also peruse the 
Task Views on CRAN. When you get error messages trying to apply those tools in 
R, ask here how to resolve those problems, since this list is about the 
language not your problem domain.

On November 3, 2018 12:51:23 PM PDT, Medic  wrote:
>I need a R-code for a situation that is well described in the sas help.
>I
>would be very grateful for the help!
>"Time-dependent variables can be used to model the effects of subjects
>transferring from one treatment group to another. One example of the
>need
>for such strategies is the Stanford heart transplant program. Patients
>are
>accepted if physicians judge them suitable for heart transplant. Then,
>when
>a donor becomes available, physicians choose transplant recipients
>according to various medical criteria. A patient’s status can be
>changed
>during the study from waiting for a transplant to being a transplant
>recipient. Transplant status can be defined by the time-dependent
>covariate
>function z=z(t) as:
>z(t)= 0 (if the patient has not received the transplant at time t)
>and 1 (if has received)
>
>__
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

-- 
Sent from my phone. Please excuse my brevity.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] cox model

2018-11-03 Thread David Winsemius
It's also "well described" in the help materials for the obvious 
recommended package that ships with every copy of R. My copy sits at 
http://127.0.0.1:29434/library/survival/doc/timedep.pdf. Therneau's S 
package was first ported to R by Thomas Lumley and later Therneau took 
over maintenance.


--

David.

On 11/3/18 12:51 PM, Medic wrote:

I need a R-code for a situation that is well described in the sas help. I
would be very grateful for the help!
"Time-dependent variables can be used to model the effects of subjects
transferring from one treatment group to another. One example of the need
for such strategies is the Stanford heart transplant program. Patients are
accepted if physicians judge them suitable for heart transplant. Then, when
a donor becomes available, physicians choose transplant recipients
according to various medical criteria. A patient’s status can be changed
during the study from waiting for a transplant to being a transplant
recipient. Transplant status can be defined by the time-dependent covariate
function z=z(t) as:
z(t)= 0 (if the patient has not received the transplant at time t)
and 1 (if has received)

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Predict follow up time using parametric model in r

2018-11-03 Thread Israel Ortiz
I am trying to predict follow-up time using several survival models, both
parametric and semi-parametric. I achieve it for semi parametric models
using predict.coxph function in R from survival package using type =
"expected" as indicated in help. However, for parametric models, this
option doesn't exist for the predict.survreg function. Is there any other
option? Maybe using rms package?

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] cox model

2018-11-03 Thread Medic
I need a R-code for a situation that is well described in the sas help. I
would be very grateful for the help!
"Time-dependent variables can be used to model the effects of subjects
transferring from one treatment group to another. One example of the need
for such strategies is the Stanford heart transplant program. Patients are
accepted if physicians judge them suitable for heart transplant. Then, when
a donor becomes available, physicians choose transplant recipients
according to various medical criteria. A patient’s status can be changed
during the study from waiting for a transplant to being a transplant
recipient. Transplant status can be defined by the time-dependent covariate
function z=z(t) as:
z(t)= 0 (if the patient has not received the transplant at time t)
and 1 (if has received)

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Granger causality: lag selection

2018-11-03 Thread John C Frain
This is probably a question about econometric methods rather than one about
R,  While I would probably use an information criterion this would only be
my first step in determining an appropriate lag length.  One needs to check
1. The whiteness of the residuals
2. Non-normality and
3. Structural Change.
One then may need to amend the selected lag to take account of any problems
that are revealed by the relevant tests.  Only when you are satisfied that
your model is correct you should proceed with your  causality tests.
These matters are well covered in texts such as Lutkepohl (2005), New
introduction to multiple time series analysis, Springer (see Chapter 4)

Looking at the example you quote I might say that the automatic first
differencing of I(1) series and doing granger causality tests on the
differenced series is not a valid option if there is cointegration.  When
there is cointegration the usual test statistics do not have the standard
distributions.  This is covered in section 6.6 and chapter 7 of Lutkepohl's
book.
John C Frain
3 Aranleigh Park
Rathfarnham
Dublin 14
Ireland
www.tcd.ie/Economics/staff/frainj/home.html
mailto:fra...@tcd.ie
mailto:fra...@gmail.com


On Fri, 2 Nov 2018 at 09:00, John  wrote:

> Hi,
>
>I see an R user chooses the lag of Granger causality by finding out the
> lag for the most significant result
>https://www.r-bloggers.com/granger-causality-test/
>
>Is it generally legitimate to do so, without determining the lag first
> by AIC or BIC?
>
>Thanks,
>
> John
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] spi package

2018-11-03 Thread Sarah Goslee
It would help a lot if you actually told us what your error was.

Based on ?spi::spi your command looks correct, so we need more information.

Sarah
On Sat, Nov 3, 2018 at 10:02 AM Okan Mert Katipoglu
 wrote:
>
>
>   Hi,Can I get information about following spi error,
>
>   spi(1,"tercanspi.txt",1966,2017)
>
>   spi(9,"tercanspi.txt",1966,2017,"Tercan Standart Yağış 
> İndeksi",2,"Yıllar","Aylar")
>
>   spi(12,"tercanspi.txt",1966,2017,"Tercan Standart Yağış 
> İndeksi",2,"Yıllar","Aylar")
>
>   spi(24,"tercanspi.txt",1966,2017,"Tercan Standart Yağış 
> İndeksi",2,"Yıllar","Aylar")
>
>   how do I run these commands.
>
>   Thanks so much.

-- 
Sarah Goslee (she/her)
http://www.numberwright.com

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] spi package

2018-11-03 Thread Okan Mert Katipoglu
 
  Hi,Can I get information about following spi error,

  spi(1,"tercanspi.txt",1966,2017)

  spi(9,"tercanspi.txt",1966,2017,"Tercan Standart Yağış 
İndeksi",2,"Yıllar","Aylar")

  spi(12,"tercanspi.txt",1966,2017,"Tercan Standart Yağış 
İndeksi",2,"Yıllar","Aylar")

  spi(24,"tercanspi.txt",1966,2017,"Tercan Standart Yağış 
İndeksi",2,"Yıllar","Aylar")
  
  how do I run these commands.
   
  Thanks so much.
Bu e-posta mesaji ve ekleri sadece gonderildigi kisi veya kuruma ozeldir. 
Mesajin alicisi siz degilseniz, bu mesajin yonlendirilmesi, kopyalanmasi veya 
herhangi bir sekilde kullanilmasi yasaktir.Mesaj iceriginde bulunan fikir ve 
yorumlar, sadece gondericiye aittir. Bu mesaj bilinen tum viruslere karsi 
taranmistir.

This e-mail and any files transmitted with it are confid...{{dropped:2}}

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Different stack barplots - same color legends

2018-11-03 Thread P. Roberto Bakker
Thank you

Op do 1 nov. 2018 om 00:25 schreef Jim Lemon :

> Hi Roberto,
> Here is a snippet of code that translates the text responses of the
> BIS-11 into numeric values. Note the reversal of the order in the
> second item:
>
> BIS$Q1<-as.numeric(factor(BIS$Q1,
>  levels=c("Almost","Often","Occasionally","Rarely/Never")))
> BIS$Q2<-as.numeric(factor(BIS$Q2,
>  levels=c("Rarely/Never","Occasionally","Often","Almost")))
> ...
>
> Jim
> On Thu, Nov 1, 2018 at 8:57 AM P. Roberto Bakker
>  wrote:
> >
> > Hi Rich,
> >
> > Thank you for your answer.
> > The sentences are strings (likert scale: 'the situation is highly
> > applicable to me' etc - in Dutch), or column labels; it may be confusing
> as
> > it is in Dutch. Below I show you part of the dataframe with my annotation
> > added (string/column lable) to give you an idea.
> > I need to change the likert strings into numeric (1:5). And this is a
> > challenge somehow.
> > With dplyr, plyr it did not work.
> > After I have the numeric version then I can stack them as suggested by
> > David.
> >
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Different stack barplots - same color legends

2018-11-03 Thread P. Roberto Bakker
Dear Richard,

Thank you so much for all your work and time you punt in it.
I will start with your suggestions and let you know how far I come.
Also thanks to the others who helpt me.

Best Roberto

Op do 1 nov. 2018 om 23:42 schreef Richard M. Heiberger :

> ## reminder on how the levels= argument to factor works
>
> mydata <- matrix(1:8,  nrow=4, ncol=2, dimnames=list(letters[1:4],
> LETTERS[1:2]))
> dput(mydata)
>
> Factor.wrong <- factor(c("mm", "cm", "m", "km"))
> levels(Factor.wrong) ## alphabetical order, not meaning order
>
> Factor.right <- factor(c("mm", "cm", "m", "km"),
>levels=c("mm", "cm", "m", "km"))
> levels(Factor.right) ## meaning order
>
>
>
> library(HH) ## for the likert function
>
> ## dput(teamq[1:10,7:8])
> teamq10x78 <-
> structure(list(`Ik volg bijscholing om mijn opleiders-kwaliteiten op
> peil te houden` = c("de situatie in hoge mate van toepassing is voor u
> of uw supervisorengroep",
> "de situatie in hoge mate van toepassing is voor u of uw
> supervisorengroep",
> "de situatie in zeer hoge mate van toepassing is voor u of uw
> supervisorengroep",
> "de situatie in zeer hoge mate van toepassing is voor u of uw
> supervisorengroep",
> "de situatie in geringe mate van toepassing is voor u of uw
> supervisorengroep",
> "de situatie enigszins van toepassing is voor u of uw supervisorengroep",
> "de situatie in zeer hoge mate van toepassing is voor u of uw
> supervisorengroep",
> "de situatie in hoge mate van toepassing is voor u of uw
> supervisorengroep",
> "de situatie in hoge mate van toepassing is voor u of uw
> supervisorengroep",
> "de situatie in zeer hoge mate van toepassing is voor u of uw
> supervisorengroep"
> ), `Ik weet precies wat de ‘modernisering van de opleiding’ inhoudt` =
> c("de situatie in hoge mate van toepassing is voor u of uw
> supervisorengroep",
> "de situatie in hoge mate van toepassing is voor u of uw
> supervisorengroep",
> "de situatie in zeer hoge mate van toepassing is voor u of uw
> supervisorengroep",
> "de situatie in zeer hoge mate van toepassing is voor u of uw
> supervisorengroep",
> "de situatie in geringe mate van toepassing is voor u of uw
> supervisorengroep",
> "de situatie enigszins van toepassing is voor u of uw supervisorengroep",
> "de situatie in geringe mate van toepassing is voor u of uw
> supervisorengroep",
> "de situatie in geringe mate van toepassing is voor u of uw
> supervisorengroep",
> "de situatie enigszins van toepassing is voor u of uw supervisorengroep",
> "de situatie in hoge mate van toepassing is voor u of uw supervisorengroep"
> )), row.names = c(NA, -10L), class = c("tbl_df", "tbl", "data.frame"
> ))
>
>
> ## This is from Google translate
>
> ## Ik weet precies wat de ‘modernisering van de opleiding’ inhoudt
> ## I know exactly what the "modernization of the training"
>
> ## Ik volg bijscholing om mijn opleiders-kwaliteiten op peil te houden
> ## I follow training to keep my grades at level trainers
>
>
> ## ## This is your order of levels from Mon, Oct 22, 2018 at 1:30 PM
> ## "de situatie in zeer geringe mate van toepassing is voor u of uw
> supervisorengroep"
> ## "de situatie in geringe mate van toepassing is voor u of uw
> supervisorengroep"
> ## "de situatie enigszins van toepassing is voor u of uw supervisorengroep"
> ## "de situatie in hoge mate van toepassing is voor u of uw
> supervisorengroep"
> ## "de situatie in zeer hoge mate van toepassing is voor u of uw
> supervisorengroep"
>
> ## ## This is from Google translate
> ## the situation very little applies to you or your group supervisor
> ## the situation slightly applies to you or your group supervisor
> ## the situation somewhat applies to you or your group supervisor
> ## the situation is highly applicable to you or your group supervisor
> ## the situation very largely applies to you or your group supervisor
>
>
>
> sapply(teamq10x78, table)
> likert(t(sapply(teamq10x78, table)))
> likert(t(sapply(teamq10x78, table)),
>auto.key=list(columns=1, border=TRUE),
>main="character values are sorted alphabetically, we will use
> factors in the next figure")
>
> object.size(teamq10x78)
> ## more rows
> object.size(rbind(teamq10x78,teamq10x78,teamq10x78,teamq10x78,teamq10x78,
>   teamq10x78,teamq10x78,teamq10x78,teamq10x78,teamq10x78,
>   teamq10x78,teamq10x78,teamq10x78,teamq10x78,teamq10x78,
>   teamq10x78,teamq10x78,teamq10x78,teamq10x78,teamq10x78))
>
> situatie.levels <- c(
>   "de situatie in zeer geringe mate van toepassing is voor u of uw
> supervisorengroep",
>   "de situatie in geringe mate van toepassing is voor u of uw
> supervisorengroep",
>   "de situatie enigszins van toepassing is voor u of uw supervisorengroep",
>   "de situatie in hoge mate van toepassing is voor u of uw
> supervisorengroep",
>   "de situatie in zeer hoge mate van toepassing is voor u of uw
> supervisorengroep")
>
> teamf <- tibble::as.tibble(
>   lapply(teamq10x78,
>  

[R] rnaturalearth: detail by degrees

2018-11-03 Thread Ferri Leberl


Dear all,
I have the graph of a path, walking a number of places specified by name, 
logitude and latitude – thanks to Don MacQueen.
xliam and ylim define a certain section of the earth.
How can I put this section of a political map into the background?
Thank you in advance.
Yours, Ferri
 

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R-es] Simple sequencia en suma

2018-11-03 Thread Juan Abasolo
De principiante a principiante.
Probá de una a una cada una de las operaciones, así vas a conseguir tener
un error a resolver y no una masa en la que no sabés qué está bien y qué
mal.
Haciéndolo así te cantaría cada una de las confusiones y podrías
resolverla. Lo que pegás canta que eso de "<-" está mal, porque en el orden
que lo diste es lo primero. Pero no es lo primero en el orden que lo
pensaste.

Piano piano arriviamo lontano.

Hau idatzi du David Montes (dmontes...@hotmail.com) erabiltzaileak (2018
aza. 3, lr. (00:51)):

> Este es mi primer ejercicio con errores es una simple sequencia en suma,
> muchas gracias.
>
> > mi_funcion "<-" function(x, y, operacion = "suma"){ if(operacion ==
> "suma"){ return (x + y) z=2}; (x * z = 2)+y} x=1;y=2;z=2; else echo "error";
>
> Error: unexpected string constant in "mi_funcion "<-""
>
>
> [[alternative HTML version deleted]]
>
> ___
> R-help-es mailing list
> R-help-es@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es
>


-- 
Juan Abasolo

Hizkuntzaren eta Literaturaren Didaktika Saila | EUDIA ikerketa taldea
Bilboko Hezkuntza Fakultatea
Euskal Herriko Unibertsitatea
UPV/EHU

Sarriena auzoa z/g
48940 Leioa
Bizkaia

Tfn: (+34) 94 601 7567
Telegram: @JuanAbasolo
Skype: abasolo72

Tutoretza ordutegia 

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es