Re: [R] using edit to extract codes from vignette failed

2014-09-09 Thread Karl Ropkins
FYI:
I get the same for Windows 7 and 8, no RStudio:
edit(vignette(grobs,package = grid)) works for me
edit(file=vignette(grobs,package = grid)) does not

 edit(file=vignette(grobs,package = grid))
Error in tempfile(name$topic, fileext = .R) :
  argument name is missing, with no default
 edit(vignette(grobs,package = grid))


Re RStudio: https://support.rstudio.com/hc/en-us?community_id=public?




From: PO SU [rhelpmaill...@163.com]
Sent: 09 September 2014 03:07
To: William Dunlap
Cc: Karl Ropkins; R. Help
Subject: Re:Re: [R] using edit to extract codes from vignette failed

OK, i get it, i should set the editor argument , i don't know how to report a 
bug to Rstudio, may you do that  ?



--

PO SU
mail: desolato...@163.com
Majored in Statistics from SJTU




At 2014-09-09 00:41:33, William Dunlap wdun...@tibco.com wrote:
Complain to the RStudio people - RStudio defines its own
options(editor) which is not completely compatible with R's
option(editor=internal).  If you set options(editor=internal) in
RStudio then you can look at the code in the vignette. (I tried with
last year's RStudio 0.98.501 and this may have been fixed by now.)
Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Mon, Sep 8, 2014 at 9:21 AM, PO SU rhelpmaill...@163.com wrote:

 Tks for correcting me not using the file argument, but the codes you supply  
 seem still not work.

 edit(vignette(grobs,package = grid)) can't work.
 I am using win7, the latest version of Rstudio which using R.3.1.1.The error 
 is:
 Error in editor(file = file, title = title) :
   argument name is missing, with no default











 --

 PO SU
 mail: desolato...@163.com
 Majored in Statistics from SJTU



 At 2014-09-08 05:46:39, Karl Ropkins k.ropk...@its.leeds.ac.uk wrote:
Try:

edit(vignette(grobs,package = grid))

(edit is a method. It looks at the class of the first entry, name, to 
identify which method to use. See ?edit.  You want it to use edit.vignette, 
so you need to drop 'file=' so you pass the vignette to edit as the first 
argument or name=. Then edit will pass it to edit.vignette and it'll work. 
Or go direct: edit.vignette(vignette(grobs,package = grid)). See 
?vignette. Maybe the use of name as the first argument of a method is a 
little misleading? But you can work out what is going if you work through 
the help documentation.)

Karl


Message: 9
Date: Sun, 7 Sep 2014 17:06:44 +0800 (CST)
From: PO SU rhelpmaill...@163.com
To: R. Help r-help@r-project.org
Subject: [R]   using  edit to extract codes from vignette failed
Message-ID: 4d3c1c8a.1c96.1484f5d8d31.coremail.rhelpmaill...@163.com
Content-Type: text/plain; charset=UTF-8

Dear expeRts,
? ? When i using the following code, i get a error as follows:

?edit(file=vignette(grobs,package = grid))
Error in edit.vignette(file = vignette(grobs, package = grid)) :?
? argument name is missing, with no default

I investigated edit function, but still can't ?get codes from a vignette, 
May you help me?

--

PO SU
mail: desolato...@163.com
Majored in Statistics from SJTU

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

__
R-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 use multi paragraph comment like /* and */ in cpp?

2014-09-09 Thread PO SU


I don't understand what's your meaning, do you mean that i should do some file 
processing,(like writing a script) ,so that i could add # in any line  i 
wanted. 
I think it is not convenient.
And, it does seems that there is no way to multi line comment in R. But when i 
turn to using Rstudio, after lots trying, i find that ctrl+shift+C can do the 
thing.
Also i investgate roxygen, but it seems needing to learn the whole package ,  
if some one happen to know how to do in roxygen, may you give me a quick 
reference?






--

PO SU
mail: desolato...@163.com 
Majored in Statistics from SJTU




At 2014-09-09 11:51:21, Pascal Oettli kri...@ymail.com wrote:
A workaround is to escape the evaluation of the lines. For example:

tt - 0
while(tt  0){
  cat('rr\n')
}

Regards,
Pascal

On Tue, Sep 9, 2014 at 11:49 AM, PO SU rhelpmaill...@163.com wrote:

 Dear expeRts,
I find it's terrible  when  i want to comment multi paragraph (e.g.  a 30 
 lines function) , i have to comment each line with #,  is there any good way 
 to do that ?
I investgate it, but found no easy way, may you help me ?





 --

 PO SU
 mail: desolato...@163.com
 Majored in Statistics from SJTU
 __
 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.



-- 
Pascal Oettli
Project Scientist
JAMSTEC
Yokohama, Japan
__
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 use multi paragraph comment like /* and */ in cpp?

2014-09-09 Thread Berend Hasselman

On 09-09-2014, at 08:25, PO SU rhelpmaill...@163.com wrote:

 
 
 I don't understand what's your meaning, do you mean that i should do some 
 file processing,(like writing a script) ,so that i could add # in any line  i 
 wanted. 
 I think it is not convenient.
 And, it does seems that there is no way to multi line comment in R. But when 
 i turn to using Rstudio, after lots trying, i find that ctrl+shift+C can do 
 the thing.


R only knows about single line comments. There is no multi line comment.
If you wish to comment several lines you will have to prefix each line with #.

Your editor may provide means of prefixing several lines with # by selecting 
lines and executing some command.
Rstudio provides Ctrl+Shift+C (Windows. Linux) and Cmd+Shift+C (OS X) on 
selected lines.
And other editors have other shortcuts.
You’ll just have to get used to this.

