Re: [R] extract a subset of non-contiguous elements of a matrix

2014-06-20 Thread PIKAL Petr
Hi

You can pad some NA to the result before transforming it to required matrix but 
as Frede pointed out, what do you want to do with such result?

tm.1=rbind(c(1,-3,2,-4), c(1,-3,2,-4),c(1,-3,2,-4))
xx-which(tm.1  0, arr.ind=TRUE)
res-apply(xx, 1, paste0, collapse=,)
dim(res)-c(3,2)
 res
 [,1]  [,2]
[1,] 1,1 1,3
[2,] 2,1 2,3
[3,] 3,1 3,3

tm.1 - matrix(c(11,22,33,-4), ncol=2)
xx-which(tm.1  0, arr.ind=TRUE)
res-apply(xx, 1, paste0, collapse=,)
res-c(res, NA)
dim(res)-c(2,2)
res
 [,1]  [,2]
[1,] 1,1 1,2
[2,] 2,1 NA

Regards
Petr

 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of carol white
 Sent: Thursday, June 19, 2014 3:46 PM
 To: Frede Aakmann Tøgersen; Bart Kastermans
 Cc: r-help@r-project.org
 Subject: Re: [R] extract a subset of non-contiguous elements of a
 matrix

 I realize that that the problem arises if there is a different number
 of negative numbers in the rows and columns of the original matrix. In
 this case, the resulting matrix won't have the same number of rows for
 all columns. The problem for ex doesn't arise for my example but for
 Bart's example

  [1,]  1  1
  [2,]  2  1
  [3,]  1  2

 how to combine these elemnts? If the 2nd col contains the number of the
 resulting matrix, then, the number of rows are different and the matrix
 can't be completed.



 On Thursday, June 19, 2014 3:39 PM, Frede Aakmann Tøgersen
 fr...@vestas.com wrote:




 As Peter and Bart I really have a problem understanding you.

 Perhaps if you tell us what your desired result is going to used for we
 can be more helpful. You can do that using your latest example.

 In that example you want a matrix of sets of row and column indices.
 This will probably have to be a matrix of characters. There you go from
 a 3×4 matrix to a 3×2 matrix.  What do you want in case of Barts 2×2
 matrix? A 3×1 or 1×3 matrix? And in a more general case?

 Best regards

 Frede


 Sendt fra Samsung mobil

  Oprindelig meddelelse 
 Fra: carol white
 Dato:19/06/2014 15.18 (GMT+01:00)
 Til: Bart Kastermans
 Cc: r-help@r-project.org
 Emne: Re: [R] extract a subset of non-contiguous elements of a matrix

  tm.1=rbind(c(1,-3,2,-4), c(1,-3,2,-4),c(1,-3,2,-4))

  which(tm.1  0, arr.ind=TRUE)
  row col
 [1,]   1   1
 [2,]   2   1
 [3,]   3   1
 [4,]   1   3
 [5,]   2   3
 [6,]   3   3

 so the answer should have the elements of tm.1 with the following
 indexes

 1,1 1,3
 2,1 2,3
 3,1 3,3



 On Thursday, June 19, 2014 3:08 PM, Bart Kastermans
 kaste...@kasterma.net wrote:



 If you give an example of input and desired output I can think about
 this.  But at this point I do not understand what you want.  In the
 example I gave the positive elements do not form a submatrix in any way
 I can think of.


 On 19 Jun 2014, at 15:04, carol white wht_...@yahoo.com wrote:

  well it gives a vector which is useless as I want a matrix.
 
 
  On Thursday, June 19, 2014 2:40 PM, Bart Kastermans
 kaste...@kasterma.net wrote:
 
 
   tm.1 - matrix(c(11,22,33,-4), ncol=2)
   which(tm.1  0, arr.ind=TRUE)
row col
  [1,]  1  1
  [2,]  2  1
  [3,]  1  2
   tm.1[which(tm.1  0, arr.ind=TRUE)]
  [1] 11 22 33
 
  This last command does what you ask I think.
 
  On 19 Jun 2014, at 14:12, carol white wht_...@yahoo.com wrote:
 
   The extracted values don't form a matrix and that's the question
 how
   to extract because which returns the indexes? that is, from
   1,1
   2,1
   1,2
  
   how to retrieve values?
  
   Or if at the position 2,1, there is a negative value, how to
   retrieve
   1,1
   1,2
  
  
   Carol
  
  
   On Thursday, June 19, 2014 1:29 PM, Bart Kastermans
 kaste...@kasterma.net wrote:
  
  
   On 19 Jun 2014, at 13:19, carol white wht_...@yahoo.com wrote:
  
Hi,
Is there a way to extract a subset of non-contiguous elements of
 a matrix elegantly and with 1 or very few scripts?
   
Suppose I have a matrix of positive and negative numbers (m) and
 I
want to retrieve only the positive number. This I can do
   
which(m0, arr.ind=T) which gives the indices of positive
 elements like (37,1), (80,1), ..., (54,2) etc. How can I extract
 positive numbers without looping on the indexes provided by which to
 make a new matrix?
  
   What matrix do you want?  For e.g.
  
tm.1 - matrix(c(11,22,33,-4), ncol=2)
which(tm.1  0, arr.ind=TRUE)
  row col
   [1,]  1  1
   [2,]  2  1
   [3,]  1  2
tm.1[which(tm.1  0, arr.ind=TRUE)]
   [1] 11 22 33
  
   The extracted values do not form a matrix.
  
   Either the above contains the answer, or I don’t understand the
 question.
  
   Best,
   Bart
  
  
   
thanks,
   
Carol
  
  
 
 
 [[alternative HTML version deleted]]
   [[alternative HTML version deleted]]



Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny 
pouze jeho adresátům.
Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně 

[R] Rstudio: is it possible to create a document out of a working script?

2014-06-20 Thread Luca Cerone
Dear all,
I am very happy with the new features introduced by Rstudio about how
to create documents embedding R code.

I would like to know though if there is some way to embed code from a
working script into an Rmd document.
I have several working scripts for which I would like to report the
results, but I would like to avoid
copy and paste the code in the Rmd document: the pipeline is still a
work in progress,
and it is likely that I will end up changing the code and parameters
in the script.

As you can imagine, having to copy and paste my code is prone error,
and leads to a lot of code replication.
I would like to avoid this, but couldn´t find a straightforward way so far.


Thanks a lot in advance,
of course if you have other advices, or comments on best practices for
this sort of thing,
I would like to hear them from you.

Cheers,
Luca

__
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] Rstudio: is it possible to create a document out of a working script?

2014-06-20 Thread Berend Hasselman

On 20-06-2014, at 11:20, Luca Cerone luca.cer...@gmail.com wrote:

 Dear all,
 I am very happy with the new features introduced by Rstudio about how
 to create documents embedding R code.
 
 I would like to know though if there is some way to embed code from a
 working script into an Rmd document.
 I have several working scripts for which I would like to report the
 results, but I would like to avoid
 copy and paste the code in the Rmd document: the pipeline is still a
 work in progress,
 and it is likely that I will end up changing the code and parameters
 in the script.
 
 As you can imagine, having to copy and paste my code is prone error,
 and leads to a lot of code replication.
 I would like to avoid this, but couldn´t find a straightforward way so far.
 
 
 Thanks a lot in advance,
 of course if you have other advices, or comments on best practices for
 this sort of thing,
 I would like to hear them from you.
 

This doesn’t belong on the R-help mailinglist.
It is a question about Rstudio and should be directed to Rstudio support.

Berend

__
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] Rstudio: is it possible to create a document out of a working script?

2014-06-20 Thread Bob O'Hara
How about simply using source() to call the script? If necessary, wrap bits
of the script in functions, so you source a file with lots of functions,
and then call the ones you need, as you need them.

Bob

On 20 June 2014 11:20, Luca Cerone luca.cer...@gmail.com wrote:

 Dear all,
 I am very happy with the new features introduced by Rstudio about how
 to create documents embedding R code.

 I would like to know though if there is some way to embed code from a
 working script into an Rmd document.
 I have several working scripts for which I would like to report the
 results, but I would like to avoid
 copy and paste the code in the Rmd document: the pipeline is still a
 work in progress,
 and it is likely that I will end up changing the code and parameters
 in the script.

 As you can imagine, having to copy and paste my code is prone error,
 and leads to a lot of code replication.
 I would like to avoid this, but couldn´t find a straightforward way so far.


 Thanks a lot in advance,
 of course if you have other advices, or comments on best practices for
 this sort of thing,
 I would like to hear them from you.

 Cheers,
 Luca

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




-- 
Bob O'Hara

Biodiversity and Climate Research Centre
Senckenberganlage 25
D-60325 Frankfurt am Main,
Germany

Tel: +49 69 798 40226
Mobile: +49 1515 888 5440
WWW:   http://www.bik-f.de/root/index.php?page_id=219
Blog: http://occamstypewriter.org/boboh/
Journal of Negative Results - EEB: www.jnr-eeb.org

[[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] {vars} SVAR A-Model: Restrictions on Matrix A and Variance-Covariance-Matrix

2014-06-20 Thread chili
Thanks to Dennis Murphy   I was able to improve mein R-Code:

1) A-Matrix:

A_Matrix - diag(4)   # 4 restrictions
A_Matrix[upper.tri(A_Matrix)] - NA# 6 further restrictions

2) Variance-Covariance-Matrix

Xmat - cbind(X1, X2, X3, X4)
vs - apply(Xmat, 2, var)
VC_Matrix- diag(vs) # final 6 restricions

That worked fine so far.

Now, is there any chance to implement the VC_Matrix it into my
SVAR-estimation?  



--
View this message in context: 
http://r.789695.n4.nabble.com/vars-SVAR-A-Model-Restrictions-on-Matrix-A-and-Variance-Covariance-Matrix-tp4692387p4692424.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] Rstudio: is it possible to create a document out of a working script?

2014-06-20 Thread Luca Cerone
Hi Berend, sorry if it OT (though I think that the process is pretty
much Rstudio independent, since what Rstudio does is wrap up knitr and
their package Rmarkdown,
but all the process can be run from the shell).

Bob, so far this is what I do, but it is not ideal for two reasons:
1. I would like my report to be a step by step guide of what the
script does. Wrapping the scripts in small functions, subscripts
doesn´t help,
because in the report what you would see is source(subscript.r),
not the content of the subscript.

2. in a way I would need the exact opposite of what knitr and
Rmarkdown do (at least by default). I would like to document my script
in a way that can be run independently of the report and that, when
neede, could use the comments to generate the report, similarly to how
roxygen2 works when writing the documentation.

Thanks a lot for the help,
apologies again if this is OT (if so please remove the thread and I
will ask in the the Rstudio support).

Cheers,
Luca

2014-06-20 11:28 GMT+02:00 Bob O'Hara rni@gmail.com:
 How about simply using source() to call the script? If necessary, wrap bits
 of the script in functions, so you source a file with lots of functions, and
 then call the ones you need, as you need them.

 Bob

 On 20 June 2014 11:20, Luca Cerone luca.cer...@gmail.com wrote:

 Dear all,
 I am very happy with the new features introduced by Rstudio about how
 to create documents embedding R code.

 I would like to know though if there is some way to embed code from a
 working script into an Rmd document.
 I have several working scripts for which I would like to report the
 results, but I would like to avoid
 copy and paste the code in the Rmd document: the pipeline is still a
 work in progress,
 and it is likely that I will end up changing the code and parameters
 in the script.

 As you can imagine, having to copy and paste my code is prone error,
 and leads to a lot of code replication.
 I would like to avoid this, but couldn´t find a straightforward way so
 far.


 Thanks a lot in advance,
 of course if you have other advices, or comments on best practices for
 this sort of thing,
 I would like to hear them from you.

 Cheers,
 Luca

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




 --
 Bob O'Hara

 Biodiversity and Climate Research Centre
 Senckenberganlage 25
 D-60325 Frankfurt am Main,
 Germany

 Tel: +49 69 798 40226
 Mobile: +49 1515 888 5440
 WWW:   http://www.bik-f.de/root/index.php?page_id=219
 Blog: http://occamstypewriter.org/boboh/
 Journal of Negative Results - EEB: www.jnr-eeb.org



