[R] need help with a time series plotting problem

2011-12-24 Thread vibhava
Dear R Users,
 I am a beginner in R programming and need some help
with a simple plotting problem that i am having. My dataset consist of three
columns: first one has data_id, second is the date and third is the actual
data itself corresponding to each date. The date ranges from
1/1/2000-12/31/2009. I am trying to plot my data versus the dates as a long
term time series but what's happening is that R is plotting each year on top
of the previous year. so instead of getting 1 line (dated 2000-2009) in the
plot i am getting 9 lines (1 line for each year). i tried to look for
solutions online but found nothing. can someone suggest how can i make a
plot with x-axis ranging from 2000-2009. my code is copied below:

setwd(J:/Rstuff/flow)
flow=read.delim(flow.dat,header=TRUE,sep=\t)
plot(flow$usgs1500~as.Date(flow$date,
%m/%d/%y),type=l,xlab=date,ylab=daily discharge (m3/s)
,main=USGS1500,yaxs=i, xaxs=i,)


any help would be appreciated

regards

vibhava  

--
View this message in context: 
http://r.789695.n4.nabble.com/need-help-with-a-time-series-plotting-problem-tp4230672p4230672.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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] Estimate of smooth.spline

2011-12-24 Thread ali_protocol
thank you vey much Jean.

On 12/21/11, Jean V Adams [via R]
ml-node+s789695n4221894...@n4.nabble.com wrote:


 ali_protocol wrote on 12/21/2011 05:39:19 AM:

 Hi everyone,
 I have:

 s= smooth.spline (cbind(1,2,3,4,3,3),cbind (4,2,4,6,5,6))

 how may I obtain s hat (s^)?

 Thanks a lot.


 Read the help file on the smooth.spline() function,

 ?smooth.spline

 The section titled Value tells you what the function returns ...

An object of class smooth.spline with components
xthe distinct x values in increasing order, see the ?Details?
 above.
y the fitted values corresponding to x.
...

 The y component is what you're interested in,

 s$y


 Jean
   [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 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.


 ___
 If you reply to this email, your message will be added to the discussion
 below:
 http://r.789695.n4.nabble.com/Estimate-of-smooth-spline-tp4221253p4221894.html

 To unsubscribe from Estimate of smooth.spline, visit
 http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=4221253code=bW9oYW1tYWRpYW5hbGltb2hhbW1hZGlhbkBnbWFpbC5jb218NDIyMTI1M3wtMTkwNDgxNTk3NQ==


--
View this message in context: 
http://r.789695.n4.nabble.com/Estimate-of-smooth-spline-tp4221253p4230616.html
Sent from the R help mailing list archive at Nabble.com.
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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] readLines errors

2011-12-24 Thread rusers.sh
Hi All,
  I met a problem using readLines function to return the data from Google
maps.

  readLines(url(
http://ditu.google.cn/maps/geo?q=+qianshuichong,+guichi+anhui,+CNoutput=csvkey=ABQIq8Fnd_oUka-7RdS6BrD7GBTqeABoQuNTXS36G_rkiwQnKRW6GBTkns8JpKz6y6dScgB8827dlddUlg;),
n=1, warn=FALSE)

[1] 200,4,30.6528380,117.4872250

  The above code is ok because the address is English, but it cannot work
when i change the address into zh-hans (Chinese simplified). See below.

  
readLines(url(http://ditu.google.cn/maps/geo?q=+Ç°Ë®³åhttp://ditu.google.cn/maps/geo?q=+%E5%89%8D%E6%B0%B4%E5%86%B2
,+¹ó³Ø+°²»Õ,+Öйúoutput=csvkey=ABQIq8Fnd_oUka-7RdS6BrD7GBTqeABoQuNTXS36G_rkiwQnKRW6GBTkns8JpKz6y6dScgB8827dlddUlglanguage=zh-CNregion=zh_Hans),
n=1, warn=FALSE)

[1] 400,0,0,0

  The returned value is wrong. I also tried several other options, but
still have the same problem. The interesting thing is if i paste the URL
into the IE explorer directly, it do return the correct values.

  Anybody can give me some suggestions or hints to solve this?

  Thanks a lot.

 P.S. See below for the other possibilities i tried.

readLines(url(http://ditu.google.cn/maps/geo?q=+Ç°Ë®³åhttp://ditu.google.cn/maps/geo?q=+%E5%89%8D%E6%B0%B4%E5%86%B2
,+¹ó³Ø+°²»Õ,+Öйúoutput=csvkey=ABQIq8Fnd_oUka-7RdS6BrD7GBTqeABoQuNTXS36G_rkiwQnKRW6GBTkns8JpKz6y6dScgB8827dlddUlglanguage=zh-CNregion=zh),
n=1, warn=FALSE)

[1] 400,0,0,0

readLines(url(http://ditu.google.cn/maps/geo?q=+Ç°Ë®³åhttp://ditu.google.cn/maps/geo?q=+%E5%89%8D%E6%B0%B4%E5%86%B2
,+¹ó³Ø+°²»Õ,+Öйúoutput=csvkey=ABQIq8Fnd_oUka-7RdS6BrD7GBTqeABoQuNTXS36G_rkiwQnKRW6GBTkns8JpKz6y6dScgB8827dlddUlglanguage=zh-CN),
n=1, warn=FALSE)

[1] 400,0,0,0

readLines(url(http://ditu.google.cn/maps/geo?q=+Ç°Ë®³åhttp://ditu.google.cn/maps/geo?q=+%E5%89%8D%E6%B0%B4%E5%86%B2
,+¹ó³Ø+°²»Õ,+Öйúoutput=csvkey=ABQIq8Fnd_oUka-7RdS6BrD7GBTqeABoQuNTXS36G_rkiwQnKRW6GBTkns8JpKz6y6dScgB8827dlddUlglanguage=zh-CN),
n=1, warn=FALSE,encoding=UTF-8)

[1] 400,0,0,0


-- 
-
Jane Chang
Queen's

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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] Fw:

2011-12-24 Thread Kristi Shoemaker

http://secretosdeunaprincesa.com/next2012.php?aid=11sywa=76wud=764rax=68

__
R-help@r-project.org mailing list
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] if statement problem

2011-12-24 Thread Patrick Burns

This is almost Circle 8.1.7 of
'The R Inferno':

http://www.burns-stat.com/pages/Tutor/R_inferno.pdf

but is making the mistake in the
other direction.

On 23/12/2011 22:40, reena wrote:

Hello,

I want to do fisher test for the rows in data file which has value less than
5 otherwise chi square test .The p values from both test should be stored in
one resulted file. but there is some problem with bold if statement. I don't
know how
implement this line properly.


x = cbind(obs1,obs2,exp1,exp2)
a = matrix(c(0,0,0,0), ncol=2, byrow =TRUE)#matrix with initialized
values

for (i in 1: length(x[,1]))
{
   *if((x[i,1] || x[i,2] || x[i,3] || x[i,4])  5)*
  {
  a[1,1]- x[i,1];
  a[1,2]- x[i,2];
  a[2,1]- x[i,3];
  a[2,2]- x[i,4];
  result- fisher.test(a)
  write.table(result[[p.value]],file=results.txt,
sep=\n, append=TRUE, col.names=FALSE, row.names=FALSE);
}

  else
 {
 a[1,1]- x[i,1];
 a[1,2]- x[i,2];
 a[2,1]- x[i,3];
 a[2,2]- x[i,4];
 result- chisq.test(a)
 write.table(result[[p.value]],file=results.txt,
sep=\n, append=TRUE, col.names=FALSE, row.names=FALSE);}
 }

Regards
R

--
View this message in context: 
http://r.789695.n4.nabble.com/if-statement-problem-tp4230026p4230026.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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.



--
Patrick Burns
pbu...@pburns.seanet.com
twitter: @portfolioprobe
http://www.portfolioprobe.com/blog
http://www.burns-stat.com
(home of 'Some hints for the R beginner'
and 'The R Inferno')

__
R-help@r-project.org mailing list
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] Turning my subscription to mailing list back on

2011-12-24 Thread John Sorkin
Please respond directly to me as I am not receiving Email from the R-Help 
mailing list:
jsor...@grecc.umaryland.edu
 
Before I left for vacation, I turned delivery of mail from R-Help off. I cannot 
find the proper web-page to use to turn mail back on. Can someone send me the 
URL, or perhaps an Email address and a command I can sent via Email?
 
Thanks,
John
 
Confidentiality Statement:
This email message, including any attachments, is for the sole use of the 
intended recipient(s) and may contain confidential and privileged information.  
Any unauthorized use, disclosure or distribution is prohibited.  If you are not 
the intended recipient, please contact the sender by reply email and destroy 
all copies of the original message. 
__
R-help@r-project.org mailing list
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] need help with a time series plotting problem

2011-12-24 Thread Jim Holtman
you need to supply a subset of your data since the problem is probably related 
to its representation.  please follow the posting guidelines.

Sent from my iPad