Berend

 Also i investgate roxygen, but it seems needing to learn the whole package ,  
 if some one happen to know how to do in roxygen, may you give me a quick 
 reference?
 
 
 
 
 
 
 --
 
 PO SU
 mail: desolato...@163.com 
 Majored in Statistics from SJTU
 
 
 
 
 At 2014-09-09 11:51:21, Pascal Oettli kri...@ymail.com wrote:
 A workaround is to escape the evaluation of the lines. For example:
 
 tt - 0
 while(tt  0){
 cat('rr\n')
 }
 
 Regards,
 Pascal
 
 On Tue, Sep 9, 2014 at 11:49 AM, PO SU rhelpmaill...@163.com wrote:
 
 Dear expeRts,
   I find it's terrible  when  i want to comment multi paragraph (e.g.  a 30 
 lines function) , i have to comment each line with #,  is there any good 
 way to do that ?
   I investgate it, but found no easy way, may you help me ?
 
 
 
 
 
 --
 
 PO SU
 mail: desolato...@163.com
 Majored in Statistics from SJTU
 __
 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.
 
 
 
 -- 
 Pascal Oettli
 Project Scientist
 JAMSTEC
 Yokohama, Japan
 __
 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] How to use multi paragraph comment like /* and */ in cpp?

2014-09-09 Thread Pascal Oettli
No I don't mean this. Did you at least try the small example I provided?

On Tue, Sep 9, 2014 at 3:25 PM, PO SU rhelpmaill...@163.com wrote:


 I don't understand what's your meaning, do you mean that i should do some 
 file processing,(like writing a script) ,so that i could add # in any line  i 
 wanted.
 I think it is not convenient.
 And, it does seems that there is no way to multi line comment in R. But when 
 i turn to using Rstudio, after lots trying, i find that ctrl+shift+C can do 
 the thing.
 Also i investgate roxygen, but it seems needing to learn the whole package ,  
 if some one happen to know how to do in roxygen, may you give me a quick 
 reference?






 --

 PO SU
 mail: desolato...@163.com
 Majored in Statistics from SJTU




 At 2014-09-09 11:51:21, Pascal Oettli kri...@ymail.com wrote:
A workaround is to escape the evaluation of the lines. For example:

tt - 0
while(tt  0){
  cat('rr\n')
}

Regards,
Pascal

On Tue, Sep 9, 2014 at 11:49 AM, PO SU rhelpmaill...@163.com wrote:

 Dear expeRts,
I find it's terrible  when  i want to comment multi paragraph (e.g.  a 
 30 lines function) , i have to comment each line with #,  is there any good 
 way to do that ?
I investgate it, but found no easy way, may you help me ?





 --

 PO SU
 mail: desolato...@163.com
 Majored in Statistics from SJTU
 __
 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.



--
Pascal Oettli
Project Scientist
JAMSTEC
Yokohama, Japan



-- 
Pascal Oettli
Project Scientist
JAMSTEC
Yokohama, Japan

__
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] Problems with bstats::white.test()

2014-09-09 Thread Achim Zeileis

On Mon, 8 Sep 2014, Iuri Gavronski wrote:


Hi,

I am trying to test for heteroskedascity in an OLS model, but I am not
able to run the white.test() if the model has dummy variables built
from factors. Any suggestions?


The White test is equivalent to the Breusch-Pagan test with an auxiliary 
model containing all regressors, their squares and their cross-products. 
For dummy variables the regressors and their squares are identical, so 
this strategy has to be modified. Other collinearities might occur as 
well.


For this reason the lmtest package has only a function bptest() but no 
additional whitetest() function. Examples show how to compute the White 
test, though. See e.g. example(CigarettesB, package = AER).


The bstats package has copied code for bptest (and dwtest) from lmtest 
without crediting the original authors. The maintainer is cc'ed here and 
encouraged to read and follow the CRAN policies.