-- 
Luca Cerone

Tel: +34 692 06 71 28
Skype: luca.cerone

__
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] EOF error reading csv file

2014-06-20 Thread S N V Krishna
Hi,

I am confronted with this error while trying to read csv file into R session.
Though it is warning message, I noticed that the whole file was not read 
properly.
After having gone through the whole file, unable to identify error in file. I 
am copying the last 2 rows in original csv file after which the reading was not 
proper. (cannot enclose file because of big size)

TRANSCONTINENTAL GAS - ZONE 6 (NY) (BASIS) - ICE FUTURES ENERGY DIV

2/25/2014

81271

51032

37508

14592

31154

1710

0

1490

1296

943

0

341

69914

73499

11357

7772

WAHA HUB - WEST TEXAS DELIVERED/BUYER'S INDEX - ICE FUTURES ENERGY DIV

2/25/2014

14232

13331

11786

0

0

0

0

615

0

280

0

0

13611

12401

621

1831



Can someone go through the same and suggest what I am missing out.

 cftc = read.table(cftcdata_ncn.csv, sep = ',', header = TRUE, fill = TRUE)
Warning message:
In scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,  :
  EOF within quoted string

 sessionInfo()
R version 3.1.0 (2014-04-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

Many thanks for the help.

Best regards,

Krishna


[[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] EOF error reading csv file

2014-06-20 Thread Jim Holtman
it looks like you have unbalanced quotes in the line containing:

DELIVERED/BUYER'S INDEX

try putting the option

quotes = ''

Sent from my iPad

On Jun 20, 2014, at 6:02, S N V Krishna kris...@primps.com.sg wrote:

 DELIVERED/BUYER'S INDEX

__
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] How to process a log file in R ?

2014-06-20 Thread praveen pal
Hello

   i am new to R and need help,
   I want to parse a log file using R named tracking.log file.
   i try to read it using jsonlite package but not able to get data  in
proper format.


   i entered a sample of file below.
   i also attached a file tracking.log file with this mail


 {
username: lavita,
host: 10.105.22.32,
event_source: server,
event_type:
/courses/IITB/CS101/2014_T1/xblock/i4x:;_;_IITB;_CS101;_video;_d333fa637a074b41996dc2fd5e675818/handler/xmodule_handler/save_user_state,
context: {
course_id: IITB/CS101/2014_T1,
course_user_tags: {},
user_id: 42,
org_id: IITB
},
time: 2014-06-20T05:49:10.468638+00:00,
ip: 127.0.0.1,
event: {\POST\: {\saved_video_position\: [\00:02:10\]},
\GET\: {}},
agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:18.0) Gecko/20100101
Firefox/18.0,
page: null
}

{
username: raeha,
host: 10.105.22.32,
event_source: server,
event_type: problem_check,
context: {
course_id: IITB/CS101/2014_T1,
course_user_tags: {},
user_id: 40,
org_id: IITB,
module: {
display_name: 
}
},
time: 2014-06-20T06:43:52.716455+00:00,
ip: 127.0.0.1,
event: {
submission: {
i4x-IITB-CS101-problem-33e4aac93dc84f368c93b1d08fa984fc_2_1: {
input_type: choicegroup,
question: ,
response_type: multiplechoiceresponse,
answer: MenuInflater.inflate(),
variant: ,
correct: true
}
},
success: correct,
grade: 1,
correct_map: {
i4x-IITB-CS101-problem-33e4aac93dc84f368c93b1d08fa984fc_2_1: {
hint: ,
hintmode: null,
correctness: correct,
npoints: null,
msg: ,
queuestate: null
}
},
state: {
student_answers: {},
seed: 1,
done: null,
correct_map: {},
input_state: {

i4x-IITB-CS101-problem-33e4aac93dc84f368c93b1d08fa984fc_2_1: {}
}
},
answers: {
i4x-IITB-CS101-problem-33e4aac93dc84f368c93b1d08fa984fc_2_1:
choice_0
},
attempts: 1,
max_grade: 1,
problem_id:
i4x://IITB/CS101/problem/33e4aac93dc84f368c93b1d08fa984fc
},
agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:29.0) Gecko/20100101
Firefox/29.0,
page: x_module
}


{
username: tushars,
host: localhost,
event_source: server,
event_type:
/courses/IITB/CS101/2014_T1/instructor_dashboard/api/list_instructor_tasks,
context: {
course_id: IITB/CS101/2014_T1,
course_user_tags: {},
user_id: 6,
org_id: IITB
},
time: 2014-06-20T05:49:26.780244+00:00,
ip: 127.0.0.1,
event: {\POST\: {}, \GET\: {}},
agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:29.0) Gecko/20100101
Firefox/29.0,
page: null
}



-- 


*Thank youPraveen Pal*
__
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] Reading in a csv - 2 different results

2014-06-20 Thread svendeswan
Hi,
I am a beginner in R and already read and (thought that I) understood the R
introduction tutorial. However there is this reading .csv which I cant
solve. The question is: Why has data in the both cases a different content?

I have a directory containing one .csv file. 

Version 1:
data - read.csv(dir+filename)

Version 2:
temp - paste(c(dir/), list.files(dir), sep = “)
data - sapply(temp, read.csv)

Thanks for the replies and sorry if this question has been posted already
and I didn't see it,
Sven 

p.s.: I am asking this because Version 2 gives me the possibility to read a
whole directory with .csv files into one list




--
View this message in context: 
http://r.789695.n4.nabble.com/Reading-in-a-csv-2-different-results-tp4692434.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] Reading in a csv - 2 different results

2014-06-20 Thread PIKAL Petr
Hi

Version one reads one file directly into data.frame named data, output of 
version 2 is list named data with data.frame(s) nemed 1, 

Is this a difference? Or you see also a difference in contents of those 2 
data.frames?

Regards
Petr


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of svendeswan
 Sent: Friday, June 20, 2014 12:43 PM
 To: r-help@r-project.org
 Subject: [R] Reading in a csv - 2 different results

 Hi,
 I am a beginner in R and already read and (thought that I) understood
 the R introduction tutorial. However there is this reading .csv which I
 cant solve. The question is: Why has data in the both cases a different
 content?

 I have a directory containing one .csv file.

 Version 1:
 data - read.csv(dir+filename)

 Version 2:
 temp - paste(c(dir/), list.files(dir), sep = “) data -
 sapply(temp, read.csv)

 Thanks for the replies and sorry if this question has been posted
 already and I didn't see it, Sven

 p.s.: I am asking this because Version 2 gives me the possibility to
 read a whole directory with .csv files into one list




 --
 View this message in context: http://r.789695.n4.nabble.com/Reading-in-
 a-csv-2-different-results-tp4692434.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.


Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny 
pouze jeho adresátům.
Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně 
jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze 
svého systému.
Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email 
jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či 
zpožděním přenosu e-mailu.

V případě, že je tento e-mail součástí obchodního jednání:
- vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a 
to z jakéhokoliv důvodu i bez uvedení důvodu.
- a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; 
Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce 
s dodatkem či odchylkou.
- trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným 
dosažením shody na všech jejích náležitostech.
- odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost 
žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně 
pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně 
osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi 
či osobě jím zastoupené známá.

This e-mail and any documents attached to it may be confidential and are 
intended only for its intended recipients.
If you received this e-mail by mistake, please immediately inform its sender. 
Delete the contents of this e-mail with all attachments and its copies from 
your system.
If you are not the intended recipient of this e-mail, you are not authorized to 
use, disseminate, copy or disclose this e-mail in any manner.
The sender of this e-mail shall not be liable for any possible damage caused by 
modifications of the e-mail or by delay with transfer of the email.

In case that this e-mail forms part of business dealings:
- the sender reserves the right to end negotiations about entering into a 
contract in any time, for any reason, and without stating any reasoning.
- if the e-mail contains an offer, the recipient is entitled to immediately 
accept such offer; The sender of this e-mail (offer) excludes any acceptance of 
the offer on the part of the recipient containing any amendment or variation.
- the sender insists on that the respective contract is concluded only upon an 
express mutual agreement on all its aspects.
- the sender of this e-mail informs that he/she is not authorized to enter into 
any contracts on behalf of the company except for cases in which he/she is 
expressly authorized to do so in writing, and such authorization or power of 
attorney is submitted to the recipient or the person represented by the 
recipient, or the existence of such authorization is known to the recipient of 
the person represented by the recipient.
__
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] How to process a log file in R ?

2014-06-20 Thread Jeff Newmiller
You have not said what your problem is, and you have not shown us the code you 
have tried. How are we supposed to know what you want?
---
Jeff NewmillerThe .   .  Go Live...
DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

On June 20, 2014 12:26:03 AM PDT, praveen pal pal.pravee...@gmail.com wrote:
Hello

   i am new to R and need help,
   I want to parse a log file using R named tracking.log file.
 i try to read it using jsonlite package but not able to get data  in
proper format.


   i entered a sample of file below.
   i also attached a file tracking.log file with this mail


 {
username: lavita,
host: 10.105.22.32,
event_source: server,
event_type:
/courses/IITB/CS101/2014_T1/xblock/i4x:;_;_IITB;_CS101;_video;_d333fa637a074b41996dc2fd5e675818/handler/xmodule_handler/save_user_state,
context: {
course_id: IITB/CS101/2014_T1,
course_user_tags: {},
user_id: 42,
org_id: IITB
},
time: 2014-06-20T05:49:10.468638+00:00,
ip: 127.0.0.1,
event: {\POST\: {\saved_video_position\: [\00:02:10\]},
\GET\: {}},
agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:18.0) Gecko/20100101
Firefox/18.0,
page: null
}

{
username: raeha,
host: 10.105.22.32,
event_source: server,
event_type: problem_check,
context: {
course_id: IITB/CS101/2014_T1,
course_user_tags: {},
user_id: 40,
org_id: IITB,
module: {
display_name: 
}
},
time: 2014-06-20T06:43:52.716455+00:00,
ip: 127.0.0.1,
event: {
submission: {
   i4x-IITB-CS101-problem-33e4aac93dc84f368c93b1d08fa984fc_2_1: {
input_type: choicegroup,
question: ,
response_type: multiplechoiceresponse,
answer: MenuInflater.inflate(),
variant: ,
correct: true
}
},
success: correct,
grade: 1,
correct_map: {
   i4x-IITB-CS101-problem-33e4aac93dc84f368c93b1d08fa984fc_2_1: {
hint: ,
hintmode: null,
correctness: correct,
npoints: null,
msg: ,
queuestate: null
}
},
state: {
student_answers: {},
seed: 1,
done: null,
correct_map: {},
input_state: {

i4x-IITB-CS101-problem-33e4aac93dc84f368c93b1d08fa984fc_2_1: {}
}
},
answers: {
 i4x-IITB-CS101-problem-33e4aac93dc84f368c93b1d08fa984fc_2_1:
choice_0
},
attempts: 1,
max_grade: 1,
problem_id:
i4x://IITB/CS101/problem/33e4aac93dc84f368c93b1d08fa984fc
},
agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:29.0) Gecko/20100101
Firefox/29.0,
page: x_module
}