On Dec 24, 2011, at 2:21, vibhava vibhavasrivast...@gmail.com wrote:

 Dear R Users,
 I am a beginner in R programming and need some help
 with a simple plotting problem that i am having. My dataset consist of three
 columns: first one has data_id, second is the date and third is the actual
 data itself corresponding to each date. The date ranges from
 1/1/2000-12/31/2009. I am trying to plot my data versus the dates as a long
 term time series but what's happening is that R is plotting each year on top
 of the previous year. so instead of getting 1 line (dated 2000-2009) in the
 plot i am getting 9 lines (1 line for each year). i tried to look for
 solutions online but found nothing. can someone suggest how can i make a
 plot with x-axis ranging from 2000-2009. my code is copied below:
 
 setwd(J:/Rstuff/flow)
 flow=read.delim(flow.dat,header=TRUE,sep=\t)
 plot(flow$usgs1500~as.Date(flow$date,
 %m/%d/%y),type=l,xlab=date,ylab=daily discharge (m3/s)
 ,main=USGS1500,yaxs=i, xaxs=i,)
 
 
 any help would be appreciated
 
 regards
 
 vibhava  
 
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/need-help-with-a-time-series-plotting-problem-tp4230672p4230672.html
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@r-project.org mailing list
 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
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] Help creating a symmetric matrix?

2011-12-24 Thread Sarah Goslee
Or the slightly shorter:

z-diag(6)
z[row(z)  col(z)] - v

which is what lower.tri() does,

and
z - diag(6)
z[lower.tri(z)] - v

also works.

Sarah

On Fri, Dec 23, 2011 at 9:31 PM, Rui Barradas ruipbarra...@sapo.pt wrote:

 Matt Considine wrote

 Hi,
 I am trying to work with the output of the MINE analysis routine found at
    http://www.exploredata.net

 Specifically, I am trying to read the results into a matrix (ideally an
 n x n x 6 matrix, but I'll settle right now for getting one column into
 a matrix.)

 The problem I have is not knowing how to take what amounts to being one
 half of a symmetric matrix - excluding the diagonal - and getting it
 into a matrix.  I have tried using lower.tri as found here
    https://stat.ethz.ch/pipermail/r-help/2008-September/174516.html
 but it appears to only partially fill in the matrix.  My code and an
 example of the output is below.  Can anyone point me to an example that
 shows how to create a matrix with this sort of input?

 Thank you in advance,
 Matt

 #v-newx[,3]
 #or, for the sake of this example
 v-c(0.33740, 0.26657, 0.23388, 0.23122, 0.21476, 0.20829, 0.20486,
 0.19439, 0.19237,
 0.18633, 0.17298, 0.17174, 0.16822, 0.16480, 0.15027)
 z-diag(6)
 ind - lower.tri(z)
 z[ind] - t(v)[ind]

 z
          [,1]    [,2] [,3] [,4] [,5] [,6]
 [1,] 1.0 0.0    0    0    0    0
 [2,] 0.26657 1.0    0    0    0    0
 [3,] 0.23388 0.19237    1    0    0    0
 [4,] 0.23122 0.18633   NA    1    0    0
 [5,] 0.21476 0.17298   NA   NA    1    0
 [6,] 0.20829 0.17174   NA   NA   NA    1


 Hello,

 Aren't you complicating?

 In the last line of your code, why use 'v[ind]' if 'ind' indexes the matrix,
 not the vector?

 z-diag(6)
 ind - lower.tri(z)
 z[ind] - v                        #This works
 z

 Rui Barradas


-- 
Sarah Goslee
http://www.functionaldiversity.org

__
R-help@r-project.org mailing list
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] readLines errors

2011-12-24 Thread David Winsemius


On Dec 24, 2011, at 4:12 AM, rusers.sh wrote:


Hi All,
 I met a problem using readLines function to return the data from  
Google

maps.

 readLines(url(
http://ditu.google.cn/maps/geo?q=+qianshuichong,+guichi+anhui,+CNoutput=csvkey=ABQIq8Fnd_oUka-7RdS6BrD7GBTqeABoQuNTXS36G_rkiwQnKRW6GBTkns8JpKz6y6dScgB8827dlddUlg 
),

n=1, warn=FALSE)

[1] 200,4,30.6528380,117.4872250

 The above code is ok because the address is English, but it cannot  
work
when i change the address into zh-hans (Chinese simplified). See  
below.


 readLines(url(http://ditu.google.cn/maps/geo?q=+Ç°Ë®³åhttp://ditu.google.cn/maps/geo?q=+%E5%89%8D%E6%B0%B4%E5 
%86%B2
,+¹ó³Ø+°²»Õ, 
+ 
ÖÐ 
¹ 
ú 
output 
= 
csv 
key 
= 
ABQIq8Fnd_oUka 
-7RdS6BrD7GBTqeABoQuNTXS36G_rkiwQnKRW6GBTkns8JpKz6y6dScgB8827dlddUlg 
language=zh-CNregion=zh_Hans),

n=1, warn=FALSE)


When I plug that URL into my browser (Firefox) I get this text on a  
white background:


602,0,0,0
When I execute that code in R I get:
[1] {
And when I remove the lines restriction I get:
[1] {
[2]   \name\: \ Ç°Ë®³å\\u003chttp://ditu.google.cn/maps/geo? 
q= 前水冲\\u003e\,

[3]   \Status\: {
[4] \code\: 602,
[5] \request\: \geocode\
[6]   }
[7] }
I don't read Chinese , however it does appear that there was some sort  
of extra processing step that Firefox carried out to arrive at the  
displayed text.




[1] 400,0,0,0

 The returned value is wrong. I also tried several other options, but
still have the same problem. The interesting thing is if i paste the  
URL

into the IE explorer directly, it do return the correct values.

 Anybody can give me some suggestions or hints to solve this?

 Thanks a lot.

P.S. See below for the other possibilities i tried.

readLines(url(http://ditu.google.cn/maps/geo?q=+Ç°Ë®³åhttp://ditu.google.cn/maps/geo?q=+%E5%89%8D%E6%B0%B4%E5 
%86%B2
,+¹ó³Ø+°²»Õ, 
+ 
ÖÐ 
¹ 
ú 
output 
= 
csv 
key 
= 
ABQIq8Fnd_oUka 
-7RdS6BrD7GBTqeABoQuNTXS36G_rkiwQnKRW6GBTkns8JpKz6y6dScgB8827dlddUlg 
language=zh-CNregion=zh),

n=1, warn=FALSE)

[1] 400,0,0,0

readLines(url(http://ditu.google.cn/maps/geo?q=+Ç°Ë®³åhttp://ditu.google.cn/maps/geo?q=+%E5%89%8D%E6%B0%B4%E5 
%86%B2
,+¹ó³Ø+°²»Õ, 
+ 
ÖÐ 
¹ 
ú 
output 
= 
csv 
key 
= 
ABQIq8Fnd_oUka 
-7RdS6BrD7GBTqeABoQuNTXS36G_rkiwQnKRW6GBTkns8JpKz6y6dScgB8827dlddUlg 
language=zh-CN),

n=1, warn=FALSE)

[1] 400,0,0,0

readLines(url(http://ditu.google.cn/maps/geo?q=+Ç°Ë®³åhttp://ditu.google.cn/maps/geo?q=+%E5%89%8D%E6%B0%B4%E5 
%86%B2
,+¹ó³Ø+°²»Õ, 
+ 
ÖÐ 
¹ 
ú 
output 
= 
csv 
key 
= 
ABQIq8Fnd_oUka 
-7RdS6BrD7GBTqeABoQuNTXS36G_rkiwQnKRW6GBTkns8JpKz6y6dScgB8827dlddUlg 
language=zh-CN),

n=1, warn=FALSE,encoding=UTF-8)

[1] 400,0,0,0


--
-
Jane Chang
Queen's

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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.


David Winsemius, MD
West Hartford, CT

__
R-help@r-project.org mailing list
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] Help creating a symmetric matrix?

2011-12-24 Thread William Revelle
Dear Matt, Sarah and Rui,

To answer the original question for creating a symmetric matrix 


 v-c(0.33740, 0.26657, 0.23388, 0.23122, 0.21476, 0.20829, 0.20486,
 0.19439, 0.19237,
 0.18633, 0.17298, 0.17174, 0.16822, 0.16480, 0.15027)


z-diag(6)
z[row(z)  col(z)] - v
z - z + t(z)
diag(z) - 0   

 z
[,1][,2][,3][,4][,5][,6]
[1,] 0.0 0.33740 0.26657 0.23388 0.23122 0.21476
[2,] 0.33740 0.0 0.20829 0.20486 0.19439 0.19237
[3,] 0.26657 0.20829 0.0 0.18633 0.17298 0.17174
[4,] 0.23388 0.20486 0.18633 0.0 0.16822 0.16480
[5,] 0.23122 0.19439 0.17298 0.16822 0.0 0.15027
[6,] 0.21476 0.19237 0.17174 0.16480 0.15027 0.0


Bill