The white.test() function in bstats does not leverage the bptest() 
function (and hence does not offer the recommended studentization option). 
It sets up the auxiliary model by pasting I(...^2) and : into the 
model formula which is very error prone and does not work for factor 
variables. (This is the reason why lmtest doesn't do it.)



Please find a reproducible code below:

myswiss - swiss
myswiss$fert - ifelse(
myswiss$Fertility70,
High,Low)
myswiss$fert - factor(myswiss$fert)
str(myswiss)
mod1 - lm(Infant.Mortality ~ fert,
data=myswiss)
library(bstats)
bptest(mod1)
white.test(mod1)

myswiss$fertlow - ifelse(
myswiss$Fertility70,
0,1)
mod2 - lm(Infant.Mortality ~ fertlow,
data=myswiss)
library(bstats)
bptest(mod2)
white.test(mod2)

Results:



bptest(mod2)


   studentized Breusch-Pagan test for homoscedasticity

data:  mod2
BP = 2e-04, df = 1, p-value = 0.989


white.test(mod2)


   White test for constant variance

data:
White = 2e-04, df = 1, p-value = 0.989


bptest(mod1)


   studentized Breusch-Pagan test for homoscedasticity

data:  mod1
BP = 2e-04, df = 1, p-value = 0.989


white.test(mod1)

Error in `contrasts-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) :
 contrasts can be applied only to factors with 2 or more levels
In addition: Warning message:
In Ops.factor(fert, fert) : * not meaningful for factors




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



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


[R] How to identify outliers with values five times 99th percentile

2014-09-09 Thread Kuma Raj
I have a data frame with some extreme values which I wish to identify
and repeat an analysis without these extreme values. How could I
identify several columns with values which are 5 times higher than the
99th percentile?

Sample data is pasted below.

 dput(df)

structure(list(ad1 = c(98, 6.9, 8.1, 56, 3.9, 6.9, 6.9, 5.8,

7.2, 20.5, 9.4, 7.6, 5.3, 7.9, 62.2, 9.2, 11.9, 8.8, 23.1, 5.4,

9.4, 56, 8.6, 20.7, 21, 10.5, 5.5, 4.3, 15.8, 6.8, 10.4, 5.1),

ad2 = c(14.9, 19.7, 1, 17.7, 14.9, 13.6, 18.8, 20.9, 46,

16.5, 11.7, 1, 9.2, 23.6, 19.7, 1, 11.4, 11, 23.1, 1, 1,

8.9, 11.3, 6.4, 15.2, 1, 17.3, 10.1, 13.3, 21.3, 12.3, 15.4

), ad3 = c(0.91, 0.95, 10.7, 4.4, 0.43, 0.8, 3.1, 1.9, 2.3,

5.6, 3.9, 7.3, 0.37, 4.1, 15.1, 21.8, 3, 0.79, 1, 4.6, 0.61,

0.46, 0.87, 23.5, 3.8, 3.1, 0.33, 1.9, 3.2, 1.7, 0.53, 62.5

), ad4 = c(225.5, 269.7, 326, 485.4, 193.2, 274.1, 553.2,

166.8, 435.9, 433.2, 187.1, 660.4, 235.4, 356.5, 378.8, 500.5,

323.5, 327.1, 289.5, 301.2, 291.7, 333.5, 351.7, 384.1, 347,

1354, 440.4, 189.2, 381, 252.7, 391.1, 255.1), ad5 = c(337.9,

355.6, 419.5, 798.5, 225, 355.9, 394.4, 340.6, 463.9, 291.9,

312.3, 491, 290.5, 231.9, 358, 386.4, 306.7, 440.6, 297.9,

339.3, 341.1, 366.2, 325.4, 357, 412.2, 370.2, 421.3, 346.3,

289.1, 257.4, 368, 322.6), ad6 = c(64.5, 130.6, 76, 167.8,

47.3, 117, 60.7, 91.9, 221.9, 91.1, 105.1, 110.8, 64.5, 184.5,

191.6, 259.4, 879.5, 142.1, 55.3, 123.1, 62.2, 75.2, 154.6,

100.7, 93.1, 136.7, 74.3, 41.8, 110.1, 109.1, 172.5, 87.7

), ad7 = c(128L, 987L, 158L, 124L, 137L, 215L, 141L, 98L,

291L, 261L, 106L, 137L, 141L, 159L, 221L, 108L, 123L, 107L,

137L, 175L, 257L, 97L, 168L, 145L, 147L, 188L, 145L, 128L,

153L, 187L, 123L, 354L), ad8 = c(3.26, 3.98, 2.88, 2.85,

4.17, 3.16, 3.09, 4.35, 3.46, 3.81, 3.78, 3.81, 4.17, 4.27,

4.27, 2.97, 3.43, 3.48, 3.78, 3.86, 3.11, 3.12, 3.16, 4.24,

3.81, 3.11, 5.31, 3.75, 3.78, 3.55, 4.08, 3.5), ad9 = c(433L,

211L, 66L, 173L, 224L, 466L, 224L, 273L, 94L, 321L, 160L,

107L, 121L, 186L, 455L, 80L, 897L, 186L, 285L, 134L, 107L,

355L, 261L, 249L, 332L, 107L, 273L, 107L, 160L, 535L, 160L,

121L)), .Names = c(ad1, ad2, ad3, ad4, ad5, ad6,

ad7, ad8, ad9), class = data.frame, row.names = c(NA,

-32L))

__
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 identify outliers with values five times 99th percentile

2014-09-09 Thread Rui Barradas

Hello,

Try the following.

out - lapply(df, function(x){
qq - quantile(x, probs = 0.99)
which(x  5*qq)
})

out

The list 'out' contains indices to the outliers. You can now have those 
outliers as follows


df[out[[1]], 1]  # first column

Etc.

Hope this helps,

Rui Barradas


Em 09-09-2014 10:21, Kuma Raj escreveu:

I have a data frame with some extreme values which I wish to identify
and repeat an analysis without these extreme values. How could I
identify several columns with values which are 5 times higher than the
99th percentile?

Sample data is pasted below.


dput(df)


structure(list(ad1 = c(98, 6.9, 8.1, 56, 3.9, 6.9, 6.9, 5.8,

7.2, 20.5, 9.4, 7.6, 5.3, 7.9, 62.2, 9.2, 11.9, 8.8, 23.1, 5.4,

9.4, 56, 8.6, 20.7, 21, 10.5, 5.5, 4.3, 15.8, 6.8, 10.4, 5.1),

 ad2 = c(14.9, 19.7, 1, 17.7, 14.9, 13.6, 18.8, 20.9, 46,

 16.5, 11.7, 1, 9.2, 23.6, 19.7, 1, 11.4, 11, 23.1, 1, 1,

 8.9, 11.3, 6.4, 15.2, 1, 17.3, 10.1, 13.3, 21.3, 12.3, 15.4

 ), ad3 = c(0.91, 0.95, 10.7, 4.4, 0.43, 0.8, 3.1, 1.9, 2.3,

 5.6, 3.9, 7.3, 0.37, 4.1, 15.1, 21.8, 3, 0.79, 1, 4.6, 0.61,

 0.46, 0.87, 23.5, 3.8, 3.1, 0.33, 1.9, 3.2, 1.7, 0.53, 62.5

 ), ad4 = c(225.5, 269.7, 326, 485.4, 193.2, 274.1, 553.2,

 166.8, 435.9, 433.2, 187.1, 660.4, 235.4, 356.5, 378.8, 500.5,

 323.5, 327.1, 289.5, 301.2, 291.7, 333.5, 351.7, 384.1, 347,

 1354, 440.4, 189.2, 381, 252.7, 391.1, 255.1), ad5 = c(337.9,

 355.6, 419.5, 798.5, 225, 355.9, 394.4, 340.6, 463.9, 291.9,

 312.3, 491, 290.5, 231.9, 358, 386.4, 306.7, 440.6, 297.9,

 339.3, 341.1, 366.2, 325.4, 357, 412.2, 370.2, 421.3, 346.3,

 289.1, 257.4, 368, 322.6), ad6 = c(64.5, 130.6, 76, 167.8,

 47.3, 117, 60.7, 91.9, 221.9, 91.1, 105.1, 110.8, 64.5, 184.5,

 191.6, 259.4, 879.5, 142.1, 55.3, 123.1, 62.2, 75.2, 154.6,

 100.7, 93.1, 136.7, 74.3, 41.8, 110.1, 109.1, 172.5, 87.7

 ), ad7 = c(128L, 987L, 158L, 124L, 137L, 215L, 141L, 98L,

 291L, 261L, 106L, 137L, 141L, 159L, 221L, 108L, 123L, 107L,

 137L, 175L, 257L, 97L, 168L, 145L, 147L, 188L, 145L, 128L,

 153L, 187L, 123L, 354L), ad8 = c(3.26, 3.98, 2.88, 2.85,

 4.17, 3.16, 3.09, 4.35, 3.46, 3.81, 3.78, 3.81, 4.17, 4.27,

 4.27, 2.97, 3.43, 3.48, 3.78, 3.86, 3.11, 3.12, 3.16, 4.24,

 3.81, 3.11, 5.31, 3.75, 3.78, 3.55, 4.08, 3.5), ad9 = c(433L,

 211L, 66L, 173L, 224L, 466L, 224L, 273L, 94L, 321L, 160L,

 107L, 121L, 186L, 455L, 80L, 897L, 186L, 285L, 134L, 107L,

 355L, 261L, 249L, 332L, 107L, 273L, 107L, 160L, 535L, 160L,

 121L)), .Names = c(ad1, ad2, ad3, ad4, ad5, ad6,

ad7, ad8, ad9), class = data.frame, row.names = c(NA,

-32L))

__
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] sequential input script dataframe process functionality

2014-09-09 Thread rl

On 2014-09-08 15:47, William Dunlap wrote:

d - data.frame(Choices=c(One,Two,One,Three), X=1:4)
i - 1 # possible output of menu(unique(d$Choices))
d[ d$Choices[i] == d$Choices, ]
#  Choices X
#1 One 1
#3 One 3




testd - data.frame(Choices=c(One,Two,One,Three), X=1:4)
testi - 1 # possible output of menu(unique(d$Choices))
testd[ testd$Choices[testi] == testd$Choices, ]

  Choices X
1 One 1
3 One 3

This instruction did not give any opportunity to enter a choice? Then 
tried:


?Choices
No documentation for 'Choices' in specified packages and libraries:
you could try '??Choices'

??Choices
Help files with alias or concept or title matching ‘Choices’ using
fuzzy matching:


mgcv::choose.k  Basis dimension choice for smooths
mvtnorm::GenzBretz  Choice of Algorithm and Hyper Parameters


Type '?PKG::FOO' to inspect entry 'PKG::FOO TITLE'.

Then I tried to use with my test data:

testdataextract1-data.frame(menu(c(unique(levels(testdata[,1]))),graphics=FALSE,title='Select 
something'))

selectionresult-2
testdata[testdata$menu[selectionresult]==testdata$menu,]
testdataextract1-data.frame(menu(c(unique(levels(testdata[,1]))),graphics=FALSE,title='Select 
something'))

Select something

1: text test1
2: text test2
3: text test3

Selection: selectionresult-2
Enter an item from the menu, or 0 to exit
Selection: testdata[testdata$menu[selectionresult]==testdata$menu,]
Enter an item from the menu, or 0 to exit
Selection: 0

Now confused by Choices! :) What is my error please?

__
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 use multi paragraph comment like /* and */ in cpp?

2014-09-09 Thread Duncan Murdoch
On 08/09/2014, 11:14 PM, Jeff Newmiller wrote:
 There are no multi line comment markers in R. However, since you are always 
 referring to RStudio you might want to look into roxygen, since their editor 
 supports that tool.

RStudio has a command to comment a block:  it's in the Code menu.  (On
my Mac the shortcut is unprintableunspeakableC :-).

Duncan Murdoch


 
 I would also suggest making more functions that are smaller.
 ---
 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 September 8, 2014 7:49:32 PM PDT, PO SU rhelpmaill...@163.com wrote:

 Dear expeRts,
I find it's terrible  when  i want to comment multi paragraph (e.g. 
 a 30 lines function) , i have to comment each line with #,  is there
 any good way to do that ?
I investgate it, but found no easy way, may you help me ?





 --

 PO SU
 mail: desolato...@163.com 
 Majored in Statistics from SJTU
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-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 use multi paragraph comment like /* and */ in cpp?

2014-09-09 Thread Martin Maechler
 PS == PO SU rhelpmaill...@163.com
 on Tue, 9 Sep 2014 10:49:32 +0800 writes:

PS Dear expeRts,    I find it's terrible  when  i want to
PS comment multi paragraph (e.g.  a 30 lines function) , i
PS have to comment each line with #,  is there any good way
PS to do that ?     I investgate it, but found no easy way,
PS may you help me ?

Even though I can easily mark such a block and use the general
emacs  comment keyM-;
to comment each of those lines,
I often prefer

 if(FALSE) {

   ...
   ...
   ...

 }

which in the case of a single function definition which is only
one R expression can even do without the braces  {, }
and hence very easily activated/deactivated.

__
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] using edit to extract codes from vignette failed

2014-09-09 Thread William Dunlap
  i don't know how to report a bug to Rstudio

Have you tried clicking on 'Help', then on 'RStudio Support' in the
menu that pops up?

Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Mon, Sep 8, 2014 at 7:07 PM, PO SU rhelpmaill...@163.com wrote:


 OK, i get it, i should set the editor argument , i don't know how to report a 
 bug to Rstudio, may you do that  ?



 --

 PO SU
 mail: desolato...@163.com
 Majored in Statistics from SJTU




 At 2014-09-09 00:41:33, William Dunlap wdun...@tibco.com wrote:
Complain to the RStudio people - RStudio defines its own
options(editor) which is not completely compatible with R's
option(editor=internal).  If you set options(editor=internal) in
RStudio then you can look at the code in the vignette. (I tried with
last year's RStudio 0.98.501 and this may have been fixed by now.)
Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Mon, Sep 8, 2014 at 9:21 AM, PO SU rhelpmaill...@163.com wrote:

 Tks for correcting me not using the file argument, but the codes you supply 
  seem still not work.

 edit(vignette(grobs,package = grid)) can't work.
 I am using win7, the latest version of Rstudio which using R.3.1.1.The 
 error is:
 Error in editor(file = file, title = title) :
   argument name is missing, with no default











 --

 PO SU
 mail: desolato...@163.com
 Majored in Statistics from SJTU



 At 2014-09-08 05:46:39, Karl Ropkins k.ropk...@its.leeds.ac.uk wrote:
Try:

edit(vignette(grobs,package = grid))

(edit is a method. It looks at the class of the first entry, name, to 
identify which method to use. See ?edit.  You want it to use edit.vignette, 
so you need to drop 'file=' so you pass the vignette to edit as the first 
argument or name=. Then edit will pass it to edit.vignette and it'll work. 
Or go direct: edit.vignette(vignette(grobs,package = grid)). See 
?vignette. Maybe the use of name as the first argument of a method is a 
little misleading? But you can work out what is going if you work through 
the help documentation.)

Karl


Message: 9
Date: Sun, 7 Sep 2014 17:06:44 +0800 (CST)
From: PO SU rhelpmaill...@163.com
To: R. Help r-help@r-project.org
Subject: [R]   using  edit to extract codes from vignette failed
Message-ID: 4d3c1c8a.1c96.1484f5d8d31.coremail.rhelpmaill...@163.com
Content-Type: text/plain; charset=UTF-8

Dear expeRts,
? ? When i using the following code, i get a error as follows:

?edit(file=vignette(grobs,package = grid))
Error in edit.vignette(file = vignette(grobs, package = grid)) :?
? argument name is missing, with no default

I investigated edit function, but still can't ?get codes from a vignette, 
May you help me?

--

PO SU
mail: desolato...@163.com
Majored in Statistics from SJTU

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

__
R-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 use multi paragraph comment like /* and */ in cpp?

2014-09-09 Thread Bos, Roger
What I do in cases like that is wrap the code in a FALSE statement so it won't 
get executed:  its easy to add and remove as needed.

If (FALSE) {

...Code to exclude

}



***
This message and any attachments are for the named person's use only.
This message may contain confidential, proprietary or legally privileged
information. No right to confidential or privileged treatment
of this message is waived or lost by an error in transmission.
If you have received this message in error, please immediately
notify the sender by e-mail, delete the message, any attachments and all
copies from your system and destroy any hard copies. You must
not, directly or indirectly, use, disclose, distribute,
print or copy any part of this message or any attachments if you are not
the intended recipient.



-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of PO SU
Sent: Monday, September 08, 2014 10:50 PM
To: R. Help
Subject: [R] How to use multi paragraph comment like /* and */ in cpp?


Dear expeRts,
   I find it's terrible  when  i want to comment multi paragraph (e.g.  a 30 
lines function) , i have to comment each line with #,  is there any good way to 
do that ?
   I investgate it, but found no easy way, may you help me ?





--

PO SU
mail: desolato...@163.com
Majored in Statistics from SJTU
__
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] splitting data

2014-09-09 Thread eliza botto
Dear Davis, Dennis and John,
I am thankyou that you replied. I'll take care of it in future. 

Eliza

 Date: Mon, 8 Sep 2014 17:36:30 -0700
 Subject: Re: [R] splitting data
 From: djmu...@gmail.com
 To: eliza_bo...@hotmail.com
 
 Hi Eliza:
 
 Here are a few potential solutions. Given that you have 100 years of
 monthly data, it's likely that a package such as dplyr or data.table
 would be significantly faster than some of the alternatives offered to
 date. I'm assuming the game is to generate the monthly sums for each
 of A, B, C below.
 
 # Fake data set intended to replicate four years of data
 # To keep it simple, I only use 30 days a month.
 d - data.frame(expand.grid(year = 1961:1964, month = seq(12), day = seq(30)),
 A = rpois(1440, 10), B = rpois(1440, 15), C = rpois(1440, 25))
 
 
 # plyr package solution - colwise() applies the same function to each
 # of the variables named within .()
 
 library(plyr)
 ymsums - ddply(d, .(year, month), colwise(sum, .(A, B, C)))
 
 
 
 # dplyr package solution using the new piping operator %% from the
 # magrittr package. (Think of  a %% b as: take the data in a and
 # then call function b on it. This idea can be strung in sequence:
 # the term on the left of %% supplies the input data for the
 # function call on the right.)
 
 library(dplyr)
 # library(magrittr)
 
 ymsums2 - d %% group_by(year, month) %%
  summarise(Atot = sum(A), Btot = sum(B), Ctot = sum(C))
 
 
 
 # data.table package solution
 
 library(data.table)
 
 dt - data.table(d, key = c(year, month))
 ymsums3 - dt[, list(Atot = sum(A), Btot = sum(B), Ctot = sum(C)),
 by = key(dt)]
 
 head(ymsums)
 head(ymsums2)
 head(ymsums3)
 
 dplyr was about 2.5 times faster than data.table and almost 30 times
 faster than plyr for this example. To be honest, though, I don't think
 I used the most efficient code for either of dplyr or data.table, so
 the relative timings may be somewhat misleading. OTOH, for this 1440
 line fake data set, dplyr processed it in 0.1 sec. with the code I
 used and data.table took 0.24 sec. If your data frame is 100 years in
 length, it should be approximately 25 times the length of mine, so
 we'd be talking about 2.5 sec with dplyr and somewhere between 3.5 - 5
 sec. with data.table, since the advantage of the way it sets keys
 improves processing speed in a relative sense as the size of the data
 set grows. That's not bad no matter which one you choose.
 
 BTW, it's possible to do it with reshape2 as follows:
 
 library(reshape2)
 
 # stack variables A-C, producing the long form
 dm - melt(d, id = c(year, month, day))
 
 # reshape
 drt - dcast(dm, year + month ~ variable, fun.aggregate = sum,
  value.var = value)
 head(drt)
 
 This is approximately 4 times faster than the plyr solution and about
 3 times slower than data.table. This is about as fast as you can get
 it in reshape2.
 
 HTH,
 Dennis
 
 PS: I agree with David about the HTML postings. You've been on this
 list long enough to know what is expected. All it takes is a change or
 two in the settings of your mailing client. I use gmail, and one
 change of setting is all it took for me...five years ago, the one and
 only time I was admonished to do so.
 
 On Mon, Sep 8, 2014 at 12:08 PM, eliza botto eliza_bo...@hotmail.com wrote:
  Dear R members,
 
  I have this data frame of 100 years in the following format
 
  yearmonth   day A   B   C D
 
  where  A,B,C and D are item number sold each day. I am trying
 
  1-split the data w.r.t the monthly values for each year
 
  2-then, sum them up
 
  I am pasting here just a part of data to make it more clearer
 
  structure(list(year = c(1961, 1961, 1961, 1961, 1961, 1961, 1961,
  1961, 1961, 1961, 1961, 1961), month = c(1, 1, 1, 1, 1, 1, 1,
  1, 1, 1, 1, 1), day = 1:12, A = 1:12, B = 3:14, C = 6:17, D = 16:27), 
  .Names = c(year,
  month, day, A, B, C, D), row.names = c(NA, 12L), class = 
  data.frame)
 
  I initially tried to use dcast command but for no use.
 
  Your kind help is needed.
 
  Thanks in advance
 
  Eliza
 
 
 
  [[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] KDE routines for data that is aggregated

2014-09-09 Thread David L Carlson
If the x and y values are regularly spaced, you could use contour() or persp() 
to plot the densities. If they are not, you can use density(), loess(), gam(), 
kriging another function to estimate a smooth surface for the values and then 
estimate the values over a regular grid and then plot with contour, etc.

-
David L Carlson
Department of Anthropology
Texas AM University
College Station, TX 77840-4352

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Saptarshi Guha
Sent: Monday, September 8, 2014 6:57 PM
To: R-help@r-project.org
Subject: [R] KDE routines for data that is aggregated

Hello,
Couldn't think of a better subject line. Rather than a matrix like

x,y
..,..
.,..

I have a matrix like
x,y,n,
..,..,..,
..,..,..

and so on. Also, sum(n) is roughly few hundred million. The number of rows
is 1MM

Are they routines to fit a 2d kde estimate to data provided in this form?
I can sample from the data according to weights given by 'n' but i am
curious if there is something that can use all the data when given a
structure of this form.

Regards
Saptarshi

[[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] How to use multi paragraph comment like /* and */ in cpp?

2014-09-09 Thread Gjalt-Jorn Peters
In R-studio, you can also select whatever you want to comment out, and 
press CTRL-SHIFT-C to comment the selection in one go.
To uncomment it all in one go again, you can select it again and press 
CTRL-SHIFT-C again.


Gjalt-Jorn

On 2014-09-09 5:51, Pascal Oettli wrote:

A workaround is to escape the evaluation of the lines. For example:

tt - 0
while(tt  0){
   cat('rr\n')
}

Regards,
Pascal

On Tue, Sep 9, 2014 at 11:49 AM, PO SU rhelpmaill...@163.com wrote:

Dear expeRts,
I find it's terrible  when  i want to comment multi paragraph (e.g.  a 30 
lines function) , i have to comment each line with #,  is there any good way to 
do that ?
I investgate it, but found no easy way, may you help me ?





--

PO SU
mail: desolato...@163.com
Majored in Statistics from SJTU
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.





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


[R] marketing-questionnaire with split-design

2014-09-09 Thread Norbert Dörrer
Dear Experts

I'm quite new to the world of R; so maybe my question is kind of
beginners...

I am right now trying to analyse questionnaire data (CAWI) for producing a
image/positioning map of the competitors of my company; when programming
the CAWI, a split design was needed; every respondent had to answer a
couple of multiple-choice questions (on reputation of company, image,
sympathy etc.; 1 perfect to 5 absolutely not perfect) for two companies
only - out of a list of several companies; companies were chosen randomly.

So what I have now is two variables that tell me which two companies the
respondent was actually evaluating...
Company 1:  A, B, C, D, E, F or G
Company 2:  A, B, C, D, E, F or G

... and of course several image-related variables:
reputation of company 1:  3,4,2,3,5,1,2,3,4,2,3,1,5 and so on
reputation of company 2:  5,2,3,4,2,5,1,2,3,2,4,21 and so on
image of company 1:2,4,3,5,2,3,4,1,2,5,3,4,2 and so on
image of company 2:3,4,5,2,5,4,5,3,4,2,5,1,2 and so on
sympathy of company 1:  1,5,3,4,2,5,3,4,1,2,3,4,5 and so on
sympathy of company 2:   5,5,4,5,3,3,4,3,3,3,4,2,5 and so on
etc.


But what I need in order to do proper calculations is one
Reputation/Image/Sympathy-Variable for every single company, like this:
reputation of Company A: e.g. 3,4,3,5,NA,3,NA,5,2,1,NA,NA
reputation of Company B: e.g. NA,4,3,5,NA,3,NA,5,2,1,NA
reputation of Company C and so on
image of Company A:...
image of Company B :...
image of Company C and so on
sympathy of Company A:...
sympathy of Company B :...
sympathy of Company C and so on

So I need some syntax to compute a new variable  e.g. reputation_CompanyA
that contains the values of reputation of company 1 whenever Company
1=A and that contains the values of reputation of company 2 whenever
Company 2=A... else is of course missing values!

The solution has to has something to do with loops and flow control, but I
really can't solve this puzzle.

Thanks for your help and best regards
Norbert

[[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] R, Big Data and books

2014-09-09 Thread Subba Rao
Hi,

I am interested in R programming in the Big Data space.  Are there any
books that would be a good starting point for this career path? 
Predictive analysis is also an area I am interested in.

Thank you in advance for any information and help.

Subba Rao

__
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] Affinity Analysis at Product Category Level

2014-09-09 Thread anshuji

Hi - Need help to do product affinity analysis for a Retailer. Products are 
categorized into categories such as say Baby Care, Male Hair Care, Female Hair 
Care etc. I can do affinity analysis at the product level using Apriori 
algorithm. I get the support, confidence and lift and using this I get the 
product affinity.

My objective is to tell that buying a product from say Category A means that 
there is chance that products from Category B also will be bought. However, I 
might not be able to apply same principle that I applied for individual 
products to Product Categories also. The reason is that in a customer's basket, 
there can be say 5 products of say Category A and just 1 product of category B, 
and in another transaction there might be 10 Category products and 4 Category B 
products and in another there might be 2 products of Categories A and B. There 
can be a similar imbalance across categories across transactions. In such a 
scenario, how do we perform affinity analysis.

Thanks in advance


Disclaimer: The materials contained in this email and any attachments may 
contain confidential or legally privileged information. The information 
contained in this communication is intended solely for the use of the 
individual or entity to whom it is addressed and others authorized to receive 
it. If you are not the intended recipient you are hereby notified that any 
disclosure, copying, distribution or taking any action in reliance on the 
contents of this information is strictly prohibited and may be unlawful. If you 
have received this communication in error, please notify us immediately by 
responding to this email and then delete it from your system. Sonata is neither 
liable for the proper and complete transmission of the information contained in 
this communication nor for any delay in its receipt




--
View this message in context: 
http://r.789695.n4.nabble.com/Affinity-Analysis-at-Product-Category-Level-tp4696681.html
Sent from the R help mailing list archive at Nabble.com.
[[alternative HTML version deleted]]

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


[R] Sentence Splitting using R's openNLP library is not efficient

2014-09-09 Thread anshuji
Please suggest any efficient way/code of splitting text into sentences in R.
Currently, I'm using openNLP library for the same, it is taking several hours 
to process 8,000+ records of twitter post/comments.

Below is my R code for same:

options(java.parameters = -Xmx4g)

library(NLP); library(openNLPdata); library(openNLP)
sentence_token_annotator - Maxent_Sent_Token_Annotator()
convert_text_to_sentences - function(text) {
text - as.String(text)
sentence.boundaries - annotate(text, sentence_token_annotator)
sentences - text[sentence.boundaries]
return(sentences)
}

system.time(textofcomment_list - lapply(data_all$TEXT, 
convert_text_to_sentences))

Thanks in advance

Disclaimer: The materials contained in this email and any attachments may 
contain confidential or legally privileged information. The information 
contained in this communication is intended solely for the use of the 
individual or entity to whom it is addressed and others authorized to receive 
it. If you are not the intended recipient you are hereby notified that any 
disclosure, copying, distribution or taking any action in reliance on the 
contents of this information is strictly prohibited and may be unlawful. If you 
have received this communication in error, please notify us immediately by 
responding to this email and then delete it from your system. Sonata is neither 
liable for the proper and complete transmission of the information contained in 
this communication nor for any delay in its receipt




--
View this message in context: 
http://r.789695.n4.nabble.com/Sentence-Splitting-using-R-s-openNLP-library-is-not-efficient-tp4696694.html
Sent from the R help mailing list archive at Nabble.com.
[[alternative HTML version deleted]]

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


Re: [R] How to use multi paragraph comment like /* and */ in cpp?

2014-09-09 Thread Sven E. Templer
One way I know to do this is (in bash) to use a dummy variable and make the
comment a multiline character string:

dummy - c(
This is my multiline
comment or code block.
)

or if printing does not disturb you, just use:


...


Use ' if you have  in the block.
Other workarounds are here, which you find when using a search engine:
http://stackoverflow.com/questions/1231195/multiline-comment-workarounds

Hope this helps.

@Duncan: sorry sending the mail to you twice.

Sven

On 9 September 2014 13:43, Duncan Murdoch murdoch.dun...@gmail.com wrote:
 On 08/09/2014, 11:14 PM, Jeff Newmiller wrote:
 There are no multi line comment markers in R. However, since you are always 
 referring to RStudio you might want to look into roxygen, since their editor 
 supports that tool.

 RStudio has a command to comment a block:  it's in the Code menu.  (On
 my Mac the shortcut is unprintableunspeakableC :-).

 Duncan Murdoch



 I would also suggest making more functions that are smaller.
 ---
 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 September 8, 2014 7:49:32 PM PDT, PO SU rhelpmaill...@163.com wrote:

 Dear expeRts,
I find it's terrible  when  i want to comment multi paragraph (e.g.
 a 30 lines function) , i have to comment each line with #,  is there
 any good way to do that ?
I investgate it, but found no easy way, may you help me ?





 --

 PO SU
 mail: desolato...@163.com
 Majored in Statistics from SJTU
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


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

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


[R] Import data from Excel to R

2014-09-09 Thread JAWADI Fredj
Hi
I am a New user of R.
Please, how to import data from Excel to R?
Thanks,
Best regards,
Fredj,


[[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] Import data from Excel to R

2014-09-09 Thread Ista Zahn
Read the manual.

http://cran.r-project.org/doc/manuals/r-release/R-data.html#Reading-Excel-spreadsheets

Best,
Ista
On Sep 9, 2014 6:39 PM, JAWADI Fredj fredj.jaw...@france-bs.com wrote:

 Hi
 I am a New user of R.
 Please, how to import data from Excel to R?
 Thanks,
 Best regards,
 Fredj,


 [[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] Import data from Excel to R

2014-09-09 Thread Peter Alspach
Tena koe Fredj

There are lots of ways, depending on your precise task and preference.  Have 
you Googled 'Import data from Excel to R'?  That will bring up lots of relevant 
hits, including the data import/export manual that ships with R.

FWIW, I use RODBC and have written a simple wrapper to do the most standard 
tasks (which I can share if you like) 

Peter Alspach

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of JAWADI Fredj
Sent: Wednesday, 10 September 2014 8:48 a.m.
To: r-help@R-project.org
Subject: [R] Import data from Excel to R

Hi
I am a New user of R.
Please, how to import data from Excel to R?
Thanks,
Best regards,
Fredj,


[[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.
The contents of this e-mail are confidential and may be ...{{dropped:14}}

__
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] Import data from Excel to R

2014-09-09 Thread Gabor Grothendieck
On Tue, Sep 9, 2014 at 4:48 PM, JAWADI Fredj fredj.jaw...@france-bs.com wrote:
 Hi
 I am a New user of R.
 Please, how to import data from Excel to R?
 Thanks,
 Best regards,
 Fredj,


There are some ways listed here:
https://web.archive.org/web/20131109195709/http://rwiki.sciviews.org/doku.php?id=tips:data-io:ms_windowss=excel


-- 
Statistics  Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at 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] Why does debugging print() change output of function?

2014-09-09 Thread peter dalgaard

On 07 Sep 2014, at 00:31 , David Winsemius dwinsem...@comcast.net wrote:

 The goal: 
   to create a function modeled after `subset` (notorious for its non-standard 
 evaluation) that will take a series of logical tests as unqiuoted expressions 
 to be evaluated in the framework of a dataframe environment and return a 
 dataframe of logicals:
...

A belated peep from the author of subset(): Don't!

I think we learned the hard way by now that it is much easier to pass 
unevaluated expressions in the shape of formula objects or maybe expression 
objects. Lots of pain can be avoided by slipping in a simple ~.

-- 
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] Why does debugging print() change output of function?

2014-09-09 Thread David Winsemius


On Sep 9, 2014, at 4:07 PM, peter dalgaard wrote:



On 07 Sep 2014, at 00:31 , David Winsemius dwinsem...@comcast.net  
wrote:



The goal:
to create a function modeled after `subset` (notorious for its non- 
standard evaluation) that will take a series of logical tests as  
unquoted expressions to be evaluated in the framework of a  
dataframe environment and return a dataframe of logicals:

...

A belated peep from the author of subset(): Don't!

I think we learned the hard way by now that it is much easier to  
pass unevaluated expressions in the shape of formula objects or  
maybe expression objects. Lots of pain can be avoided by slipping in  
a simple ~.


It's taken me several years to understand why you are probably correct  
in this regard. I needed to learn that `~` is actually a function that  
creates a language object.


 is.function(`~`)
[1] TRUE
 is.language( ~ x  5  x  10)
[1] TRUE

... and that it's rather easy to extract the object somewhat like but  
not really an expression embedded in such an object:


 is.expression( ~ x  5  x  10)
[1] FALSE

 is.call( (~ x  5  x  10)[2] )
[1] TRUE

The task of learning the various types of language objects is not an  
easy one.


--

David Winsemius, MD
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] multi-threading

2014-09-09 Thread Yuan Luo
Hi,
I am merging large data frames and it would be great if I can run merge in
multi-threading/parallel mode. Can someone point me to the right way to do
it?

Best,
Yuan

[[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] problema con los cambios de marcas temporales en el eje X

2014-09-09 Thread daniel
Espero ahora haber interpretado mejor lo que pretendes:

library(zoo)
datIn - read.csv2(D:/L01359/Mis documentos/Downloads/Libro1.csv)
datIn - zoo(datIn[,-1], order.by=as.Date(datIn$fecha, format=%d/%m/%y))
ticks - seq(as.Date(2013-07-01), length=11, by=1 month) - 1 # genero
una secuencia de fines de més
plot (datIn$xbar, ylim=c(400,660),  type=b, pch=19,cex=1, xaxt = n )
# con xaxt = n elimino los labels originales del eje x
axis(1, at=ticks, labels = format(ticks, %b-%y), cex.axis=0.7)  # doy los
nuevos valores de los ticks con su formato y un tamaño que permita en la
mayoría de los casos ver todos los meses
box()
arrows( x0=index(datIn),y0=datIn$lci
   ,x1=index(datIn),y1=datIn$lcs
   ,angle=90,code=3,length=.1 )

Saludos,

Daniel Merino


El 8 de septiembre de 2014, 17:29, daniel daniel...@gmail.com escribió:

 Disculpas por ingresar tarde en este debate. Si te entiendo bien mi
 solución sería usar el paquete zoo:

 library(zoo)
 datIn - read.csv2(Libro1.csv)
 datIn - zoo(datIn[,-1], order.by=as.Date(datIn$fecha, format=%d/%m/%y))
 plot (datIn$xbar ,ylim=c(400,660),  type=b, pch=19,cex=1)
 axis(2)
 box()
 arrows( x0=index(datIn),y0=datIn$lci
,x1=index(datIn),y1=datIn$lcs
,angle=90,code=3,length=.1 )

 Suerte,

 Daniel Merino





 El 8 de septiembre de 2014, 16:12, Carlos Fernández-Delgado 
 ba1fe...@uco.es escribió:

 Hola de nuevo, acabo de encontrar la solución. He creado una variable
 ficticia con los días 1 de cada mes en la secuencia temporal que quería y
 después he actuado de la siguiente manera

 attach(Libro1)
 plot (xbar~as.Date(fecha,%d/%m/%y), type=b, pch=19,cex=2,xaxt=n)
 xlabels-strptime(ofeje, format = %d/%m/%y)
 axis.Date(1, at=xlabels[xlabels$mday==1], format=%b-%y)


 El resultado se plasma en la grafica adjunta, por si alguien está
 interesado también envío la base de datos con la variable ficticia. Muchas
 gracias y disculpas por las molestias.
 Un cordial saludo.
 Carlos


 El 08/09/2014, a las 00:05, Carlos Ortega c...@qualityexcellence.es
 escribió:

 Hola,

 Una forma de hacerlo es:
 1. incluyes un parámetro en plot(..., axes=F) y así indicas que no
 quieres pintar automáticamente los ejes.
 2. Y ahora construyes el eje x con la función axis().
 3. Dentro de axis(), dirás cada cuánto quieres pintar una marca
 (parámetro at) y qué quieres incluir en la marca (parámetro label).

 Para ver un ejemplo, mira el ejemplo que aparece en la ayuda de la
 función axis().

 Saludos,
 Carlos Ortega
 www.qualityexcellence.es


 El 7 de septiembre de 2014, 20:46, Carlos Fernández-Delgado 
 ba1fe...@uco.es escribió:

 Estimada Comunidad, solicito vuestra ayuda en un tema quizás un poco
 tonto, pero no logro dar con la tecla.
 Estoy intentando hacer una gráfica de la evolución temporal de una
 variable (xbar) a lo largo del tiempo.
 La secuencia que he hecho es la siguiente:
 attach(Libro1)
 plot (xbar~as.Date(fechas,%d/%m/%y), ylim=c(400,650), type=b,
 pch=19,cex=1)

 arrows(x0=as.Date(fechas,%d/%m/%y),y0=lci,x1=as.Date(fechas,%d/%m/%y),y1=lcs,angle=90,code=3,length=.1)

 El problema es que la gráfica emitida por R me saca en abscisas una
 serie de meses que me los coloca por defecto (ver gráfica adjunta) y lo que
 yo quiero es poner marcas mensuales desde agosto de 2013 hasta mayo 2014,
 incluido el cambio de año (ya sea dic’13 o ene’14), pero por mucho que lo
 intento no me sale.

 ¿Podéis ayudarme?.
 Muchas gracias por adelantado y un cordial saludo

 Carlos









 ___
 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



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




 --
 Daniel




-- 
Daniel

[[alternative HTML version deleted]]

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