{
username: tushars,
host: localhost,
event_source: server,
event_type:
/courses/IITB/CS101/2014_T1/instructor_dashboard/api/list_instructor_tasks,
context: {
course_id: IITB/CS101/2014_T1,
course_user_tags: {},
user_id: 6,
org_id: IITB
},
time: 2014-06-20T05:49:26.780244+00:00,
ip: 127.0.0.1,
event: {\POST\: {}, \GET\: {}},
agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:29.0) Gecko/20100101
Firefox/29.0,
page: null
}

__
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] random forest application

2014-06-20 Thread Li, Yan
Hi All,

Is anyone using random forest for predicting? Some people claimed that it will 
give more accurate result than decision tree. But considering it builds 500(by 
default) full trees, is it worth to use random forest to predict instead of 
decision tree? What typical applications of this algorithm?

Thank you!

Regards,
Yan

[[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] Delaunay Graph, once again

2014-06-20 Thread Raphael Päbst
Hello again,
After playing around with my current problem for some time, I have
once again returned to Delaunay Graphs and after banging my head
against the problem for some time I fear that I can't see the issue
clearly anymore and want to ask for some outside comments, to maybe
shake my thoughts loose again.

So, let me explain my project and then my problem:
 I have a set of points, given as x- and y-coordinates and want to
create the adjacency matrix of the corresponding Delaunay Graph. I
have already removed duplicates in my set of points and to calculate
the matrix, I have hit upon the following procedure, which might not
be the most efficient, but I'm aiming for correct results and
simplicty first, before I can think about efficiency.

# x a vector of length n, containing the x-coordinates of my n points
#y: the same for the y-coordinates
library(deldir)
del - deldir(x, y) # calculating the tesselation
dels - del$delsgs[,5:6] # giving me a data.frame with 2 columns,
containing the indices of points connected by an edge in the Delaunay
Graph

adj - matrix(0, length(x), length(y)) # creating the empty adjacency matrix

for (i in 1:nrow(dels)){ # going through the rows of dels
adj[dels[i,1], dels[i,2]] - 1; # since the points in a row of dels
are connected, the matrix at that point is set to 1
adj[dels[i,2], dels[i,1]] - 1; # and this makes it symmetric
}

Now as I see it this should give me the adjacency matrix, right?

So let's come to my problem: The program I'm writing is a translation
of some Matlab-Code and so the results of both versions should be the
same, if at all possible. My adjacency matrix created in the above
mentioned manner however is not the same as the one created with
Matlab. The Matlab-Version uses algorithms based on Qhull, while I use
deldir as a library, could this account for the difference or have I
fundamentally misunderstood some part of the whole plan?

I hope the information is helpful and would very much appreciate any
pointers and thoughts on the matter.

Many thanks and all the best!

Raphael

__
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] random forest application

2014-06-20 Thread Sarah Goslee
Hi,

This is not an R question, so really not appropriate for the list.

The answer depends on what worth it means to you.

There are many applications:
http://scholar.google.com/scholar?hl=enq=%22random+forest%22btnG=as_sdt=1%2C39as_sdtp=

Sarah

On Fri, Jun 20, 2014 at 10:12 AM, Li, Yan yan...@ibi.com wrote:
 Hi All,

 Is anyone using random forest for predicting? Some people claimed that it 
 will give more accurate result than decision tree. But considering it builds 
 500(by default) full trees, is it worth to use random forest to predict 
 instead of decision tree? What typical applications of this algorithm?

 Thank you!

 Regards,
 Yan
-- 
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] random forest application

2014-06-20 Thread Li, Yan
Thanks for the reply...Actually you answered my questionI just want to know 
how people use it...

-Original Message-
From: Sarah Goslee [mailto:sarah.gos...@gmail.com] 
Sent: Friday, June 20, 2014 11:31 AM
To: Li, Yan
Cc: r-help@r-project.org
Subject: Re: [R] random forest application

Hi,

This is not an R question, so really not appropriate for the list.

The answer depends on what worth it means to you.

There are many applications:
http://scholar.google.com/scholar?hl=enq=%22random+forest%22btnG=as_sdt=1%2C39as_sdtp=

Sarah

On Fri, Jun 20, 2014 at 10:12 AM, Li, Yan yan...@ibi.com wrote:
 Hi All,

 Is anyone using random forest for predicting? Some people claimed that it 
 will give more accurate result than decision tree. But considering it builds 
 500(by default) full trees, is it worth to use random forest to predict 
 instead of decision tree? What typical applications of this algorithm?

 Thank you!

 Regards,
 Yan
-- 
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] Rstudio: is it possible to create a document out of a working script?

2014-06-20 Thread Henrik Bengtsson
On Fri, Jun 20, 2014 at 2:40 AM, Luca Cerone luca.cer...@gmail.com wrote:
 Hi Berend, sorry if it OT (though I think that the process is pretty
 much Rstudio independent, since what Rstudio does is wrap up knitr and
 their package Rmarkdown,
 but all the process can be run from the shell).

 Bob, so far this is what I do, but it is not ideal for two reasons:
 1. I would like my report to be a step by step guide of what the
 script does. Wrapping the scripts in small functions, subscripts
 doesn´t help,
 because in the report what you would see is source(subscript.r),
 not the content of the subscript.

 2. in a way I would need the exact opposite of what knitr and
 Rmarkdown do (at least by default). I would like to document my script
 in a way that can be run independently of the report and that, when
 neede, could use the comments to generate the report, similarly to how
 roxygen2 works when writing the documentation.

http://rmarkdown.rstudio.com/r_notebook_format.html

/Henrik


 Thanks a lot for the help,
 apologies again if this is OT (if so please remove the thread and I
 will ask in the the Rstudio support).

 Cheers,
 Luca

 2014-06-20 11:28 GMT+02:00 Bob O'Hara rni@gmail.com:
 How about simply using source() to call the script? If necessary, wrap bits
 of the script in functions, so you source a file with lots of functions, and
 then call the ones you need, as you need them.

 Bob

 On 20 June 2014 11:20, Luca Cerone luca.cer...@gmail.com wrote:

 Dear all,
 I am very happy with the new features introduced by Rstudio about how
 to create documents embedding R code.

 I would like to know though if there is some way to embed code from a
 working script into an Rmd document.
 I have several working scripts for which I would like to report the
 results, but I would like to avoid
 copy and paste the code in the Rmd document: the pipeline is still a
 work in progress,
 and it is likely that I will end up changing the code and parameters
 in the script.

 As you can imagine, having to copy and paste my code is prone error,
 and leads to a lot of code replication.
 I would like to avoid this, but couldn´t find a straightforward way so
 far.


 Thanks a lot in advance,
 of course if you have other advices, or comments on best practices for
 this sort of thing,
 I would like to hear them from you.

 Cheers,
 Luca

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




 --
 Bob O'Hara

 Biodiversity and Climate Research Centre
 Senckenberganlage 25
 D-60325 Frankfurt am Main,
 Germany

 Tel: +49 69 798 40226
 Mobile: +49 1515 888 5440
 WWW:   http://www.bik-f.de/root/index.php?page_id=219
 Blog: http://occamstypewriter.org/boboh/
 Journal of Negative Results - EEB: www.jnr-eeb.org



 --
 Luca Cerone

 Tel: +34 692 06 71 28
 Skype: luca.cerone

 __
 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] Principal component analysis with EQUAMAX rotation

2014-06-20 Thread William Revelle
Dear Wagner,
  I added the equamax rotation option to the psych package in version 1.4.6.  
This was requested by Sagnik Chakravarty, with a solution by Gunter Nickel.

Unfortunately, the version on CRAN  is 1.4.5, but you can get 1.4.6 from the 
alternate repository  http://personality-project.org/r/  (if using a Mac) or  
http://personality-project.org/r/src/contrib/   if using a PC.

Thus,

p3 - principal(Thurstone,3,rotate=equamax”)  #will extract the first three 
components and rotate them using equamax.


Let me know if this does what you want.

Bill


On Jun 19, 2014, at 2:07 AM, Wagner wagner@gmx.de wrote:

 Hello,
 I need to do a principal component analysis with EQUAMAX-rotation.
 Unfortunately the function principal() I use normally for PCA does not offer
 this rotation specification. I could find out that this might be possible
 somehow with the package GPArotation but until now I could not figure out
 how to use this in the principal component analysis.
 Maybe someone can give an example on how to do an equamax-rotation PCA?
 Or is there a function in another package that offers the use of
 equamax-rotation directly?
 Thank you for your help!
 
 
 
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Principal-component-analysis-with-EQUAMAX-rotation-tp4692337.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.
 

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


[R] Loops to produce plots and leyend

2014-06-20 Thread Bea GD
I've tried several things but I don't manage to get this plot right. Any 
help greatly appreciated!
I'm running a for loop to produce 4 plots at once. Each plot should only 
show data points for a specific group (i.e. 4 plots for groups 1 to 4). 
The coordinates of the points should be petal length and width. The 
colour of these points should codify the species variable. Finally I'd 
like to show a legend for the colours on these plots. It's important 
that each species has a unique colour. Thanks you a lot for your input!


# Data
dd - iris