On Dec 24, 2011, at 6:04 AM, Sarah Goslee wrote:

 Or the slightly shorter:
 
 z-diag(6)
 z[row(z)  col(z)] - v
 
 which is what lower.tri() does,
 
 and
 z - diag(6)
 z[lower.tri(z)] - v
 
 also works.
 
 Sarah
 
 On Fri, Dec 23, 2011 at 9:31 PM, Rui Barradas ruipbarra...@sapo.pt wrote:
 
 Matt Considine wrote
 
 Hi,
 I am trying to work with the output of the MINE analysis routine found at
http://www.exploredata.net
 
 Specifically, I am trying to read the results into a matrix (ideally an
 n x n x 6 matrix, but I'll settle right now for getting one column into
 a matrix.)
 
 The problem I have is not knowing how to take what amounts to being one
 half of a symmetric matrix - excluding the diagonal - and getting it
 into a matrix.  I have tried using lower.tri as found here
https://stat.ethz.ch/pipermail/r-help/2008-September/174516.html
 but it appears to only partially fill in the matrix.  My code and an
 example of the output is below.  Can anyone point me to an example that
 shows how to create a matrix with this sort of input?
 
 Thank you in advance,
 Matt
 
 #v-newx[,3]
 #or, for the sake of this example
 v-c(0.33740, 0.26657, 0.23388, 0.23122, 0.21476, 0.20829, 0.20486,
 0.19439, 0.19237,
 0.18633, 0.17298, 0.17174, 0.16822, 0.16480, 0.15027)
 z-diag(6)
 ind - lower.tri(z)
 z[ind] - t(v)[ind]
 
 z
  [,1][,2] [,3] [,4] [,5] [,6]
 [1,] 1.0 0.00000
 [2,] 0.26657 1.00000
 [3,] 0.23388 0.192371000
 [4,] 0.23122 0.18633   NA100
 [5,] 0.21476 0.17298   NA   NA10
 [6,] 0.20829 0.17174   NA   NA   NA1
 
 
 Hello,
 
 Aren't you complicating?
 
 In the last line of your code, why use 'v[ind]' if 'ind' indexes the matrix,
 not the vector?
 
 z-diag(6)
 ind - lower.tri(z)
 z[ind] - v#This works
 z
 
 Rui Barradas
 
 
 -- 
 Sarah Goslee
 http://www.functionaldiversity.org
 
 __
 R-help@r-project.org mailing list
 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.
 

William Revellehttp://personality-project.org/revelle.html
Professor  http://personality-project.org
Department of Psychology   http://www.wcas.northwestern.edu/psych/
Northwestern Universityhttp://www.northwestern.edu/
Use R for psychology http://personality-project.org/r
It is 6 minutes to midnighthttp://www.thebulletin.org

__
R-help@r-project.org mailing list
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] readLines errors

2011-12-24 Thread rusers.sh
  I just found another strange thing. When i paste the URL into the Google
Chrome, i can get the correct result 200,4,30.5892200,117.4286680. But i
paste it into the IE explorer, the result is wrong 400,0,0,0.
  I guess that the R uses the IE as default. Could i tell R to use  Google
Chrome as a default explorer? Or how can i find the possible solution for
IE to return the same result as  Google Chrome .
 Confusing.

2011/12/24 David Winsemius dwinsem...@comcast.net


 On Dec 24, 2011, at 4:12 AM, rusers.sh wrote:

  Hi All,
  I met a problem using readLines function to return the data from Google
 maps.

  readLines(url(
 http://ditu.google.cn/maps/**geo?q=+qianshuichong,+guichi+**
 anhui,+CNoutput=csvkey=**ABQIq8Fnd_oUka-**
 7RdS6BrD7GBTqeABoQuNTXS36G_**rkiwQnKRW6GBTkns8JpKz6y6dScgB8**827dlddUlghttp://ditu.google.cn/maps/geo?q=+qianshuichong,+guichi+anhui,+CNoutput=csvkey=ABQIq8Fnd_oUka-7RdS6BrD7GBTqeABoQuNTXS36G_rkiwQnKRW6GBTkns8JpKz6y6dScgB8827dlddUlg
 ),
 n=1, warn=FALSE)

 [1] 200,4,30.6528380,117.4872250

  The above code is ok because the address is English, but it cannot work
 when i change the address into zh-hans (Chinese simplified). See below.

  
 readLines(url(http://ditu.**google.cn/maps/geo?q=+Çhttp://ditu.google.cn/maps/geo?q=+%C3%87
 °Ë®³åh**ttp://ditu.google.cn/maps/geo?**q=+%E5%89%8D%E6%B0%B4%E5%86%B2http://ditu.google.cn/maps/geo?q=+%E5%89%8D%E6%B0%B4%E5%86%B2
 **
 ,+¹ó³Ø+°²»Õ,+Öйúoutput=csv**key=ABQIq8Fnd_oUka-**
 7RdS6BrD7GBTqeABoQuNTXS36G_**rkiwQnKRW6GBTkns8JpKz6y6dScgB8**
 827dlddUlglanguage=zh-CN**region=zh_Hans),
 n=1, warn=FALSE)


 When I plug that URL into my browser (Firefox) I get this text on a white
 background:

 602,0,0,0
 When I execute that code in R I get:
 [1] {
 And when I remove the lines restriction I get:
 [1] {
 [2]   \name\: \ 
 Ç°Ë®³å\\u003chttp://ditu.**google.cn/maps/geo?q=http://ditu.google.cn/maps/geo?q=前水冲\\u003e\,
 [3]   \Status\: {
 [4] \code\: 602,
 [5] \request\: \geocode\
 [6]   }
 [7] }
 I don't read Chinese , however it does appear that there was some sort of
 extra processing step that Firefox carried out to arrive at the displayed
 text.


 [1] 400,0,0,0

  The returned value is wrong. I also tried several other options, but
 still have the same problem. The interesting thing is if i paste the URL
 into the IE explorer directly, it do return the correct values.

  Anybody can give me some suggestions or hints to solve this?

  Thanks a lot.

 P.S. See below for the other possibilities i tried.

 readLines(url(http://ditu.**google.cn/maps/geo?q=+Çhttp://ditu.google.cn/maps/geo?q=+%C3%87
 °Ë®³åh**ttp://ditu.google.cn/maps/geo?**q=+%E5%89%8D%E6%B0%B4%E5%86%B2http://ditu.google.cn/maps/geo?q=+%E5%89%8D%E6%B0%B4%E5%86%B2
 **
 ,+¹ó³Ø+°²»Õ,+Öйúoutput=csv**key=ABQIq8Fnd_oUka-**
 7RdS6BrD7GBTqeABoQuNTXS36G_**rkiwQnKRW6GBTkns8JpKz6y6dScgB8**
 827dlddUlglanguage=zh-CN**region=zh),
 n=1, warn=FALSE)

 [1] 400,0,0,0

 readLines(url(http://ditu.**google.cn/maps/geo?q=+Çhttp://ditu.google.cn/maps/geo?q=+%C3%87
 °Ë®³åh**ttp://ditu.google.cn/maps/geo?**q=+%E5%89%8D%E6%B0%B4%E5%86%B2http://ditu.google.cn/maps/geo?q=+%E5%89%8D%E6%B0%B4%E5%86%B2
 **
 ,+¹ó³Ø+°²»Õ,+Öйúoutput=csv**key=ABQIq8Fnd_oUka-**
 7RdS6BrD7GBTqeABoQuNTXS36G_**rkiwQnKRW6GBTkns8JpKz6y6dScgB8**
 827dlddUlglanguage=zh-CN),
 n=1, warn=FALSE)

 [1] 400,0,0,0

 readLines(url(http://ditu.**google.cn/maps/geo?q=+Çhttp://ditu.google.cn/maps/geo?q=+%C3%87
 °Ë®³åh**ttp://ditu.google.cn/maps/geo?**q=+%E5%89%8D%E6%B0%B4%E5%86%B2http://ditu.google.cn/maps/geo?q=+%E5%89%8D%E6%B0%B4%E5%86%B2
 **
 ,+¹ó³Ø+°²»Õ,+Öйúoutput=csv**key=ABQIq8Fnd_oUka-**
 7RdS6BrD7GBTqeABoQuNTXS36G_**rkiwQnKRW6GBTkns8JpKz6y6dScgB8**
 827dlddUlglanguage=zh-CN),

 n=1, warn=FALSE,encoding=UTF-8)

 [1] 400,0,0,0


 --
 -
 Jane Chang
 Queen's

[[alternative HTML version deleted]]

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


 David Winsemius, MD
 West Hartford, CT




-- 
-
Jane Chang
Queen's

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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] Help creating a symmetric matrix?

2011-12-24 Thread Sarah Goslee
On Sat, Dec 24, 2011 at 8:38 AM, William Revelle li...@revelle.net wrote:
 Dear Matt, Sarah and Rui,

 To answer the original question for creating a symmetric matrix

I read the original question as *only* wanting the complete lower
triangle, with diagonal of 1 and 0 in the upper triangle.

If your interpretation is correct, there's also this convenience function:

library(ecodist)
z - full(v)

Sarah


 v-c(0.33740, 0.26657, 0.23388, 0.23122, 0.21476, 0.20829, 0.20486,
 0.19439, 0.19237,
 0.18633, 0.17298, 0.17174, 0.16822, 0.16480, 0.15027)


 z-diag(6)
 z[row(z)  col(z)] - v
 z - z + t(z)
 diag(z) - 0

 z
        [,1]    [,2]    [,3]    [,4]    [,5]    [,6]
 [1,] 0.0 0.33740 0.26657 0.23388 0.23122 0.21476
 [2,] 0.33740 0.0 0.20829 0.20486 0.19439 0.19237
 [3,] 0.26657 0.20829 0.0 0.18633 0.17298 0.17174
 [4,] 0.23388 0.20486 0.18633 0.0 0.16822 0.16480
 [5,] 0.23122 0.19439 0.17298 0.16822 0.0 0.15027
 [6,] 0.21476 0.19237 0.17174 0.16480 0.15027 0.0


 Bill


 On Dec 24, 2011, at 6:04 AM, Sarah Goslee wrote:

 Or the slightly shorter:

 z-diag(6)
 z[row(z)  col(z)] - v

 which is what lower.tri() does,

 and
 z - diag(6)
 z[lower.tri(z)] - v

 also works.

 Sarah

 On Fri, Dec 23, 2011 at 9:31 PM, Rui Barradas ruipbarra...@sapo.pt wrote:

 Matt Considine wrote

 Hi,
 I am trying to work with the output of the MINE analysis routine found at
    http://www.exploredata.net

 Specifically, I am trying to read the results into a matrix (ideally an
 n x n x 6 matrix, but I'll settle right now for getting one column into
 a matrix.)

 The problem I have is not knowing how to take what amounts to being one
 half of a symmetric matrix - excluding the diagonal - and getting it
 into a matrix.  I have tried using lower.tri as found here
    https://stat.ethz.ch/pipermail/r-help/2008-September/174516.html
 but it appears to only partially fill in the matrix.  My code and an
 example of the output is below.  Can anyone point me to an example that
 shows how to create a matrix with this sort of input?

 Thank you in advance,
 Matt

 #v-newx[,3]
 #or, for the sake of this example
 v-c(0.33740, 0.26657, 0.23388, 0.23122, 0.21476, 0.20829, 0.20486,
 0.19439, 0.19237,
 0.18633, 0.17298, 0.17174, 0.16822, 0.16480, 0.15027)
 z-diag(6)
 ind - lower.tri(z)
 z[ind] - t(v)[ind]

 z
          [,1]    [,2] [,3] [,4] [,5] [,6]
 [1,] 1.0 0.0    0    0    0    0
 [2,] 0.26657 1.0    0    0    0    0
 [3,] 0.23388 0.19237    1    0    0    0
 [4,] 0.23122 0.18633   NA    1    0    0
 [5,] 0.21476 0.17298   NA   NA    1    0
 [6,] 0.20829 0.17174   NA   NA   NA    1


 Hello,

 Aren't you complicating?

 In the last line of your code, why use 'v[ind]' if 'ind' indexes the matrix,
 not the vector?

 z-diag(6)
 ind - lower.tri(z)
 z[ind] - v                        #This works
 z

 Rui Barradas


 --

__
R-help@r-project.org mailing list
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] Call for Abstracts for useR! 2012

2011-12-24 Thread Frank Harrell
The international R User Conference useR! 2012 will be held June 12-15 
at Vanderbilt University in Nashville, Tennessee, USA, with a 
pre-conference full-day course offered on June 11.


Participants are encouraged to submit a one-page abstract for oral 
or poster presentation at the conference. Half-day tutorials will be 
held in the morning and afternoon of June 12th. For tutorials, please 
submit a one-page proposal with course outline and narrative description 
along with the target audience. Note that the deadline for tutorial 
proposals is January 15. All innovative and interesting applications of 
R are suitable. A list of topics from past conferences is available at 
the conference website:


http://biostat.mc.vanderbilt.edu/wiki/Main/useR-2012#Call_for_Abstracts_and_Tutorial

Contributed oral presentations will be allowed 17 minutes, followed 
by 3 minutes discussion. Following last year's success, all participants 
are invited to present a Lightning Talk, for which no abstract is 
required. The format for Lightning Talks is a 15-slide version of Pecha 
Kucha. Participants wishing to give a Lightning Talk must provide an 
informative title on their registration form.


For regular talks and posters, please use the recently updated 
LaTeX or Microsoft Word/LibreOffice Writer abstract templates available 
at the conference website:


http://biostat.mc.vanderbilt.edu/wiki/Main/useR-2012#Templates

The deadlines for abstract and tutorial proposals are as follows:

Tutorial Submission: Jan 1 - Jan 15
Tutorial Acceptance Notification: Jan 16 - Jan 23
Abstract Submission: Jan 1 - Mar 12
Abstract Acceptance Notification: Mar 13 - Apr 15

The preferred method of abstract and tutorial proposal submission is via 
the web form at the conference website:


http://biostat.mc.vanderbilt.edu/wiki/Main/useR-2012#Online_Submission

Participants may register online beginning January 23rd. If earlier 
registration is preferred, please contact Stephania McNeal-Goddard using 
the contact information here:


http://biostat.mc.vanderbilt.edu/wiki/Main/useR-2012#Contact

See http://journal.r-project.org/archive/2011-2/RJournal_2011-2.pdf for 
an article about the conference with more details, including a list of 
some of the major Nashville area entertainment events occurring around 
the time of the conference.


We look forward to seeing you at useR! 2012 in Nashville!

--
Frank E Harrell Jr Professor and Chairman  School of Medicine
   Department of Biostatistics Vanderbilt University

__
R-help@r-project.org mailing list
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] Inverse problems in R package

2011-12-24 Thread Jin Minming


Dear  all,

 

I have a general relationship, which can be easily
solved using forward engineering model,

y=f(x1, x2, x3)

Now I know a distribution of y, how can I get the
corresponding distributions for x1, x2, and x3? In another situation, if I know
the distributions of y and x1, how can I obtain the corresponding distributions
of x2 and x3?  

Are there some R packages for this inverse
problem (or called back calculation)?

 

Thanks a lot,

 

Terry

 


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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] readLines errors

2011-12-24 Thread rusers.sh
Hi All,
  I just tried Firefox that David referred and found it can also return the
correct result as Google Chrome.
 So now it is more clear now that readLines() function uses IE as the
default explorer, so it return the wrong result. Then the possible
solutions are,
1. Could we change the options in readLines() to set another  explorer as
the default explore, e.g. Google Chrome?
2. Could it be possible to set IE explorer in a rational way, so that it
can return the same results as Google Chrome  and Firefox? I have tried to
modify the encoding method in IE, but it doesnot work.
  Any suggestions or help?

ÔÚ 2011Äê12ÔÂ24ÈÕ ÏÂÎç5:12£¬rusers.sh rusers...@gmail.comдµÀ£º

 Hi All,
   I met a problem using readLines function to return the data from Google
 maps.

   readLines(url(
 http://ditu.google.cn/maps/geo?q=+qianshuichong,+guichi+anhui,+CNoutput=csvkey=ABQIq8Fnd_oUka-7RdS6BrD7GBTqeABoQuNTXS36G_rkiwQnKRW6GBTkns8JpKz6y6dScgB8827dlddUlg;),
 n=1, warn=FALSE)

 [1] 200,4,30.6528380,117.4872250

   The above code is ok because the address is English, but it cannot work
 when i change the address into zh-hans (Chinese simplified). See below.

   
 readLines(url(http://ditu.google.cn/maps/geo?q=+Ç°Ë®³åhttp://ditu.google.cn/maps/geo?q=+%E5%89%8D%E6%B0%B4%E5%86%B2
 ,+¹ó³Ø+°²»Õ,+Öйúoutput=csvkey=ABQIq8Fnd_oUka-7RdS6BrD7GBTqeABoQuNTXS36G_rkiwQnKRW6GBTkns8JpKz6y6dScgB8827dlddUlglanguage=zh-CNregion=zh_Hans),
 n=1, warn=FALSE)

 [1] 400,0,0,0

   The returned value is wrong. I also tried several other options, but
 still have the same problem. The interesting thing is if i paste the URL
 into the IE explorer directly, it do return the correct values.

   Anybody can give me some suggestions or hints to solve this?

   Thanks a lot.

  P.S. See below for the other possibilities i tried.

 readLines(url(http://ditu.google.cn/maps/geo?q=+Ç°Ë®³åhttp://ditu.google.cn/maps/geo?q=+%E5%89%8D%E6%B0%B4%E5%86%B2
 ,+¹ó³Ø+°²»Õ,+Öйúoutput=csvkey=ABQIq8Fnd_oUka-7RdS6BrD7GBTqeABoQuNTXS36G_rkiwQnKRW6GBTkns8JpKz6y6dScgB8827dlddUlglanguage=zh-CNregion=zh),
 n=1, warn=FALSE)

 [1] 400,0,0,0

 readLines(url(http://ditu.google.cn/maps/geo?q=+Ç°Ë®³åhttp://ditu.google.cn/maps/geo?q=+%E5%89%8D%E6%B0%B4%E5%86%B2
 ,+¹ó³Ø+°²»Õ,+Öйúoutput=csvkey=ABQIq8Fnd_oUka-7RdS6BrD7GBTqeABoQuNTXS36G_rkiwQnKRW6GBTkns8JpKz6y6dScgB8827dlddUlglanguage=zh-CN),
 n=1, warn=FALSE)

 [1] 400,0,0,0

 readLines(url(http://ditu.google.cn/maps/geo?q=+Ç°Ë®³åhttp://ditu.google.cn/maps/geo?q=+%E5%89%8D%E6%B0%B4%E5%86%B2
 ,+¹ó³Ø+°²»Õ,+Öйúoutput=csvkey=ABQIq8Fnd_oUka-7RdS6BrD7GBTqeABoQuNTXS36G_rkiwQnKRW6GBTkns8JpKz6y6dScgB8827dlddUlglanguage=zh-CN),
 n=1, warn=FALSE,encoding=UTF-8)

 [1] 400,0,0,0


 --
 -
 Jane Chang
 Queen's




-- 
-
Jane Chang
Queen's

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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] readLines errors