dd$group - ifelse(dd$Sepal.Length=4.3  dd$Sepal.Length5.2, 1,
 ifelse(dd$Sepal.Length=5.2  
dd$Sepal.Length6.1, 2,
ifelse(dd$Sepal.Length=6.1  
dd$Sepal.Length7, 3,

   ifelse(dd$Sepal.Length=7, 4, NA
dd$group - as.integer(dd$group)

dd$Species - c(rep(Wild, 12), rep(Pinky, 12), rep(Orangy, 
12), rep(Smelly, 12),
rep(Pretty, 12), rep(Blue, 12), rep(Big, 12), 
rep(Rare, 12),
rep(Toxic, 12), rep(Danger, 12), 
rep(Abundant, 18), rep(Last, 12))



# Code to plot 4 graphs. It doesn't work!
pdf(plot_test.pdf, width=10, height=10)
par(mfrow=c(2, 2))
for(b in unique(dd$group)){
  idx - dd$group==b
  plot(dd$Petal.Length, dd$Petal.Width, ty=n, 
xlim=range(dd$Petal.Length), ylim=range(dd$Petal.Width))

  cols - as.numeric(unique(dd$Species))
  points(dd$Petal.Length[idx], dd$Petal.Width[idx],
 col=cols[as.numeric(dd$Species[idx])])
  legend(right, legend=unique(dd$Species[idx]), pch=1, 
col=cols[as.numeric(unique(dd$Species[idx]))])

}
dev.off()

__
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] Principal component analysis with EQUAMAX rotation

2014-06-20 Thread William Revelle
Dear Wagner,
  I added the equamax rotation option to the psych package in version 1.4.6.  
This was requested by Sagnik Chakravarty, with a solution by Gunter Nickel.

Unfortunately, the version on CRAN  is 1.4.5, but you can get the working 
prerelease of 1.4.6 (1.4.6.20)  from the alternate repository  
http://personality-project.org/r/  (if using a Mac) or  
http://personality-project.org/r/src/contrib/   if using a PC.

Thus,

 p3e - principal(Thurstone,3,rotate=equamax)  #will extract the first three 
components and rotate them using equamax.
 p3n - principal(Thurstone,3,rotate=none)   #will give you the unrotated 3 
component solution
 p3v - principal(Thurstone,3,rotate=varimax) #for the varimax solution
 
 factor.congruence(list(p3e,p3n,p3v))  #compares the Burt/Tucker congruence 
coefficients for these three solutions


Let me know if this does what you want.

Bill


On Jun 19, 2014, at 2:07 AM, Wagner wagner@gmx.de wrote:

 Hello,
 I need to do a principal component analysis with EQUAMAX-rotation.
 Unfortunately the function principal() I use normally for PCA does not offer
 this rotation specification. I could find out that this might be possible
 somehow with the package GPArotation but until now I could not figure out
 how to use this in the principal component analysis.
 Maybe someone can give an example on how to do an equamax-rotation PCA?
 Or is there a function in another package that offers the use of
 equamax-rotation directly?
 Thank you for your help!
 
 
 
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Principal-component-analysis-with-EQUAMAX-rotation-tp4692337.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.
 

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 5 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] R is converting arg input to scientific notation, which is bad!

2014-06-20 Thread peter dalgaard

On 20 Jun 2014, at 04:30 , David Winsemius dwinsem...@comcast.net wrote:

 I think it's your `digits = 0` argument:
 
 formatC(20, digits = 3, width = 3, flag = 0)
 [1] 020

At any rate, sprintf() is often more convenient:

 sprintf(%03d.csv, c(30, 104, 223))
[1] 030.csv 104.csv 223.csv


-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.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] mgcv: BAM convergence conflicting messages

2014-06-20 Thread Trevor Davies
Hi Simon,

Thanks for getting back to me.  Would the opposite be true as well then? I
have other models where I don't get a warning message at the end of the
model fitting but the $converged slow indicates a 'FALSE'.

Thank you ~Trevor


On Wed, Jun 18, 2014 at 2:07 AM, Simon Wood s.w...@bath.ac.uk wrote:

 I think it didn't converge. The warning message is for the whole fitting
 iteration, whereas mod07.3.BASE.bam5.1$converged indicates whether
 smoothing parameter selection converged at the final step of the iteration.

 best,
 Simon


 On 17/06/14 19:10, Trevor Davies wrote:

 I'm running some spatial GAMs and am using the bam call (negbin family)
 and
 am getting conflicting information on whether the model is converging or
 not.  When the model completes its run, I get a warning message that the
 model did not converge.  When I look at the object itself, I'm told that
 it
 did.  See below.

 Warning message:
 In bgam.fit(G, mf, chunk.size, gp, scale, gamma, method = method,  :
algorithm did not converge

  mod07.3.BASE.bam5.1$converged

 [1] TRUE

 Am I missing something?
 Thank you,
 Trevor

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



 --
 Simon Wood, Mathematical Science, University of Bath BA2 7AY UK
 +44 (0)1225 386603   http://people.bath.ac.uk/sw283


[[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] Convert nlme formula to nlmer

2014-06-20 Thread Ben Bolker
Roxane Foulser-Piggott rf371 at cam.ac.uk writes:

  R version 3.1.0 (2014-04-10) -- Spring Dance”. Platform:
 x86_64-apple-darwin13.1.0 (64-bit).  

 I would like to convert the following function from nlme to nlmer.
 I am finding it difficult to apply the documentation I can find on
 this procedure to this problem.  The function predicts earthquake
 ground-shaking (lnIa) as a function of M, Rrup, Ztor, Fevent, Vs30
 and e1.  I am converting to nlmer, as once I have it running, I will
 explore crossed and nested mixed effects.
 
 eq1 - nlme( lnIa ~ c0 + m1*(M-5) + 
  (r1a + r1b*M)*log(sqrt(Rrup^2 + Ztor^2)) + f1*Fevent + v1*log(Vs30/760)  
  + e1,fixed=c0+m1+r1a+r1b+f1+v1~1,random=e1~1|Event,data = data, 
  start = c(c0=11,m1=-0.9,r1a=0.5,r1b=-0.52,f1=0.9,v1=-1.32))
 
You will probably have more luck with this question on the
r-sig-mixed-mod...@r-project.org mailing list.

Unfortunately one of the things you will also find is that although
the basic computational machinery is in place, nlmer is much less
well developed than nlme.  See http://rpubs.com/bbolker/3423 for
an extended example of a nonlinear model that incorporates 
non-trivial fixed effects ...

__
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] Data extraction and assembly from a data frame

2014-06-20 Thread Jun Shen
Hi all,

Here is my situation. I have a dataframe, the structure would be something
like this,

TestData-data.frame(ID=rep(1:10,each=10),TIME=rep(seq(0.1,1,0.1),10),VAR1=rnorm(100),VAR2=5*rnorm(100),VAR3=10*rnorm(100))

Basically, I want to extract the maximum value from each ID for VAR1, VAR2,
VAR3..

The way I can think of is

do.call(rbind,lapply(split(TestData,TestData$ID),function(x)x[which.max(x$VAR1),'VAR1']))

and do this for each of the variables and put the results back. It's kind
of clumsy but OK for several variables. I have dozens of them. Is there a
better way to do it?

It would be ideal to produce the results like

   ID VAR1.max VAR2.max VAR3.max  1 1.2828796 8.63276 15.051992  2 1.1870067
8.691801 10.736301  3 1.2815352 6.335692 5.827524  4 1.6719411 5.998597
16.646212  5 1.5631107 6.067457 15.331046  6 0.718989 6.610279 7.306005  7
0.8734315 13.39844 16.965365  8 2.7447862 10.21613 22.545131  9 3.490395
10.83543 25.744662  10 0.4719087 11.73021 7.226687
Thanks for any help.

Jun Shen

[[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] lattice : superpose symbols with a great many points

2014-06-20 Thread Laurent Rhelp

Hi,

  I like to use with xyplot (package lattice) the groups argument and 
superpose.symbol to compare several curves. But, when there are a great 
many points, the symbols are very close and the graph becomes 
unreadable. Would there be an argument  or a tip not to draw all the 
symbols, for example the symbols could be drawn only every x points, x 
given as an argument ?


Thanks
Best regards
Laurent



---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce 
que la protection avast! Antivirus est active.

__
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] lattice : superpose symbols with a great many points

2014-06-20 Thread Christoph Scherber

Dear Laurent

for numeric x variables, you could try jitter:

xyplot(y~jitter(x,0.5))

Cheers
Christoph


Am 20.06.2014 21:45, schrieb Laurent Rhelp:

Hi,

  I like to use with xyplot (package lattice) the groups argument and 
superpose.symbol to compare several curves. But, when there are a 
great many points, the symbols are very close and the graph becomes 
unreadable. Would there be an argument  or a tip not to draw all the 
symbols, for example the symbols could be drawn only every x points, x 
given as an argument ?


Thanks
Best regards
Laurent



---
Ce courrier électronique ne contient aucun virus ou logiciel 
malveillant parce que la protection avast! Antivirus est active.


__
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] Data extraction and assembly from a data frame

2014-06-20 Thread MacQueen, Don
How about

aggregate(TestData[,c('VAR1','VAR2','VAR3')], by=list(id=TestData$ID),
FUN=max)




-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 6/20/14 12:42 PM, Jun Shen jun.shen...@gmail.com wrote:

Hi all,

Here is my situation. I have a dataframe, the structure would be something
like this,

TestData-data.frame(ID=rep(1:10,each=10),TIME=rep(seq(0.1,1,0.1),10),VAR1
=rnorm(100),VAR2=5*rnorm(100),VAR3=10*rnorm(100))

Basically, I want to extract the maximum value from each ID for VAR1,
VAR2,
VAR3..

The way I can think of is

do.call(rbind,lapply(split(TestData,TestData$ID),function(x)x[which.max(x$
VAR1),'VAR1']))

and do this for each of the variables and put the results back. It's kind
of clumsy but OK for several variables. I have dozens of them. Is there a
better way to do it?

It would be ideal to produce the results like

   ID VAR1.max VAR2.max VAR3.max  1 1.2828796 8.63276 15.051992  2
1.1870067
8.691801 10.736301  3 1.2815352 6.335692 5.827524  4 1.6719411 5.998597
16.646212  5 1.5631107 6.067457 15.331046  6 0.718989 6.610279 7.306005  7
0.8734315 13.39844 16.965365  8 2.7447862 10.21613 22.545131  9 3.490395
10.83543 25.744662  10 0.4719087 11.73021 7.226687
Thanks for any help.

Jun Shen

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


Re: [R] Data extraction and assembly from a data frame

2014-06-20 Thread William Dunlap
Have you looked at the 'aggregate' function?  E.g.,
  aggregate(TestData[c(VAR1,VAR2,VAR3)], by=TestData[ID], max)
Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Fri, Jun 20, 2014 at 12:42 PM, Jun Shen jun.shen...@gmail.com wrote:
 Hi all,

 Here is my situation. I have a dataframe, the structure would be something
 like this,

 TestData-data.frame(ID=rep(1:10,each=10),TIME=rep(seq(0.1,1,0.1),10),VAR1=rnorm(100),VAR2=5*rnorm(100),VAR3=10*rnorm(100))

 Basically, I want to extract the maximum value from each ID for VAR1, VAR2,
 VAR3..

 The way I can think of is

 do.call(rbind,lapply(split(TestData,TestData$ID),function(x)x[which.max(x$VAR1),'VAR1']))

 and do this for each of the variables and put the results back. It's kind
 of clumsy but OK for several variables. I have dozens of them. Is there a
 better way to do it?

 It would be ideal to produce the results like

ID VAR1.max VAR2.max VAR3.max  1 1.2828796 8.63276 15.051992  2 1.1870067
 8.691801 10.736301  3 1.2815352 6.335692 5.827524  4 1.6719411 5.998597
 16.646212  5 1.5631107 6.067457 15.331046  6 0.718989 6.610279 7.306005  7
 0.8734315 13.39844 16.965365  8 2.7447862 10.21613 22.545131  9 3.490395
 10.83543 25.744662  10 0.4719087 11.73021 7.226687
 Thanks for any help.

 Jun Shen

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


Re: [R] Data extraction and assembly from a data frame

2014-06-20 Thread arun
You could try:
library(plyr)
res - ddply(TestData[,-2],.(ID),numcolwise(max)) 
colnames(res)[-1] - paste0(colnames(res)[-1],.max)
A.K.




On Friday, June 20, 2014 3:43 PM, Jun Shen jun.shen...@gmail.com wrote:
Hi all,

Here is my situation. I have a dataframe, the structure would be something
like this,

TestData-data.frame(ID=rep(1:10,each=10),TIME=rep(seq(0.1,1,0.1),10),VAR1=rnorm(100),VAR2=5*rnorm(100),VAR3=10*rnorm(100))

Basically, I want to extract the maximum value from each ID for VAR1, VAR2,
VAR3..

The way I can think of is

do.call(rbind,lapply(split(TestData,TestData$ID),function(x)x[which.max(x$VAR1),'VAR1']))

and do this for each of the variables and put the results back. It's kind
of clumsy but OK for several variables. I have dozens of them. Is there a
better way to do it?

It would be ideal to produce the results like

   ID VAR1.max VAR2.max VAR3.max  1 1.2828796 8.63276 15.051992  2 1.1870067
8.691801 10.736301  3 1.2815352 6.335692 5.827524  4 1.6719411 5.998597
16.646212  5 1.5631107 6.067457 15.331046  6 0.718989 6.610279 7.306005  7
0.8734315 13.39844 16.965365  8 2.7447862 10.21613 22.545131  9 3.490395
10.83543 25.744662  10 0.4719087 11.73021 7.226687
Thanks for any help.

Jun Shen

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


Re: [R] Data extraction and assembly from a data frame

2014-06-20 Thread Jun Shen
Hi Don, Bill and A.K.
Thanks for your reply. It worked!


On Fri, Jun 20, 2014 at 3:56 PM, arun smartpink...@yahoo.com wrote:

 You could try:
 library(plyr)
 res - ddply(TestData[,-2],.(ID),numcolwise(max))
 colnames(res)[-1] - paste0(colnames(res)[-1],.max)
 A.K.




 On Friday, June 20, 2014 3:43 PM, Jun Shen jun.shen...@gmail.com wrote:
 Hi all,

 Here is my situation. I have a dataframe, the structure would be something
 like this,


 TestData-data.frame(ID=rep(1:10,each=10),TIME=rep(seq(0.1,1,0.1),10),VAR1=rnorm(100),VAR2=5*rnorm(100),VAR3=10*rnorm(100))

 Basically, I want to extract the maximum value from each ID for VAR1, VAR2,
 VAR3..

 The way I can think of is


 do.call(rbind,lapply(split(TestData,TestData$ID),function(x)x[which.max(x$VAR1),'VAR1']))

 and do this for each of the variables and put the results back. It's kind
 of clumsy but OK for several variables. I have dozens of them. Is there a
 better way to do it?

 It would be ideal to produce the results like

ID VAR1.max VAR2.max VAR3.max  1 1.2828796 8.63276 15.051992  2
 1.1870067
 8.691801 10.736301  3 1.2815352 6.335692 5.827524  4 1.6719411 5.998597
 16.646212  5 1.5631107 6.067457 15.331046  6 0.718989 6.610279 7.306005  7
 0.8734315 13.39844 16.965365  8 2.7447862 10.21613 22.545131  9 3.490395
 10.83543 25.744662  10 0.4719087 11.73021 7.226687
 Thanks for any help.

 Jun Shen

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



[[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] empty density plot for point pattern in spatstat

2014-06-20 Thread Christopher W Ryan
I'm back in the office with the machine that was giving me trouble.

# fresh start-up of R 3.1.0, installed on the my machine's hard drive,
#under Windows XP Service Pack 3.
# spatstat version 1.37-0

library(spatstat)
data(redwood)
dens - density(redwood)
str(dens) # everything looks to be in order
plot(dens)  # empty plot with empty ribbon on right side
dev.cur() # yields  null device
  #1
  # I think I closed the plot window
  # before issuing this command

plot(dens, col=grey(seq(0,1,length=32)))
# yields an empty density plot with empty ribbon

plot(dens, useRaster=FALSE)
# yields a proper density plot in blue/green/yellow,
# with an empty ribbon

plot(dens, useRaster=FALSE, ribargs=list(useRaster=TRUE))
# yields a proper density plot in blue/green/yellow,
# with an empty ribbon

dev.cur()
# yields windows
#   2 

example(plot.im)
# yields a series of 8 plot.
#All but one of them is empty--both plot area and ribbon
# the second one has a color ramp in the ribbon
# along the bottom, but again no plot

with(bei.extra,plot(elev))
# yields an empty plot with empty ribbon

with(bei.extra,plot(elev, useRaster=FALSE))
with(bei.extra,plot(elev, useRaster=FALSE,  ribargs=list(useRaster=TRUE)))
# these both yield the same result:
# a colored density plot with an empty ribbon

Thanks

--Chris Ryan

On Thu, Jun 19, 2014 at 8:31 PM, Adrian Baddeley
adrian.badde...@uwa.edu.au wrote:
 Dear Pablo,

 Yes, effectively utilizando useRaster = FALSE, the plot is printed.

 Muy bien!

 Only the ribbon appears without color.

 Try setting ribargs=list(useRaster=TRUE).

 I'm using R version 3.0.2, Windows 7 system, and spatstat 1.33-0 package 
 version.

 Things may improve if you upgrade to the current versions, R 3.1.0 and 
 spatstat 1.37-0.

 A

 Prof Adrian Baddeley FAA
 University of Western Australia

__
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] zuzufarah Help with ggplot 2 error: Aesthetics must either be length one, or the same length as the dataProblems

2014-06-20 Thread Zayd Farah
WUA_table-WUA.df[,2:dim(WUA.df)[2]]
WUA_discharge-WUA.df[,1]
colour_scheme-palette(rainbow(dim(WUA_table)[2]))

# Main scatterplot
p1 - ggplot(NULL, aes(WUA_discharge,WUA_table)) +
  geom_line() +
  scale_color_manual(values=colour_scheme)+
  scale_x_continuous(expand = c(0, 0)) +
  scale_y_continuous(expand = c(0, 0)) +
  expand_limits(y = c(min(WUA_table) - .1*diff(range(WUA_table)),
  max(WUA_table) + .1*diff(range(WUA_table  +
  expand_limits(x = c(min(WUA_discharge) - .1*diff(range(WUA_discharge)),
  max(WUA_discharge) + .1*diff(range(WUA_discharge
 +
  theme(plot.margin= unit(c(0, 0, 0.5, 0.5), lines))

# Get the gtables
gt1 - ggplot_gtable(ggplot_build(p1))


the error message from the following code states:
Error: Aesthetics must either be length one, or the same length as the
dataProblems:WUA_table

the error appears after the line:
gt1 - ggplot_gtable(ggplot_build(p1))

I would appreciate some help on the matter, it seems like a small fix,
however I am very inexperienced with R!

[[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] Reading in a csv - 2 different results

2014-06-20 Thread svendeswan
Aww thank u !

I had a knot in my brain... thank you for solving it :)

Cheers,
Sven



--
View this message in context: 
http://r.789695.n4.nabble.com/Reading-in-a-csv-2-different-results-tp4692434p4692448.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] R is converting arg input to scientific notation, which is bad!

2014-06-20 Thread efridge
The digits argument for formatC is for sigfigs. I found a solution within the
formatC argument list. When I added the format arg to formatC:

filenames - paste0(formatC(id, digits = 0, width = 3, format = d, flag =
0), .csv)

..it miraculously worked. d is the format value for integers. Hope someone
else can learn from this!



--
View this message in context: 
http://r.789695.n4.nabble.com/R-is-converting-arg-input-to-scientific-notation-which-is-bad-tp4692389p4692459.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] Is there anyone who is familiar with PtProcess package?

2014-06-20 Thread Ferra Xu
Hi all,

I am trying to use template function for spatial ETAS (not the simulation code, 
but the loglikelihood estimation) with some changes (in 3-D space and with 
different omori function). I changed the etas_normal0 function and the main 
code accordingly but still it doesn't give me the correct result. I'd like to 
know if there is anyone or any forum for PtProcess that can help me with 
finding the mistake in my code?

I really appreciate your help and time in advance,
Fera
[[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] empty density plot for point pattern in spatstat

2014-06-20 Thread Pablo Ramón
Hi Chris,

Try the form: plot(dens, useRaster=FALSE, ribargs=list(useRaster=FALSE))



Pablo


2014-06-20 15:58 GMT-05:00 Christopher W Ryan cr...@binghamton.edu:

 I'm back in the office with the machine that was giving me trouble.

 # fresh start-up of R 3.1.0, installed on the my machine's hard drive,
 #under Windows XP Service Pack 3.
 # spatstat version 1.37-0

 library(spatstat)
 data(redwood)
 dens - density(redwood)
 str(dens) # everything looks to be in order
 plot(dens)  # empty plot with empty ribbon on right side
 dev.cur() # yields  null device
   #1
   # I think I closed the plot window
   # before issuing this command

 plot(dens, col=grey(seq(0,1,length=32)))
 # yields an empty density plot with empty ribbon

 plot(dens, useRaster=FALSE)
 # yields a proper density plot in blue/green/yellow,
 # with an empty ribbon

 plot(dens, useRaster=FALSE, ribargs=list(useRaster=TRUE))
 # yields a proper density plot in blue/green/yellow,
 # with an empty ribbon

 dev.cur()
 # yields windows
 #   2 

 example(plot.im)
 # yields a series of 8 plot.
 #All but one of them is empty--both plot area and ribbon
 # the second one has a color ramp in the ribbon
 # along the bottom, but again no plot

 with(bei.extra,plot(elev))
 # yields an empty plot with empty ribbon

 with(bei.extra,plot(elev, useRaster=FALSE))
 with(bei.extra,plot(elev, useRaster=FALSE,  ribargs=list(useRaster=TRUE)))
 # these both yield the same result:
 # a colored density plot with an empty ribbon

 Thanks

 --Chris Ryan

 On Thu, Jun 19, 2014 at 8:31 PM, Adrian Baddeley
 adrian.badde...@uwa.edu.au wrote:
  Dear Pablo,
 
  Yes, effectively utilizando useRaster = FALSE, the plot is printed.
 
  Muy bien!
 
  Only the ribbon appears without color.
 
  Try setting ribargs=list(useRaster=TRUE).
 
  I'm using R version 3.0.2, Windows 7 system, and spatstat 1.33-0
 package version.
 
  Things may improve if you upgrade to the current versions, R 3.1.0 and
 spatstat 1.37-0.
 
  A
 
  Prof Adrian Baddeley FAA
  University of Western Australia




-- 
Mat. Pablo Ramón
Sección de Ecología
Departamento de Ciencias Naturales
Universidad Técnica Particular de Loja (http://www.utpl.edu.ec/)
Telf. 593 7 2570275 Ext. 2505, 2258

[[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] Delaunay Graph, once again

2014-06-20 Thread Rolf Turner


You are almost surely being bitten by the issue about which you 
previously made inquiries to me, concerning the delaunayn() function 
from the geometry package.  (NOTE: ***PACKAGE***!!!  Not library.  A 
library is a *collection* of packages.) The delaunayn()
function also uses the qhull algorithm.  By default it treats some 
triples of *collinear* points as triangles.  This is probably causing 
the discrepancy between the results.


Ergo it would seem best to use deldir() unless you *really want* 
collinear triples to be considered as triangles --- and I can't see why 
you would.


Your code for calculating the adjacency list is correct. (Except for the 
fact that you put in unnecessary semi-colons --- this is R, not C --- 
and for the fact that a comment runs over into the next line, causing an 
error to be thrown when one tries to copy and paste your code.)


Try a toy example:

require(deldir)
set.seed(42)
x - runif(6)
y - runif(6)
dxy - deldir(x,y)
ind - dxy$dirsgs[,5:6]
adj - matrix(0, length(x), length(y))
for (i in 1:nrow(ind)){
   adj[ind[i,1], ind[i,2]] - 1
   adj[ind[i,2], ind[i,1]] - 1
}
adj
 [,1] [,2] [,3] [,4] [,5] [,6]
[1,]010101
[2,]101110
[3,]010011
[4,]110011
[5,]011101
[6,]101110
ind
   ind1 ind2
1 21
2 32
3 41
4 42
5 52
6 53
7 54
8 61
9 63
1064
1165

This looks right.

I'm not a Matlab user so I can't check what Matlab would give, but I'm 
pretty sure the results would be the same in this toy example where 
there are no collinear triples.


cheers,

Rolf Turner

On 21/06/14 03:17, Raphael Päbst wrote:

Hello again,
After playing around with my current problem for some time, I have
once again returned to Delaunay Graphs and after banging my head
against the problem for some time I fear that I can't see the issue
clearly anymore and want to ask for some outside comments, to maybe
shake my thoughts loose again.

So, let me explain my project and then my problem:
  I have a set of points, given as x- and y-coordinates and want to
create the adjacency matrix of the corresponding Delaunay Graph. I
have already removed duplicates in my set of points and to calculate
the matrix, I have hit upon the following procedure, which might not
be the most efficient, but I'm aiming for correct results and
simplicty first, before I can think about efficiency.

# x a vector of length n, containing the x-coordinates of my n points
#y: the same for the y-coordinates
library(deldir)
del - deldir(x, y) # calculating the tesselation
dels - del$delsgs[,5:6] # giving me a data.frame with 2 columns,
containing the indices of points connected by an edge in the Delaunay
Graph

adj - matrix(0, length(x), length(y)) # creating the empty adjacency matrix

for (i in 1:nrow(dels)){ # going through the rows of dels
adj[dels[i,1], dels[i,2]] - 1; # since the points in a row of dels
are connected, the matrix at that point is set to 1
adj[dels[i,2], dels[i,1]] - 1; # and this makes it symmetric
}

Now as I see it this should give me the adjacency matrix, right?

So let's come to my problem: The program I'm writing is a translation
of some Matlab-Code and so the results of both versions should be the
same, if at all possible. My adjacency matrix created in the above
mentioned manner however is not the same as the one created with
Matlab. The Matlab-Version uses algorithms based on Qhull, while I use
deldir as a library, could this account for the difference or have I
fundamentally misunderstood some part of the whole plan?

I hope the information is helpful and would very much appreciate any
pointers and thoughts on the matter.


__
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] Loops to produce plots and leyend

2014-06-20 Thread David Winsemius

On Jun 20, 2014, at 9:18 AM, Bea GD wrote:

 I've tried several things but I don't manage to get this plot right. Any help 
 greatly appreciated!
 I'm running a for loop to produce 4 plots at once. Each plot should only show 
 data points for a specific group (i.e. 4 plots for groups 1 to 4). The 
 coordinates of the points should be petal length and width. The colour of 
 these points should codify the species variable. Finally I'd like to show a 
 legend for the colours on these plots. It's important that each species has a 
 unique colour. Thanks you a lot for your input!
 
# Data
dd - iris
 
dd$group - ifelse(dd$Sepal.Length=4.3  dd$Sepal.Length5.2, 1,
 ifelse(dd$Sepal.Length=5.2  dd$Sepal.Length6.1, 2,
ifelse(dd$Sepal.Length=6.1  
 dd$Sepal.Length7, 3,
   ifelse(dd$Sepal.Length=7, 4, NA
dd$group - as.integer(dd$group)
 
dd$Species - c(rep(Wild, 12), rep(Pinky, 12), rep(Orangy, 12), 
 rep(Smelly, 12),
rep(Pretty, 12), rep(Blue, 12), rep(Big, 12), 
 rep(Rare, 12),
rep(Toxic, 12), rep(Danger, 12), rep(Abundant, 18), 
 rep(Last, 12))
 
 
# Code to plot 4 graphs. It doesn't work!
pdf(plot_test.pdf, width=10, height=10)
par(mfrow=c(2, 2))
for(b in unique(dd$group)){
  idx - dd$group==b
  plot(dd$Petal.Length, dd$Petal.Width, ty=n, 
 xlim=range(dd$Petal.Length), ylim=range(dd$Petal.Width))
  cols - as.numeric(unique(dd$Species))
  points(dd$Petal.Length[idx], dd$Petal.Width[idx],
 col=cols[as.numeric(dd$Species[idx])])
  legend(right, legend=unique(dd$Species[idx]), pch=1, 
 col=cols[as.numeric(unique(dd$Species[idx]))])
}
dev.off()

This appears to be a duplicate of 
http://stackoverflow.com/questions/24333076/for-loop-to-produce-plots-with-legend
 and is already answered. You are requesten not to corss-post to SO and Rhelp.

 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html


-- 
David Winsemius
Alameda, CA, USA

__
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] How to define a nonlin.function object for the spherical function to be used in the gnm model?

2014-06-20 Thread Zhiqiu Hu
Hi,


I encountered with some difficulty in preparing the nonlin.function for the
gnm function. Please help me.


 I want to use the gnm function in the gnm package to fit the following
spherical function


y =  a + b (1.5*x - 0.5 *(x/c)) if  x c

y =  a + bif  x = c


I understand that the fit.variogram function in the gstat function was
designed for fitting variogram, but it seems to be questionable because of
the normality assumption on the residuals. It is interested that whether
the fitted model would be changed as another distribution was assumed.


Seems to me, the gnm function in the gnm/R package could be used for the
this. However, I failed to customize a proper nonlin object for the
aforementioned formula after a few hours of try.

The following are my crappy code defining the nonlin object.

-

myfun-function(x) {

  list( predictors = list(nuggest = .1, psill = 1, range=5),variables =
list(substitute(x)),

term - function(predLabels, varLabels) {

  paste0(pred=, predLabels[1], +, predLabels[2], *(1.0 - exp(-,
varLabels[1], /, predLabels[3], ))

#   paste0(pred[which(, varLabels[1], , predLabels[3], )]=,
predLabels[3], +, predLabels[2])

#   paste0(pred)

}

  )

}

class(myfun) - nonlin

-

In addition, I have also tried the gnls function in the nlme package but
did not find any parameters in function would allow to specify a
distribution for the residuals.


I appreciate any help, suggestion, comment on my question.Thank you very
much.


Best regards,


Zhiqiu



The following code are largely irrelevant to my question, but it could be
used to generate a semivarogram table for the analysis.

#The Sph model in SP analysis

sph.fun-function(dist, nugget, psill, range) {

  res-nugget+psill*(1.5*dist/range-.5*(dist/range)^3)

  id.far=which(dist=range)

  if (NROW(id.far)0)  res[id.far]= sum(nugget, psill)

  res

}



#simulate semivariogram data

library(gstat)

dist=1:100

dat=data.frame(np=300.0, dist=(dist)+0.001,

   gamma=sph.fun(dist, nugget = 1, psill = 9, range =
20)+rnorm(NROW(dist))*1e-3,

   dir.hor=0.0, dir.ver=0.0,  id=as.factor(1))

v=dat;

class(v)-gstatVariogram



#By defalut, WLS is used and the weight is  w=np/dist^2

ft1=fit.variogram(v, vgm(nugget = 1, mod=Sph, psill = 1, range = 5))



#use the nls to fit the data

ft2=nls(gamma ~ sph.fun(dist, nugget, psill, range),

data = dat,

start = list(nugget=1,  psill= 1, range = 5),

weight=np/dist^2,

algorithm=port,

lower=c(0, 0, 0),

trace=F)

[[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] Rstudio: is it possible to create a document out of a working script?

2014-06-20 Thread David Winsemius

On Jun 20, 2014, at 2:40 AM, Luca Cerone wrote:

 Hi Berend, sorry if it OT (though I think that the process is pretty
 much Rstudio independent, since what Rstudio does is wrap up knitr and
 their package Rmarkdown,
 but all the process can be run from the shell).
 
 Bob, so far this is what I do, but it is not ideal for two reasons:
 1. I would like my report to be a step by step guide of what the
 script does. Wrapping the scripts in small functions, subscripts
 doesn´t help,
 because in the report what you would see is source(subscript.r),
 not the content of the subscript.

Have you looked at ?source and considered changing the associated option?

 getOption(verbose)
[1] FALSE

 
 2. in a way I would need the exact opposite of what knitr and
 Rmarkdown do (at least by default). I would like to document my script
 in a way that can be run independently of the report and that, when
 neede, could use the comments to generate the report, similarly to how
 roxygen2 works when writing the documentation.
 
 Thanks a lot for the help,
 apologies again if this is OT (if so please remove the thread and I
 will ask in the the Rstudio support).
 
 Cheers,
 Luca
 
 2014-06-20 11:28 GMT+02:00 Bob O'Hara rni@gmail.com:
 How about simply using source() to call the script? If necessary, wrap bits
 of the script in functions, so you source a file with lots of functions, and
 then call the ones you need, as you need them.
 
 Bob
 
 On 20 June 2014 11:20, Luca Cerone luca.cer...@gmail.com wrote:
 
 Dear all,
 I am very happy with the new features introduced by Rstudio about how
 to create documents embedding R code.
 
 I would like to know though if there is some way to embed code from a
 working script into an Rmd document.
 I have several working scripts for which I would like to report the
 results, but I would like to avoid
 copy and paste the code in the Rmd document: the pipeline is still a
 work in progress,
 and it is likely that I will end up changing the code and parameters
 in the script.
 
 As you can imagine, having to copy and paste my code is prone error,
 and leads to a lot of code replication.
 I would like to avoid this, but couldn´t find a straightforward way so
 far.
 
 
 Thanks a lot in advance,
 of course if you have other advices, or comments on best practices for
 this sort of thing,
 I would like to hear them from you.
 
 Cheers,
 Luca
 
 __
 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.
 
 
 
 
 --
 Bob O'Hara
 
 Biodiversity and Climate Research Centre
 Senckenberganlage 25
 D-60325 Frankfurt am Main,
 Germany
 
 Tel: +49 69 798 40226
 Mobile: +49 1515 888 5440
 WWW:   http://www.bik-f.de/root/index.php?page_id=219
 Blog: http://occamstypewriter.org/boboh/
 Journal of Negative Results - EEB: www.jnr-eeb.org
 
 
 
 -- 
 Luca Cerone
 
 Tel: +34 692 06 71 28
 Skype: luca.cerone
 
 __
 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
Alameda, CA, USA

__
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] Principal component analysis with EQUAMAX rotation

2014-06-20 Thread Orvalho Augusto
Dear!

I get this error when I try to install it on my linux PC:
root@orvaquimcism:~# R CMD INSTALL
/mnt/disco/downloads/R/psych_1.4.6.20.tar.gz
Error in rawToChar(block[seq_len(ns)]) :
  embedded nul in string:
'\037\x8b\b\0\0\0\0\0\0\003\xec\xbdk{\xe3Ƒ(\x9c\xaf\xc2\xf3\xf0?\xb4\xa9I\x86\x90
\x8a\0uq\xbc\x86\xf3N\xb1\xd79\xb6ck\xc6\xde=\xab(\xfb@$$\xc1C\0024@J
\x94gy~\xfb[\xb7\xbe\0\004%\xcdxf\xe2d5\x89E\xa0\xd1]}\xab\xae\xae\xaa\xae\xae\x9aU\xb7\xa3\xab\xfd?\xfd\xf9\xc5\xf3'

My PC is:
Xubuntu 12.04 64-bit with R version 3.1.0 (2014-04-10).

Thanks
Orvalho


On Fri, Jun 20, 2014 at 6:36 PM, William Revelle li...@revelle.net wrote:

 Dear Wagner,
   I added the equamax rotation option to the psych package in version
 1.4.6.  This was requested by Sagnik Chakravarty, with a solution by Gunter
 Nickel.

 Unfortunately, the version on CRAN  is 1.4.5, but you can get the working
 prerelease of 1.4.6 (1.4.6.20)  from the alternate repository
 http://personality-project.org/r/  (if using a Mac) or
 http://personality-project.org/r/src/contrib/   if using a PC.

 Thus,

  p3e - principal(Thurstone,3,rotate=equamax)  #will extract the first
 three components and rotate them using equamax.
  p3n - principal(Thurstone,3,rotate=none)   #will give you the
 unrotated 3 component solution
  p3v - principal(Thurstone,3,rotate=varimax) #for the varimax solution

  factor.congruence(list(p3e,p3n,p3v))  #compares the Burt/Tucker
 congruence coefficients for these three solutions


 Let me know if this does what you want.

 Bill


 On Jun 19, 2014, at 2:07 AM, Wagner wagner@gmx.de wrote:

  Hello,
  I need to do a principal component analysis with EQUAMAX-rotation.
  Unfortunately the function principal() I use normally for PCA does not
 offer
  this rotation specification. I could find out that this might be possible
  somehow with the package GPArotation but until now I could not figure out
  how to use this in the principal component analysis.
  Maybe someone can give an example on how to do an equamax-rotation PCA?
  Or is there a function in another package that offers the use of
  equamax-rotation directly?
  Thank you for your help!
 
 
 
  --
  View this message in context:
 http://r.789695.n4.nabble.com/Principal-component-analysis-with-EQUAMAX-rotation-tp4692337.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.
 

 William Revelle
 http://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 5 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.


[[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-es] No es un problema de tm tienes doc.corpus vacío

2014-06-20 Thread Ruben Tobalina Ramirez
hola,

sé que esto no tiene mucho que ver con R, pero he estado mirando y no sé
muy bien que me pasa y no sé si es problema de los paquetes de R. He bajado
la version 3.0.3 de las fuentes de R. Y para instalarlo, he hecho lo de
siempre:
sudo ./configure --enable-R-shlib
sudo make
y aqui me da el siguiente error:
make: *** No se especificó ningún objetivo y no se encontró ningún
makefile.  Alto.

he mirado la carpeta de R y ahi esta el fichero makefile, varios de hecho,
que he hecho mal, alguien me puede guiar, porfa?
gracias



El 18 de junio de 2014, 13:25, Ruben Tobalina Ramirez 
lagrimaescr...@gmail.com escribió:

 Muchas gracias isidro,

 a la noche reinstalo R y os digo si me ha funcionado. Perdona mi
 ignorancia de novato pero no he entendido muy bien eso de avisar al
 desarrollador. Entiendo que es a los de los paquetes, no?

 un saludo!

 ruben


 El 18 de junio de 2014, 13:10, Isidro Hidalgo ihida...@jccm.es escribió:

 Ya he visto que tampoco así funciona.
 Sí te puedo decir que me ha dejado de funcionar algo que ya tenía hecho
 hace
 tiempo.
 Puede que se trate de un problema de incompatibilidad de la versión 3.1.0
 con las versiones actuales de snowballC o tm...

 CONFIRMADO: con la 3.0.3 SÍ FUNCIONA. Se lo puedes comunicar al
 desarrollador.
 Un saludo.

 Isidro Hidalgo Arellano
 Observatorio Regional de Empleo
 Consejería de Empleo y Economía
 http://www.jccm.es




  -Mensaje original-
  De: r-help-es-boun...@r-project.org [mailto:r-help-es-bounces@r-
  project.org] En nombre de Isidro Hidalgo
  Enviado el: miércoles, 18 de junio de 2014 12:46
  Para: 'Ruben Tobalina Ramirez'; 'Ricardo Alberich'
  CC: 'r-help-es'
  Asunto: RE: [R-es] No es un problema de tm tienes doc.corpus vacío
 
  Creo que lo que quieres hacer necesita esta línea de código justo
  después de cargar el paquete tm:
 
  inmortal = unlist(strsplit(inmortal,  , fixed = T))
 
  De esta forma, trabajas con palabras, y NO con las frases enteras...
 
  Un saludo
 
  Isidro Hidalgo Arellano
  Observatorio Regional de Empleo
  Consejería de Empleo y Economía
  http://www.jccm.es
 
 
 
   -Mensaje original-
   De: r-help-es-boun...@r-project.org [mailto:r-help-es-bounces@r-
   project.org] En nombre de Ruben Tobalina Ramirez Enviado el: martes,
   17 de junio de 2014 20:25
   Para: Ricardo Alberich
   CC: r-help-es
   Asunto: Re: [R-es] No es un problema de tm tienes doc.corpus vacío
  
   Buenas tardes Ricardo,
  
   gracias por la respuesta rápida. Pues copie tu código y me sigue
   dando el mismo error. Fui a mi codigo y cambie los 'doc.corpus' por
   'corpus' (fue un error al limpiar el codigo) y sigue el error.
   No sé, he probado buscando en webs códigos similares y sigue el
   error:(
  
  
   El 17 de junio de 2014, 19:53, Ricardo Alberich r.alber...@uib.es
   escribió:
  
No es un problema de tm ni de SnowfallC ni de mcapply (por el path
utilizas linux, en windows mcapply según el manual no va bien)
   
No defines bien los objetos que pasas. Pasas  doc.corpus en lugar
  de
corpus ( o asignas a corpus en lugar de a doc.corpus) .
Depura los programas cuando salga un error de objeto, como te pone
en el Error que pasas .
   
Temporalmente lo tienes arreglado en
   
http://rpubs.com/ricardo/Temp
   
Pero otra vez observa paso a paso los objetos y nos dirás (bueno
  ya
lo
sabrás) dónde está el error.
   
Ricardo Alberich
   
   
On 17/06/14 18:38, r-help-es-requ...@r-project.org wrote:
   
Envíe los mensajes para la lista R-help-es a
r-help-es@r-project.org
   
Para subscribirse o anular su subscripción a través de la WEB
https://stat.ethz.ch/mailman/listinfo/r-help-es
   
O por correo electrónico, enviando un mensaje con el texto help
   en
el asunto (subject) o en el cuerpo a:
r-help-es-requ...@r-project.org
   
Puede contactar con el responsable de la lista escribiendo a:
r-help-es-ow...@r-project.org
   
Si responde a algún contenido de este mensaje, por favor, edite
  la
linea del asunto (subject) para que el texto sea mas especifico
  que:
Re: Contents of R-help-es digest Además, por favor, incluya
   en
la respuesta sólo aquellas partes del mensaje a las que está
respondiendo.
   
   
Asuntos del día:
   
1. problemas con el paquete tm (Ruben Tobalina Ramirez)
   
   
--
  -
-
   -
-
   
Message: 1
Date: Tue, 17 Jun 2014 18:37:58 +0200
From: Ruben Tobalina Ramirez lagrimaescr...@gmail.com
To: Lista R r-help-es@r-project.org
Subject: [R-es] problemas con el paquete tm
Message-ID:
CAKXAqm0tk9AFWcD7anRYKNDF9-KOyisu+9ZipOWQtK3MoS+t+g@mail.
gmail.com
Content-Type: text/plain; charset=utf-8
   
Hola,
   
hace un tiempo que voy detrás de aprender este 

Re: [R-es] No es un problema de tm tienes doc.corpus vacío

2014-06-20 Thread José Luis Cañadas Reche

  
  
Hola.

Parece que usas una distribucin derivada de debian, ya sea la misma
debian, ubuntu, linux mint o similar. 
Puedes instalar R desde los repositorios del sistema con 
sudo apt-get install r-base

Suele ser una versin de R bastante actual, pero si quieres la
ltima versin
en cran.r-project.org tienes instrucciones de como instalar R para
estos sistemas. 

Bsicamente es aadir un repositorio en /etc/apt/sources.list y ya
luego instalas R con sudo apt-get install r-base.

A no ser, claro, que desees compilar R desde el cdigo fuente por
algn motivo.

Espero haberte ayudado.

Saludos

De todas formas, 
El 20/06/14 11:24, Ruben Tobalina
  Ramirez escribi:


  hola,

s que esto no tiene mucho que ver con R, pero he estado mirando y no s
muy bien que me pasa y no s si es problema de los paquetes de R. He bajado
la version 3.0.3 de las fuentes de R. Y para instalarlo, he hecho lo de
siempre:
sudo ./configure --enable-R-shlib
sudo make
y aqui me da el siguiente error:
make: *** No se especific ningn objetivo y no se encontr ningn
makefile.  Alto.

he mirado la carpeta de R y ahi esta el fichero makefile, varios de hecho,
que he hecho mal, alguien me puede guiar, porfa?
gracias



El 18 de junio de 2014, 13:25, Ruben Tobalina Ramirez 
lagrimaescr...@gmail.com escribi:


  
Muchas gracias isidro,

a la noche reinstalo R y os digo si me ha funcionado. Perdona mi
ignorancia de novato pero no he entendido muy bien eso de avisar al
desarrollador. Entiendo que es a los de los paquetes, no?

un saludo!

ruben


El 18 de junio de 2014, 13:10, Isidro Hidalgo ihida...@jccm.es escribi:

Ya he visto que tampoco as funciona.


  S te puedo decir que me ha dejado de funcionar algo que ya tena hecho
hace
tiempo.
Puede que se trate de un problema de incompatibilidad de la versin 3.1.0
con las versiones actuales de snowballC o tm...

CONFIRMADO: con la 3.0.3 S FUNCIONA. Se lo puedes comunicar al
desarrollador.
Un saludo.

Isidro Hidalgo Arellano
Observatorio Regional de Empleo
Consejera de Empleo y Economa
http://www.jccm.es





  
-Mensaje original-
De: r-help-es-boun...@r-project.org [mailto:r-help-es-bounces@r-
project.org] En nombre de Isidro Hidalgo
Enviado el: mircoles, 18 de junio de 2014 12:46
Para: 'Ruben Tobalina Ramirez'; 'Ricardo Alberich'
CC: 'r-help-es'
Asunto: RE: [R-es] No es un problema de tm tienes doc.corpus vaco

Creo que lo que quieres hacer necesita esta lnea de cdigo justo
despus de cargar el paquete tm:

inmortal = unlist(strsplit(inmortal, " ", fixed = T))

De esta forma, trabajas con palabras, y NO con las frases enteras...

Un saludo

Isidro Hidalgo Arellano
Observatorio Regional de Empleo
Consejera de Empleo y Economa
http://www.jccm.es





  -Mensaje original-
De: r-help-es-boun...@r-project.org [mailto:r-help-es-bounces@r-
project.org] En nombre de Ruben Tobalina Ramirez Enviado el: martes,
17 de junio de 2014 20:25
Para: Ricardo Alberich
CC: r-help-es
Asunto: Re: [R-es] No es un problema de tm tienes doc.corpus vaco

Buenas tardes Ricardo,

gracias por la respuesta rpida. Pues copie tu cdigo y me sigue
dando el mismo error. Fui a mi codigo y cambie los 'doc.corpus' por
'corpus' (fue un error al limpiar el codigo) y sigue el error.
No s, he probado buscando en webs cdigos similares y sigue el
error:(


El 17 de junio de 2014, 19:53, Ricardo Alberich r.alber...@uib.es
escribi:


  
No es un problema de tm ni de SnowfallC ni de mcapply (por el path
utilizas linux, en windows mcapply segn el manual no va bien)

No defines bien los objetos que pasas. Pasas  doc.corpus en lugar

  

de


  
corpus ( o asignas a corpus en lugar de a doc.corpus) .
Depura los programas cuando salga un error de objeto, como te pone
en el Error que pasas .

Temporalmente lo tienes arreglado en

http://rpubs.com/ricardo/Temp

Pero otra vez observa paso a paso los objetos y nos dirs (bueno

  

ya


  
lo
sabrs) dnde est el error.

Ricardo Alberich


On 17/06/14 18:38, r-help-es-requ...@r-project.org wrote:



  Enve los mensajes para la lista R-help-es a
r-help-es@r-project.org

Para subscribirse o anular su subscripcin a travs de la WEB
https://stat.ethz.ch/mailman/listinfo/r-help-es

O por correo electrnico, enviando un mensaje con el texto "help"


  
  en

  

  el asunto (subject) o en el cuerpo a:
r-help-es-requ...@r-project.org

Puede contactar con el responsable de la lista escribiendo a:
r-help-es-ow...@r-project.org

Si responde a algn contenido de este mensaje, por favor, edite


Re: [R-es] No es un problema de tm tienes doc.corpus vacío

2014-06-20 Thread José Luis Cañadas Reche

  
  
ups. 
Acabo de ver que lo que queras es instalar una versin anterior de
R. 

Entonces no s a que se debe tu error.

Saludos
El 20/06/14 11:24, Ruben Tobalina
  Ramirez escribi:


  hola,

s que esto no tiene mucho que ver con R, pero he estado mirando y no s
muy bien que me pasa y no s si es problema de los paquetes de R. He bajado
la version 3.0.3 de las fuentes de R. Y para instalarlo, he hecho lo de
siempre:
sudo ./configure --enable-R-shlib
sudo make
y aqui me da el siguiente error:
make: *** No se especific ningn objetivo y no se encontr ningn
makefile.  Alto.

he mirado la carpeta de R y ahi esta el fichero makefile, varios de hecho,
que he hecho mal, alguien me puede guiar, porfa?
gracias



El 18 de junio de 2014, 13:25, Ruben Tobalina Ramirez 
lagrimaescr...@gmail.com escribi:


  
Muchas gracias isidro,

a la noche reinstalo R y os digo si me ha funcionado. Perdona mi
ignorancia de novato pero no he entendido muy bien eso de avisar al
desarrollador. Entiendo que es a los de los paquetes, no?

un saludo!

ruben


El 18 de junio de 2014, 13:10, Isidro Hidalgo ihida...@jccm.es escribi:

Ya he visto que tampoco as funciona.


  S te puedo decir que me ha dejado de funcionar algo que ya tena hecho
hace
tiempo.
Puede que se trate de un problema de incompatibilidad de la versin 3.1.0
con las versiones actuales de snowballC o tm...

CONFIRMADO: con la 3.0.3 S FUNCIONA. Se lo puedes comunicar al
desarrollador.
Un saludo.

Isidro Hidalgo Arellano
Observatorio Regional de Empleo
Consejera de Empleo y Economa
http://www.jccm.es





  
-Mensaje original-
De: r-help-es-boun...@r-project.org [mailto:r-help-es-bounces@r-
project.org] En nombre de Isidro Hidalgo
Enviado el: mircoles, 18 de junio de 2014 12:46
Para: 'Ruben Tobalina Ramirez'; 'Ricardo Alberich'
CC: 'r-help-es'
Asunto: RE: [R-es] No es un problema de tm tienes doc.corpus vaco

Creo que lo que quieres hacer necesita esta lnea de cdigo justo
despus de cargar el paquete tm:

inmortal = unlist(strsplit(inmortal, " ", fixed = T))

De esta forma, trabajas con palabras, y NO con las frases enteras...

Un saludo

Isidro Hidalgo Arellano
Observatorio Regional de Empleo
Consejera de Empleo y Economa
http://www.jccm.es





  -Mensaje original-
De: r-help-es-boun...@r-project.org [mailto:r-help-es-bounces@r-
project.org] En nombre de Ruben Tobalina Ramirez Enviado el: martes,
17 de junio de 2014 20:25
Para: Ricardo Alberich
CC: r-help-es
Asunto: Re: [R-es] No es un problema de tm tienes doc.corpus vaco

Buenas tardes Ricardo,

gracias por la respuesta rpida. Pues copie tu cdigo y me sigue
dando el mismo error. Fui a mi codigo y cambie los 'doc.corpus' por
'corpus' (fue un error al limpiar el codigo) y sigue el error.
No s, he probado buscando en webs cdigos similares y sigue el
error:(


El 17 de junio de 2014, 19:53, Ricardo Alberich r.alber...@uib.es
escribi:


  
No es un problema de tm ni de SnowfallC ni de mcapply (por el path
utilizas linux, en windows mcapply segn el manual no va bien)

No defines bien los objetos que pasas. Pasas  doc.corpus en lugar

  

de


  
corpus ( o asignas a corpus en lugar de a doc.corpus) .
Depura los programas cuando salga un error de objeto, como te pone
en el Error que pasas .

Temporalmente lo tienes arreglado en

http://rpubs.com/ricardo/Temp

Pero otra vez observa paso a paso los objetos y nos dirs (bueno

  

ya


  
lo
sabrs) dnde est el error.

Ricardo Alberich


On 17/06/14 18:38, r-help-es-requ...@r-project.org wrote:



  Enve los mensajes para la lista R-help-es a
r-help-es@r-project.org

Para subscribirse o anular su subscripcin a travs de la WEB
https://stat.ethz.ch/mailman/listinfo/r-help-es

O por correo electrnico, enviando un mensaje con el texto "help"


  
  en

  

  el asunto (subject) o en el cuerpo a:
r-help-es-requ...@r-project.org

Puede contactar con el responsable de la lista escribiendo a:
r-help-es-ow...@r-project.org

Si responde a algn contenido de este mensaje, por favor, edite


  

la


  

  linea del asunto (subject) para que el texto sea mas especifico


  

que:


  

  "Re: Contents of R-help-es digest...". Adems, por favor, incluya


  
  en

  

  la respuesta slo aquellas partes del mensaje a las que est
respondiendo.



Re: [R-es] No es un problema de tm tienes doc.corpus vacío

2014-06-20 Thread Ruben Tobalina Ramirez
José Luis, tengo la última versión, pero queria instalar otra porque hay
algun paquete que necesito que no va.

gracias de todas formas


El 20 de junio de 2014, 12:05, José Luis Cañadas Reche 
canadasre...@gmail.com escribió:

  ups.
 Acabo de ver que lo que querías es instalar una versión anterior de R.

 Entonces no sé a que se debe tu error.

 Saludos

 El 20/06/14 11:24, Ruben Tobalina Ramirez escribió:

 hola,

 sé que esto no tiene mucho que ver con R, pero he estado mirando y no sé
 muy bien que me pasa y no sé si es problema de los paquetes de R. He bajado
 la version 3.0.3 de las fuentes de R. Y para instalarlo, he hecho lo de
 siempre:
 sudo ./configure --enable-R-shlib
 sudo make
 y aqui me da el siguiente error:
 make: *** No se especificó ningún objetivo y no se encontró ningún
 makefile.  Alto.

 he mirado la carpeta de R y ahi esta el fichero makefile, varios de hecho,
 que he hecho mal, alguien me puede guiar, porfa?
 gracias



 El 18 de junio de 2014, 13:25, Ruben Tobalina Ramirez 
 lagrimaescr...@gmail.com escribió:


  Muchas gracias isidro,

 a la noche reinstalo R y os digo si me ha funcionado. Perdona mi
 ignorancia de novato pero no he entendido muy bien eso de avisar al
 desarrollador. Entiendo que es a los de los paquetes, no?

 un saludo!

 ruben


 El 18 de junio de 2014, 13:10, Isidro Hidalgo ihida...@jccm.es 
 ihida...@jccm.es escribió:

 Ya he visto que tampoco así funciona.

  Sí te puedo decir que me ha dejado de funcionar algo que ya tenía hecho
 hace
 tiempo.
 Puede que se trate de un problema de incompatibilidad de la versión 3.1.0
 con las versiones actuales de snowballC o tm...

 CONFIRMADO: con la 3.0.3 SÍ FUNCIONA. Se lo puedes comunicar al
 desarrollador.
 Un saludo.

 Isidro Hidalgo Arellano
 Observatorio Regional de Empleo
 Consejería de Empleo y Economíahttp://www.jccm.es



  -Mensaje original-
 De: r-help-es-boun...@r-project.org [mailto:r-help-es-bounces@r 
 r-help-es-bounces@r-project.org] En nombre de Isidro Hidalgo
 Enviado el: miércoles, 18 de junio de 2014 12:46
 Para: 'Ruben Tobalina Ramirez'; 'Ricardo Alberich'
 CC: 'r-help-es'
 Asunto: RE: [R-es] No es un problema de tm tienes doc.corpus vacío

 Creo que lo que quieres hacer necesita esta línea de código justo
 después de cargar el paquete tm:

 inmortal = unlist(strsplit(inmortal,  , fixed = T))

 De esta forma, trabajas con palabras, y NO con las frases enteras...

 Un saludo

 Isidro Hidalgo Arellano
 Observatorio Regional de Empleo
 Consejería de Empleo y Economíahttp://www.jccm.es


  -Mensaje original-
 De: r-help-es-boun...@r-project.org [mailto:r-help-es-bounces@r 
 r-help-es-bounces@r-project.org] En nombre de Ruben Tobalina Ramirez 
 Enviado el: martes,
 17 de junio de 2014 20:25
 Para: Ricardo Alberich
 CC: r-help-es
 Asunto: Re: [R-es] No es un problema de tm tienes doc.corpus vacío

 Buenas tardes Ricardo,

 gracias por la respuesta rápida. Pues copie tu código y me sigue
 dando el mismo error. Fui a mi codigo y cambie los 'doc.corpus' por
 'corpus' (fue un error al limpiar el codigo) y sigue el error.
 No sé, he probado buscando en webs códigos similares y sigue el
 error:(


 El 17 de junio de 2014, 19:53, Ricardo Alberich r.alber...@uib.es 
 r.alber...@uib.es
 escribió:


  No es un problema de tm ni de SnowfallC ni de mcapply (por el path
 utilizas linux, en windows mcapply según el manual no va bien)

 No defines bien los objetos que pasas. Pasas  doc.corpus en lugar

  de

  corpus ( o asignas a corpus en lugar de a doc.corpus) .
 Depura los programas cuando salga un error de objeto, como te pone
 en el Error que pasas .

 Temporalmente lo tienes arreglado en
 http://rpubs.com/ricardo/Temp

 Pero otra vez observa paso a paso los objetos y nos dirás (bueno

  ya

  lo
 sabrás) dónde está el error.

 Ricardo Alberich


 On 17/06/14 18:38, r-help-es-requ...@r-project.org wrote:


  Envíe los mensajes para la lista R-help-es a
 r-help-es@r-project.org

 Para subscribirse o anular su subscripción a través de la WEB
 https://stat.ethz.ch/mailman/listinfo/r-help-es

 O por correo electrónico, enviando un mensaje con el texto help

  en

  el asunto (subject) o en el cuerpo a:
 r-help-es-requ...@r-project.org

 Puede contactar con el responsable de la lista escribiendo a:
 r-help-es-ow...@r-project.org

 Si responde a algún contenido de este mensaje, por favor, edite

   la

   linea del asunto (subject) para que el texto sea mas especifico

   que:

   Re: Contents of R-help-es digest Además, por favor, incluya

  en

  la respuesta sólo aquellas partes del mensaje a las que está
 respondiendo.


 Asuntos del día:

 1. problemas con el paquete tm (Ruben Tobalina Ramirez)


 --

   -

   -

  -

  -

 Message: 1
 Date: Tue, 17 Jun 2014 18:37:58 +0200
 From: Ruben Tobalina Ramirez 

Re: [R-es] Como construir una curva ROC

2014-06-20 Thread Carlos Ortega
Hola,

En la sesión del 27-feb del Grupo de Usuarios de R de Madrid (
http://r-es.org/GILMadrid), Pedro Concejero dio una charla justamente de
estos dos paquetes, de sus ventajas e inconvenientes.

La sesión está grabada en video...
https://vimeo.com/87840245
https://vimeo.com/87841416

Y el material de su presentación está aqui:
http://r-es.org/tiki-download_file.php?fileId=1192

Saludos,
Carlos Ortega
www.qualityexcellence.es



El 20 de junio de 2014, 14:11, Marta valdes lopez martavalde...@gmail.com
escribió:

 Hola!

 Tengo que hacer una curva ROC com unos datos que obtuve de hacer una macro
 de excel y aplicar unas reglas, y basicamente tengo que a partir de la
 variacion del tiempo y la velocidad del barco obtengo diferentes
 porcentajes de true positives (TP) y false positives (FP) y con eso deberia
 de construir una curva ROC.

 Dada mi ignorância en este tema, no se muy bien por donde empezar , estuve
 mirando los manuales de dos paquetes el ROCR y el pROC, alguien me
 recomienda alguno en particular?

 Yen los manuales el script del ROCR para hacer la curva era algo asi:

 library(ROCR)
 data(ROCR.simple)
 pred - prediction( ROCR.simple$predictions, ROCR.simple$labels)
 perf - performance(pred,tpr,fpr)
 plot(perf)
 ## precision/recall curve (x-axis: recall, y-axis: precision)
 perf1 - performance(pred, prec, rec)
 plot(perf1)
 ## sensitivity/specificity curve (x-axis: specificity,
 ## y-axis: sensitivity)
 perf1 - performance(pred, sens, spec)
 plot(perf1)

 Me parecio mas fácil de entender que el del otro paquete pero no se como
 aplicarlo a mis datos y si voy a obtener lo que quiero, si alguien me puede
 orientar un poco, agradeceria.

 Adjunto mis datos para tener una idea.

 Muchas gracias, un saludo

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




-- 
Saludos,
Carlos Ortega
www.qualityexcellence.es

[[alternative HTML version deleted]]

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