2011-12-24 Thread David Winsemius


On Dec 24, 2011, at 9:55 AM, rusers.sh wrote:


Hi All,
 I just tried Firefox that David referred and found it can also  
return the

correct result as Google Chrome.
So now it is more clear now that readLines() function uses IE as the
default explorer, so it return the wrong result. Then the possible
solutions are,
1. Could we change the options in readLines() to set another   
explorer as

the default explore, e.g. Google Chrome?


?options # and look at the HTTPUserAgent choice

I believe this:

 options()$HTTPUserAgent
[1] R (2.14.0 x86_64-apple-darwin9.8.0 x86_64 darwin9.8.0)


... is telling me that the choice is passed off to the OS, and only  
because you keep referring to (MS)IE do we know that you are running  
one of that Redmond company's products. (You should evidently do more  
study of the relationship of R to the OS platform you use.)


2. Could it be possible to set IE explorer in a rational way, so  
that it
can return the same results as Google Chrome  and Firefox? I have  
tried to

modify the encoding method in IE, but it doesnot work.
 Any suggestions or help?


That is not an appropriate question for this mailing list. You persist  
in posting in HTML. Maybe you should also spend more time learning to  
use you mail client correctly?


--
David.



ÔÚ 2011Äê12ÔÂ24ÈÕ ÏÂÎç5:12£¬rusers.sh rusers...@gmail.comдµÀ£º


Hi All,
 I met a problem using readLines function to return the data from  
Google

maps.

 readLines(url(
http://ditu.google.cn/maps/geo?q=+qianshuichong,+guichi+anhui,+CNoutput=csvkey=ABQIq8Fnd_oUka-7RdS6BrD7GBTqeABoQuNTXS36G_rkiwQnKRW6GBTkns8JpKz6y6dScgB8827dlddUlg 
),

n=1, warn=FALSE)

[1] 200,4,30.6528380,117.4872250

 The above code is ok because the address is English, but it cannot  
work
when i change the address into zh-hans (Chinese simplified). See  
below.


 readLines(url(http://ditu.google.cn/maps/geo?q=+Ç°Ë®³åhttp://ditu.google.cn/maps/geo?q=+%E5%89%8D%E6%B0%B4%E5%86%B2 

,+¹ó³Ø+°²»Õ, 
+ 
ÖÐ 
¹ 
ú 
output 
= 
csv 
key 
= 
ABQIq8Fnd_oUka 
-7RdS6BrD7GBTqeABoQuNTXS36G_rkiwQnKRW6GBTkns8JpKz6y6dScgB8827dlddUlg 
language=zh-CNregion=zh_Hans),

n=1, warn=FALSE)

[1] 400,0,0,0

 The returned value is wrong. I also tried several other options, but
still have the same problem. The interesting thing is if i paste  
the URL

into the IE explorer directly, it do return the correct values.

 Anybody can give me some suggestions or hints to solve this?

 Thanks a lot.

P.S. See below for the other possibilities i tried.

readLines(url(http://ditu.google.cn/maps/geo?q=+Ç°Ë®³åhttp://ditu.google.cn/maps/geo?q=+%E5%89%8D%E6%B0%B4%E5%86%B2 

,+¹ó³Ø+°²»Õ, 
+ 
ÖÐ 
¹ 
ú 
output 
= 
csv 
key 
= 
ABQIq8Fnd_oUka 
-7RdS6BrD7GBTqeABoQuNTXS36G_rkiwQnKRW6GBTkns8JpKz6y6dScgB8827dlddUlg 
language=zh-CNregion=zh),

n=1, warn=FALSE)

[1] 400,0,0,0

readLines(url(http://ditu.google.cn/maps/geo?q=+Ç°Ë®³åhttp://ditu.google.cn/maps/geo?q=+%E5%89%8D%E6%B0%B4%E5%86%B2 

,+¹ó³Ø+°²»Õ, 
+ 
ÖÐ 
¹ 
ú 
output 
= 
csv 
key 
= 
ABQIq8Fnd_oUka 
-7RdS6BrD7GBTqeABoQuNTXS36G_rkiwQnKRW6GBTkns8JpKz6y6dScgB8827dlddUlg 
language=zh-CN),

n=1, warn=FALSE)

[1] 400,0,0,0

readLines(url(http://ditu.google.cn/maps/geo?q=+Ç°Ë®³åhttp://ditu.google.cn/maps/geo?q=+%E5%89%8D%E6%B0%B4%E5%86%B2 

,+¹ó³Ø+°²»Õ, 
+ 
ÖÐ 
¹ 
ú 
output 
= 
csv 
key 
= 
ABQIq8Fnd_oUka 
-7RdS6BrD7GBTqeABoQuNTXS36G_rkiwQnKRW6GBTkns8JpKz6y6dScgB8827dlddUlg 
language=zh-CN),

n=1, warn=FALSE,encoding=UTF-8)

[1] 400,0,0,0


--


David Winsemius, MD
West Hartford, CT

__
R-help@r-project.org mailing list
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] if statement problem

2011-12-24 Thread reena
It didn't work. :(

--
View this message in context: 
http://r.789695.n4.nabble.com/if-statement-problem-tp4230026p4230933.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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] Help creating a symmetric matrix?

2011-12-24 Thread Matt Considine

Thank you all for your help and best wishes for the holiday season.
Matt Considine

On 12/24/2011 8:38 AM, William Revelle wrote:

Dear Matt, Sarah and Rui,

To answer the original question for creating a symmetric matrix



v-c(0.33740, 0.26657, 0.23388, 0.23122, 0.21476, 0.20829, 0.20486,
0.19439, 0.19237,
0.18633, 0.17298, 0.17174, 0.16822, 0.16480, 0.15027)


z-diag(6)
z[row(z)  col(z)]- v
z- z + t(z)
diag(z)- 0


z

 [,1][,2][,3][,4][,5][,6]
[1,] 0.0 0.33740 0.26657 0.23388 0.23122 0.21476
[2,] 0.33740 0.0 0.20829 0.20486 0.19439 0.19237
[3,] 0.26657 0.20829 0.0 0.18633 0.17298 0.17174
[4,] 0.23388 0.20486 0.18633 0.0 0.16822 0.16480
[5,] 0.23122 0.19439 0.17298 0.16822 0.0 0.15027
[6,] 0.21476 0.19237 0.17174 0.16480 0.15027 0.0


Bill


On Dec 24, 2011, at 6:04 AM, Sarah Goslee wrote:


Or the slightly shorter:

z-diag(6)
z[row(z)  col(z)]- v

which is what lower.tri() does,

and
z- diag(6)
z[lower.tri(z)]- v

also works.

Sarah

On Fri, Dec 23, 2011 at 9:31 PM, Rui Barradasruipbarra...@sapo.pt  wrote:

Matt Considine wrote

Hi,
I am trying to work with the output of the MINE analysis routine found at
http://www.exploredata.net

Specifically, I am trying to read the results into a matrix (ideally an
n x n x 6 matrix, but I'll settle right now for getting one column into
a matrix.)

The problem I have is not knowing how to take what amounts to being one
half of a symmetric matrix - excluding the diagonal - and getting it
into a matrix.  I have tried using lower.tri as found here
https://stat.ethz.ch/pipermail/r-help/2008-September/174516.html
but it appears to only partially fill in the matrix.  My code and an
example of the output is below.  Can anyone point me to an example that
shows how to create a matrix with this sort of input?

Thank you in advance,
Matt

#v-newx[,3]
#or, for the sake of this example
v-c(0.33740, 0.26657, 0.23388, 0.23122, 0.21476, 0.20829, 0.20486,
0.19439, 0.19237,
0.18633, 0.17298, 0.17174, 0.16822, 0.16480, 0.15027)
z-diag(6)
ind- lower.tri(z)
z[ind]- t(v)[ind]

z
  [,1][,2] [,3] [,4] [,5] [,6]
[1,] 1.0 0.00000
[2,] 0.26657 1.00000
[3,] 0.23388 0.192371000
[4,] 0.23122 0.18633   NA100
[5,] 0.21476 0.17298   NA   NA10
[6,] 0.20829 0.17174   NA   NA   NA1



Hello,

Aren't you complicating?

In the last line of your code, why use 'v[ind]' if 'ind' indexes the matrix,
not the vector?

z-diag(6)
ind- lower.tri(z)
z[ind]- v#This works
z

Rui Barradas


--
Sarah Goslee
http://www.functionaldiversity.org

__
R-help@r-project.org mailing list
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.


William Revellehttp://personality-project.org/revelle.html
Professor  http://personality-project.org
Department of Psychology   http://www.wcas.northwestern.edu/psych/
Northwestern Universityhttp://www.northwestern.edu/
Use R for psychology http://personality-project.org/r
It is 6 minutes to midnighthttp://www.thebulletin.org






__
R-help@r-project.org mailing list
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] need help with a time series plotting problem

2011-12-24 Thread vibhava
thanks for the reply. here is subset of the data that i want to plot:
dateusgs700 
1   10/1/2000   0.050970325 
2   10/2/2000   0.041059428 
3   10/3/2000   0.032564374 
4   10/4/2000   0.02775051
.
.
.
.
.

40149/27/2011   0   
40159/28/2011   0   
40169/29/2011   0   
40179/30/2011   0   

my script again is:

setwd(J:/Rstuff/flow)
flow=read.delim(flow.dat,header=TRUE,sep=\t)
plot(flow$usgs1500~as.Date(flow$date,
%m/%d/%y),type=l,xlab=date,ylab=daily discharge (m3/s)
,main=USGS1500,yaxs=i, xaxs=i,)


i wish to plot all this data as a single time series but my program is doing
some weird stuff and the x-axis has labels Jan-dec and the long term series
is broken and plotted on yearly basis.

regards

vibhava

--
View this message in context: 
http://r.789695.n4.nabble.com/need-help-with-a-time-series-plotting-problem-tp4230672p4231285.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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] need help with a time series plotting problem

2011-12-24 Thread David Winsemius


On Dec 24, 2011, at 9:24 AM, vibhava wrote:


thanks for the reply. here is subset of the data that i want to plot:
dateusgs700 
1   10/1/2000   0.050970325 
2   10/2/2000   0.041059428 
3   10/3/2000   0.032564374 
4   10/4/2000   0.02775051
.
.


Instead of posting print-output why not post the results of  
dput(head(flow))



 further  useless output deleted.




my script again is:

setwd(J:/Rstuff/flow)
flow=read.delim(flow.dat,header=TRUE,sep=\t)
plot(flow$usgs1500


There's no column with that name.


~as.Date(flow$date,
%m/%d/%y)


For another thing, you generally  need to use %Y for 4 digit years.


,type=l,xlab=date,ylab=daily discharge (m3/s)
,main=USGS1500,yaxs=i, xaxs=i,)


Not sure if that empty argument is going to be handled gracefully.

i wish to plot all this data as a single time series but my program  
is doing
some weird stuff and the x-axis has labels Jan-dec and the long term  
series

is broken and plotted on yearly basis.


Your code is not reproducible.


--
David Winsemius, MD
West Hartford, CT

__
R-help@r-project.org mailing list
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] Nested model - singularities not defined

2011-12-24 Thread Kristen Mancuso
I am using a nested model in R and the lm output shows 47 not defined
because of singularities and I have no idea why.  Any help on why this is
happening or how to fix this problem would be very much appreciated.  Below
is the output I received from R.

Thanks and happy holidays!

Call:
lm(formula = Dist ~ Treatment/SiteL/Territory)

Residuals:
   Min 1Q Median 3QMax
-6.646 -1.443  0.080  1.440  5.613

Coefficients: (47 not defined because of singularities)
   Estimate Std. Error t value
Pr(|t|)
(Intercept) 9.470001.24231   7.623 9.48e-13
***
TreatmentReference -4.055001.75689  -2.308  0.02201
*
TreatmentSingle Tree   -2.430002.15175  -1.129
0.26010
TreatmentTypical   -2.035711.55732  -1.307
0.19263
TreatmentIntensive:SiteLB  -2.255711.55732  -1.448
0.14904
TreatmentReference:SiteLB  -2.253331.60382  -1.405
0.16156
TreatmentSingle Tree:SiteLB 0.432861.99213   0.217
0.82821
TreatmentTypical:SiteLB 0.643711.45484   0.442
0.65863
TreatmentIntensive:SiteLC  -3.890002.15175  -1.808  0.07212
.
TreatmentReference:SiteLC   0.913001.66673   0.548
0.58445
TreatmentSingle Tree:SiteLC-1.598002.07878  -0.769
0.44296
TreatmentTypical:SiteLC 0.11.32809   0.075
0.94005
TreatmentIntensive:SiteLA:TerritoryQ   -3.940001.75689  -2.243  0.02601
*
TreatmentReference:SiteLA:TerritoryQ   -1.617001.66673  -0.970
0.33313
TreatmentSingle Tree:SiteLA:TerritoryQ  0.010002.15175   0.005
0.99630
TreatmentTypical:SiteLA:TerritoryQ   NA NA  NA
NA
TreatmentIntensive:SiteLB:TerritoryQ NA NA  NA
NA
TreatmentReference:SiteLB:TerritoryQ1.596911.38232   1.155
0.24936
TreatmentSingle Tree:SiteLB:TerritoryQ -1.152861.32809  -0.868
0.38639
TreatmentTypical:SiteLB:TerritoryQ   NA NA  NA
NA
TreatmentIntensive:SiteLC:TerritoryQ NA NA  NA
NA
TreatmentReference:SiteLC:TerritoryQ0.742001.81451   0.409
0.68303
TreatmentSingle Tree:SiteLC:TerritoryQ  2.329671.32254   1.762  0.07967
.
TreatmentTypical:SiteLC:TerritoryQ -0.370001.32809  -0.279
0.78084
TreatmentIntensive:SiteLA:TerritoryR NA NA  NA
NA
TreatmentReference:SiteLA:TerritoryR3.375001.66673   2.025  0.04419
*
TreatmentSingle Tree:SiteLA:TerritoryR   NA NA  NA
NA
TreatmentTypical:SiteLA:TerritoryR   NA NA  NA
NA
TreatmentIntensive:SiteLB:TerritoryR NA NA  NA
NA
TreatmentReference:SiteLB:TerritoryR NA NA  NA
NA
TreatmentSingle Tree:SiteLB:TerritoryR   NA NA  NA
NA
TreatmentTypical:SiteLB:TerritoryR   NA NA  NA
NA
TreatmentIntensive:SiteLC:TerritoryR NA NA  NA
NA
TreatmentReference:SiteLC:TerritoryR NA NA  NA
NA
TreatmentSingle Tree:SiteLC:TerritoryR   NA NA  NA
NA
TreatmentTypical:SiteLC:TerritoryR   NA NA  NA
NA
TreatmentIntensive:SiteLA:TerritoryT NA NA  NA
NA
TreatmentReference:SiteLA:TerritoryT1.921001.66673   1.153
0.25046
TreatmentSingle Tree:SiteLA:TerritoryT   NA NA  NA
NA
TreatmentTypical:SiteLA:TerritoryT   NA NA  NA
NA
TreatmentIntensive:SiteLB:TerritoryT NA NA  NA
NA
TreatmentReference:SiteLB:TerritoryT NA NA  NA
NA
TreatmentSingle Tree:SiteLB:TerritoryT   NA NA  NA
NA
TreatmentTypical:SiteLB:TerritoryT   NA NA  NA
NA
TreatmentIntensive:SiteLC:TerritoryT NA NA  NA
NA
TreatmentReference:SiteLC:TerritoryT NA NA  NA
NA
TreatmentSingle Tree:SiteLC:TerritoryT   NA NA  NA
NA
TreatmentTypical:SiteLC:TerritoryT   NA NA  NA
NA
TreatmentIntensive:SiteLA:TerritoryW   -3.385001.75689  -1.927  0.05542
.
TreatmentReference:SiteLA:TerritoryW   -0.285001.89766  -0.150
0.88077
TreatmentSingle Tree:SiteLA:TerritoryW -0.235001.96426  -0.120
0.90489
TreatmentTypical:SiteLA:TerritoryW   NA NA  NA
NA
TreatmentIntensive:SiteLB:TerritoryW NA NA  NA
NA
TreatmentReference:SiteLB:TerritoryW NA NA  NA
NA
TreatmentSingle Tree:SiteLB:TerritoryW   NA NA  NA
NA
TreatmentTypical:SiteLB:TerritoryW   NA NA  NA
NA
TreatmentIntensive:SiteLC:TerritoryW NA NA  NA
NA
TreatmentReference:SiteLC:TerritoryW NA NA  NA
NA
TreatmentSingle Tree:SiteLC:TerritoryW  3.336331.50451   2.218  0.02770
*
TreatmentTypical:SiteLC:TerritoryW  0.285711.99213   0.143
0.88610
TreatmentIntensive:SiteLA:TerritoryX   -3.170001.75689  -1.804  0.07267
.

Re: [R] Nested model - singularities not defined

2011-12-24 Thread David Winsemius


On Dec 24, 2011, at 12:07 PM, Kristen Mancuso wrote:


I am using a nested model in R and the lm output shows 47 not defined
because of singularities and I have no idea why.  Any help on why  
this is
happening or how to fix this problem would be very much  
appreciated.  Below

is the output I received from R.



not defined because of singularities


This question should be a FAQ if it's not already:

http://lmgtfy.com/?q=%22not+defined+because+of+singularities%22



--

David Winsemius, MD
West Hartford, CT

__
R-help@r-project.org mailing list
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] Nested model - singularities not defined

2011-12-24 Thread Bert Gunter
... and  John Nash's comment (regarding another issue) may also be appropriate:

...  As with many tools in this domain, for effective use they
require more knowledge than many of their users possess, and can be
dangerous because they
seem to work. 


-- Bert

On Sat, Dec 24, 2011 at 9:44 AM, David Winsemius dwinsem...@comcast.net wrote:

 On Dec 24, 2011, at 12:07 PM, Kristen Mancuso wrote:

 I am using a nested model in R and the lm output shows 47 not defined
 because of singularities and I have no idea why.  Any help on why this is
 happening or how to fix this problem would be very much appreciated.
  Below
 is the output I received from R.


 not defined because of singularities


 This question should be a FAQ if it's not already:

 http://lmgtfy.com/?q=%22not+defined+because+of+singularities%22



 --

 David Winsemius, MD
 West Hartford, CT

 __
 R-help@r-project.org mailing list
 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.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

__
R-help@r-project.org mailing list
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] need help with a time series plotting problem

2011-12-24 Thread vibhava
sorry about the change in variable name (data has column named usgs700 but
code has usgs700). actually i am trying to get familiar with R as i need to
make more complex time series plots in near future (stackplots, scatterplot
etc.). Let me try to explain what i am intending to achieve here. below i
have copied first few lines of a large dataset (daily flow records for 4017
days at 8 usgs locations). first column is date and rest of them are flow
data measured at these 8 different location. now all i wish to do is to read
them in and make time series plots for the entire period of record for each
stations. i have attached some figures that i made in excel and i wish to do
something like this using R. 

I know my code might have some errors and that's the reason why i am
requesting for help from people who know R better than I do. i am R user for
less than a day but i know what i am trying to do is really simple and all i
need is to read 9 columns and make a simple time series plot.

i would appreciate if anyone can correct the code that i have written below
or if they have some alternate way of doing this i would be happy to learn
something new

regards

vibhava

DateUSGS700 USGS1000USGS1500USGS 1898   USGS1975
USGS2500USGS2700USGS2800
10/1/2000   0.050.572.322.274.1129.45   29.45   29.45
10/2/2000   0.040.542.121.704.0529.17   29.17   29.17
10/3/2000   0.030.481.931.983.9628.88   28.88   28.88
10/4/2000   0.030.451.761.423.9128.60   28.60   28.60
10/5/2000   0.030.421.641.273.8228.32   28.32   28.32
10/6/2000   0.030.421.531.133.7428.26   28.26   28.26
10/7/2000   0.110.511.595.663.6828.23   28.23   28.23
10/8/2000   0.160.451.703.403.6227.84   27.84   27.84
10/9/2000   0.100.421.782.553.5426.56   26.56   26.56

 setwd(J:/Rstuff/flow)   
  
 # defining the working directory
 flow=read.delim(flow.dat,header=TRUE,sep=\t) 
 # opening the above tab separated data file
 plot(flow$USGS1500~as.Date(flow$Date,
 %m/%d/%y),type=l,xlab=date,ylab=daily discharge (m3/s)
 ,main=USGS1500,yaxs=i, xaxs=i) 
  
 #just to test my code, i am trying to make time series   


#plot of 1 variable USGS1500

http://r.789695.n4.nabble.com/file/n4231737/flow.docx flow.docx 

--
View this message in context: 
http://r.789695.n4.nabble.com/need-help-with-a-time-series-plotting-problem-tp4230672p4231737.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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] need help with a time series plotting problem

2011-12-24 Thread jim holtman
This should plot all the columns for you:

flow - read.table(text = DateUSGS700 USGS1000USGS1500
USGS1898   USGS1975USGS2500USGS2700
USGS2800
10/1/2000   0.050.572.322.274.1129.45   29.45   29.45
10/2/2000   0.040.542.121.704.0529.17   29.17   29.17
10/3/2000   0.030.481.931.983.9628.88   28.88   28.88
10/4/2000   0.030.451.761.423.9128.60   28.60   28.60
10/5/2000   0.030.421.641.273.8228.32   28.32   28.32
10/6/2000   0.030.421.531.133.7428.26   28.26   28.26
10/7/2000   0.110.511.595.663.6828.23   28.23   28.23
10/8/2000   0.160.451.703.403.6227.84   27.84   27.84
10/9/2000   0.100.421.782.553.5426.56   26.56   26.56
, as.is = TRUE
, header = TRUE
)

# setup margins
par(mar = c(5, 5, 3, 3))

# plot each column of data
for (i in names(flow)[-1]){  # ignore the Date column
plot(as.Date(flow$Date, %m/%d/%y)
, flow[[i]]  # column to plot
,type=l
,xlab=date
,ylab=expression(daily discharge ( * m^3/s * ))
,main=i
,yaxs=i
, xaxs=i
)
}


On Sat, Dec 24, 2011 at 1:20 PM, vibhava vibhavasrivast...@gmail.com wrote:
 sorry about the change in variable name (data has column named usgs700 but
 code has usgs700). actually i am trying to get familiar with R as i need to
 make more complex time series plots in near future (stackplots, scatterplot
 etc.). Let me try to explain what i am intending to achieve here. below i
 have copied first few lines of a large dataset (daily flow records for 4017
 days at 8 usgs locations). first column is date and rest of them are flow
 data measured at these 8 different location. now all i wish to do is to read
 them in and make time series plots for the entire period of record for each
 stations. i have attached some figures that i made in excel and i wish to do
 something like this using R.

 I know my code might have some errors and that's the reason why i am
 requesting for help from people who know R better than I do. i am R user for
 less than a day but i know what i am trying to do is really simple and all i
 need is to read 9 columns and make a simple time series plot.

 i would appreciate if anyone can correct the code that i have written below
 or if they have some alternate way of doing this i would be happy to learn
 something new

 regards

 vibhava

 Date    USGS700 USGS1000        USGS1500        USGS 1898       USGS1975      
   USGS2500        USGS2700        USGS2800
 10/1/2000       0.05    0.57    2.32    2.27    4.11    29.45   29.45   29.45
 10/2/2000       0.04    0.54    2.12    1.70    4.05    29.17   29.17   29.17
 10/3/2000       0.03    0.48    1.93    1.98    3.96    28.88   28.88   28.88
 10/4/2000       0.03    0.45    1.76    1.42    3.91    28.60   28.60   28.60
 10/5/2000       0.03    0.42    1.64    1.27    3.82    28.32   28.32   28.32
 10/6/2000       0.03    0.42    1.53    1.13    3.74    28.26   28.26   28.26
 10/7/2000       0.11    0.51    1.59    5.66    3.68    28.23   28.23   28.23
 10/8/2000       0.16    0.45    1.70    3.40    3.62    27.84   27.84   27.84
 10/9/2000       0.10    0.42    1.78    2.55    3.54    26.56   26.56   26.56

 setwd(J:/Rstuff/flow)
 # defining the working directory
 flow=read.delim(flow.dat,header=TRUE,sep=\t)
 # opening the above tab separated data file
 plot(flow$USGS1500~as.Date(flow$Date,
 %m/%d/%y),type=l,xlab=date,ylab=daily discharge (m3/s)
 ,main=USGS1500,yaxs=i, xaxs=i)
 #just to test my code, i am trying to make time series

 #plot of 1 variable USGS1500

 http://r.789695.n4.nabble.com/file/n4231737/flow.docx flow.docx

 --
 View this message in context: 
 http://r.789695.n4.nabble.com/need-help-with-a-time-series-plotting-problem-tp4230672p4231737.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list
 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.



-- 
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.

__
R-help@r-project.org mailing list
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] Fwd:

2011-12-24 Thread Kristi Shoemaker

http://www.xn--altnilekhap-p9a47gja.gen.tr/unread_message.php?gid=28udihehog=819fyzuvomud=96

__
R-help@r-project.org mailing list
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] p values in lmer

2011-12-24 Thread Greg Snow
This takes me back to listening to a professor lament about the researchers 
that would spend years collecting their data, then negate all that effort 
because they insist on using tools that are quick rather than correct.

So, before dismissing the use of pvals.fnc you might ask how long it takes to 
run relative to how long it took to collect the data and the importance of the 
answer.  If you feel the need to compute p-values multiple times, then you may 
need to rethink your approach (model selection based on repeated p-values 
results in p-values that are meaningless at best).

If you consider the above and still feel the need for a quick p-value rather 
than a correct one then you can use the 
SnowsCorrectlySizedButOtherwiseUselessTestOfAnything function from the 
TeachingDemos package. It is quick (but be sure to fully read the 
documentation).

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of arunkumar
Sent: Thursday, December 22, 2011 9:13 PM
To: r-help@r-project.org
Subject: [R] p values in lmer

hi

How to get p-values for lmer funtion other than pvals.fnc(), since it takes
long time for execution

-
Thanks in Advance
Arun
--
View this message in context: 
http://r.789695.n4.nabble.com/p-values-in-lmer-tp4227434p4227434.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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
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] (no subject)

2011-12-24 Thread Kristi Shoemaker

http://kinderlandia.edu.co/unread_message.php?gid=89yripukin=434cjwalal=57

__
R-help@r-project.org mailing list
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] linear interpolation of time series

2011-12-24 Thread Alemtsehai Abate
Dear R users,

I have two irregular time series say x and y. Each series is supposed to
cover 20 years. The data looks, for instance:
x-c(200,178, 330, 127, 420) ## only 5 observations out of the expected 20
annual values
y-c(0.35,-0.18,-0.54,0.78,1.7,-1.1,0.2,1.9,0.49)### only 9 observations of
the expected 20

I need to intepolate each of the series into equally spaced 20 points. Is
there a function and library in R to do this please?

Many thanks

Tsegaye

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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] linear interpolation of time series

2011-12-24 Thread R. Michael Weylandt
zoo:::na.approx will do nicely. Though you are going to have to supply
some sort of time metric or it won't know where interpolations should
happen.

Something like this is my usual route:

x - zoo(1:5, Sys.Date() + 2*(1:5))

x.new - zoo(NA, seq(min(time(x)), to =  max(time(x)), by = day))

x.new[time(x)] - x

na.approx(x.new)

Michael

On Sat, Dec 24, 2011 at 5:39 PM, Alemtsehai Abate abatea...@gmail.com wrote:
 Dear R users,

 I have two irregular time series say x and y. Each series is supposed to
 cover 20 years. The data looks, for instance:
 x-c(200,178, 330, 127, 420) ## only 5 observations out of the expected 20
 annual values
 y-c(0.35,-0.18,-0.54,0.78,1.7,-1.1,0.2,1.9,0.49)### only 9 observations of
 the expected 20

 I need to intepolate each of the series into equally spaced 20 points. Is
 there a function and library in R to do this please?

 Many thanks

 Tsegaye

        [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 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
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] extract factor scores post-varimax

2011-12-24 Thread ark06
Hello all,

I've run a principal component regression using the PLS package.  I then
applied varimax rotation (i.e., using
http://stat.ethz.ch/R-manual/R-patched/library/stats/html/varimax.html).   I
cannot figure out how to extract the factor loadings post-varimax.   Is
there a command to do this?   scores(x) does not do it.

Thanks and happy holidays

--
View this message in context: 
http://r.789695.n4.nabble.com/extract-factor-scores-post-varimax-tp4232192p4232192.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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] need help with a time series plotting problem

2011-12-24 Thread vibhava
thanks for your reply. i don't think your solution is what i am looking for.
Please look at the attached two plots; first plot is what i have made using
excel and the second plot is what i was getting when i was running my script
through R yesterday night. I think my script was reading and implementing
things nicely but the only problem was that at the end of each year my time
series line use to start from the same axis label (instead of keep creating
more labels and extending the x-axis.
  therefore what happened was that unlike the excel plot
which has x-axis from oct00-oct2011, i have x-axis labels jan-nov.  i am
looking for something similar to excel where you select the axis and right
click on it and you can extend the x-axis. 
 so to sum up i *just need* to know how to extend my
x-axis (see attached figures) so that i get a continuous line (i need one
line for each plot representing 11 years of record AND DO NOT want 11 lines
representing the same thing).

regards

vibhava
http://r.789695.n4.nabble.com/file/n4232160/flow.docx flow.docx 

--
View this message in context: 
http://r.789695.n4.nabble.com/need-help-with-a-time-series-plotting-problem-tp4230672p4232160.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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] need help with a time series plotting problem

2011-12-24 Thread jim holtman
Try this; this should put the labels on the x-axis like Excel does:

flow - read.table(text = DateUSGS700 USGS1000USGS1500
USGS1898   USGS1975USGS2500USGS2700 USGS2800
10/1/2001   0.050.572.322.274.1129.45   29.45   29.45
10/1/2002   0.040.542.121.704.0529.17   29.17   29.17
10/1/2003   0.030.481.931.983.9628.88   28.88   28.88
10/1/2004   0.030.451.761.423.9128.60   28.60   28.60
10/1/2005   0.030.421.641.273.8228.32   28.32   28.32
10/1/2006   0.030.421.531.133.7428.26   28.26   28.26
10/1/2007   0.110.511.595.663.6828.23   28.23   28.23
10/1/2008   0.160.451.703.403.6227.84   27.84   27.84
10/1/2009   0.100.421.782.553.5426.56   26.56   26.56

   , as.is = TRUE
   , header = TRUE
   )

# setup margins
par(mar = c(5, 5, 3, 3))

# create x-axis with yearly tick marks starting in Oct
x_range - seq(from = as.Date(2001-10-1)
, to = as.Date(2011-10-1)
, by = '1 year'
)
# now create the format of month-year
x_label - sprintf(%s-%02d, format(x_range, %b),
as.POSIXlt(x_range)$year %% 100)

# plot each column of data
for (i in names(flow)[-1]){  # ignore the Date column
   plot(as.Date(flow$Date, %m/%d/%Y)
   , flow[[i]]  # column to plot
   ,type=l
   ,xlab=date
   ,ylab=expression(daily discharge ( * m^3/s * ))
   ,main=i
   ,yaxs=i
   , xaxs=i
   , xaxt = 'n'
   , xlim = range(x_range)
   )

   axis(1, at = x_range, labels = x_label, las = 2)
}




On Sat, Dec 24, 2011 at 3:23 PM, jim holtman jholt...@gmail.com wrote:
 This should plot all the columns for you:

 flow - read.table(text = Date    USGS700 USGS1000        USGS1500
    USGS1898       USGS1975        USGS2500        USGS2700
 USGS2800
 10/1/2000       0.05    0.57    2.32    2.27    4.11    29.45   29.45   29.45
 10/2/2000       0.04    0.54    2.12    1.70    4.05    29.17   29.17   29.17
 10/3/2000       0.03    0.48    1.93    1.98    3.96    28.88   28.88   28.88
 10/4/2000       0.03    0.45    1.76    1.42    3.91    28.60   28.60   28.60
 10/5/2000       0.03    0.42    1.64    1.27    3.82    28.32   28.32   28.32
 10/6/2000       0.03    0.42    1.53    1.13    3.74    28.26   28.26   28.26
 10/7/2000       0.11    0.51    1.59    5.66    3.68    28.23   28.23   28.23
 10/8/2000       0.16    0.45    1.70    3.40    3.62    27.84   27.84   27.84
 10/9/2000       0.10    0.42    1.78    2.55    3.54    26.56   26.56   26.56
    , as.is = TRUE
    , header = TRUE
    )

 # setup margins
 par(mar = c(5, 5, 3, 3))

 # plot each column of data
 for (i in names(flow)[-1]){  # ignore the Date column
    plot(as.Date(flow$Date, %m/%d/%y)
        , flow[[i]]  # column to plot
        ,type=l
        ,xlab=date
        ,ylab=expression(daily discharge ( * m^3/s * ))
        ,main=i
        ,yaxs=i
        , xaxs=i
        )
 }


 On Sat, Dec 24, 2011 at 1:20 PM, vibhava vibhavasrivast...@gmail.com wrote:
 sorry about the change in variable name (data has column named usgs700 but
 code has usgs700). actually i am trying to get familiar with R as i need to
 make more complex time series plots in near future (stackplots, scatterplot
 etc.). Let me try to explain what i am intending to achieve here. below i
 have copied first few lines of a large dataset (daily flow records for 4017
 days at 8 usgs locations). first column is date and rest of them are flow
 data measured at these 8 different location. now all i wish to do is to read
 them in and make time series plots for the entire period of record for each
 stations. i have attached some figures that i made in excel and i wish to do
 something like this using R.

 I know my code might have some errors and that's the reason why i am
 requesting for help from people who know R better than I do. i am R user for
 less than a day but i know what i am trying to do is really simple and all i
 need is to read 9 columns and make a simple time series plot.

 i would appreciate if anyone can correct the code that i have written below
 or if they have some alternate way of doing this i would be happy to learn
 something new

 regards

 vibhava

 Date    USGS700 USGS1000        USGS1500        USGS 1898       USGS1975     
    USGS2500        USGS2700        USGS2800
 10/1/2000       0.05    0.57    2.32    2.27    4.11    29.45   29.45   29.45
 10/2/2000       0.04    0.54    2.12    1.70    4.05    29.17   29.17   29.17
 10/3/2000       0.03    0.48    1.93    1.98    3.96    28.88   28.88   28.88
 10/4/2000       0.03    0.45    1.76    1.42    3.91    28.60   28.60   28.60
 10/5/2000       0.03    0.42    1.64    1.27    3.82    28.32   28.32   28.32
 10/6/2000       0.03    0.42    1.53    1.13    3.74    28.26   28.26   28.26
 10/7/2000       0.11    0.51    1.59    5.66    3.68    28.23