Re: [R] For loop with multiple iteration indexes

2018-09-10 Thread David Disabato
Thank you everyone. After thinking about each response, I realized a fairly
simple solution is available (obviously, other suggested approaches work as
well):

stopifnot(length(x) == length(y); stopifnot(length(x) > 0)
r <- list()
for (i in 1:length(x) ) {
   r[[i]] <- cor(x = dat[, x[i] ], y = dat[, y[i] ])
}
print(r)

On Mon, Sep 10, 2018 at 11:30 AM Berry, Charles  wrote:

> I have a sense of deja vu:
>
> https://www.mail-archive.com/r-help@r-project.org/msg250494.html
>
> There is some good advice there.
>
> > On Sep 9, 2018, at 3:49 PM, David Disabato  wrote:
> >
> > Hi R-help,
> >
> > I am trying to create a for loop with multiple iteration indexes. I don't
> > want to use two different for loops nested together because I don't need
> > the full matrix of the two indexes, just the diagonal elements (e.g.,
> i[1]
> > & j[1] and i[2] & j[2], but not i[1] & j[2]). Is there a way to specify
> > both i and j in a single for loop? Here is a simplified example of
> > pseudo-code where x and y are equally sized character vectors with column
> > names and dat is their dataframe (obviously this code doesn't run in R,
> but
> > hopefully you perceive my goal):
> >
> > r <- list()
> > n <- 0
> > for (i in x; j in y) {
> >   n <- n + 1
> >   r[[n]] <- cor(x = dat[, i], y = dat[, j])
> > }
> > print(r)
> >
> > I realize there are other solutions to this particular correlation
> example,
> > but my actual problem is much more complicated, so I am hoping for a
> > solution that generalizes across any code within the for loop.
>
> A more aRtful way (than a for loop) to approach this is with mapply:
>
>
> i <- head(colnames(mtcars))
> j <- tail(colnames(mtcars))
>
> r <- mapply(function(i, j, dat) cor( x = dat[, i], y = dat[, j]),
>i=i , j=j , MoreArgs = list( dat = mtcars),
>SIMPLIFY = FALSE, USE.NAMES = FALSE)
>
>
> and if you want, maybe USE.NAMES = paste(i, j, sep="_")
>
> Chuck
>
>

-- 
David J. Disabato, M.A.
Clinical Psychology Doctoral Student
George Mason University
ddisa...@gmu.edu

Email is not a secure form of communication as information and
confidentiality cannot be guaranteed. Information provided in an email is
not intended to be a professional service. In the case of a crisis or
emergency situation, call 911.

[[alternative HTML version deleted]]

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


Re: [R] Why can't I make use of tcltk in this installation?

2018-09-10 Thread p_connolly

Hello Albrecht.

I didn't specify those paths on the 3 machines that have tcltk 
available.  It appears that those files are not on the machine in 
question and that is the reason for my problem.  But if they are, 
./configure finds them itself.


I'm not at the machine that has the issue, but I assume that since I get 
this on a machine that does work:



dpkg -S tkConfig.sh

tk8.6-dev:amd64: /usr/lib/x86_64-linux-gnu/tk8.6/tkConfig.sh
tk8.6-dev:amd64: /usr/lib/tk8.6/tkConfig.sh
tk-dev:amd64: /usr/lib/x86_64-linux-gnu/tkConfig.sh
tk-dev:amd64: /usr/lib/tkConfig.sh

I need to install those two packages (and the corresponding ones for 
tcl) and reinstall R.


Thanks for the pointer, and thank you pd for drawing my attention to the 
fact that Tcl and Tk need to be done separately.





On 2018-09-10 22:37, Albrecht Kauffmann wrote:

Hi Patrick,

did you give the compiler path instructions to tclConfig.sh and 
tkConfig.sh , as


../R-3.5.1/configure  --with-tcl-config=/usr/lib64/tclConfig.sh
--with-tk-config=/usr/lib64/tkConfig.sh

?

Best,
Albrecht

--
  Albrecht Kauffmann
  alkau...@fastmail.fm

Am Mo, 10. Sep 2018, um 10:54, schrieb Patrick Connolly:

> sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.5 LTS

Matrix products: default
BLAS: /home/pat/local/R-3.5.0/lib/libRblas.so
LAPACK: /home/pat/local/R-3.5.0/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_NZ.UTF-8   LC_NUMERIC=C
 [3] LC_TIME=en_NZ.UTF-8LC_COLLATE=en_NZ.UTF-8
 [5] LC_MONETARY=en_NZ.UTF-8LC_MESSAGES=en_NZ.UTF-8
 [7] LC_PAPER=en_NZ.UTF-8   LC_NAME=C
 [9] LC_ADDRESS=C   LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_NZ.UTF-8 LC_IDENTIFICATION=C

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

other attached packages:
[1] lattice_0.20-35

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.17 dplyr_0.7.6  assertthat_0.2.0 grid_3.5.0
 [5] R6_2.2.2 magrittr_1.5 pillar_1.2.3 rlang_0.2.1
 [9] bindrcpp_0.2.2   tools_3.5.0  glue_1.2.0   purrr_0.2.5
[13] compiler_3.5.0   pkgconfig_2.0.1  bindr_0.1.1  
tidyselect_0.2.4

[17] tibble_1.4.2
> capabilities()
   jpeg pngtiff   tcltk X11
aqua
   TRUETRUETRUE   FALSETRUE   
FALSE
   http/ftp sockets  libxmlfifo  cledit   
iconv
   TRUETRUETRUETRUE   FALSE
TRUE
NLS profmem   cairo ICU long.double 
libcurl
   TRUE   FALSETRUETRUETRUE
TRUE

>

If I try to load tcltk, no surprise...

> require(tcltk)
Loading required package: tcltk
Error: package or namespace load failed for ‘tcltk’:
 .onLoad failed in loadNamespace() for 'tcltk', details:
  call: fun(libname, pkgname)
  error: Tcl/Tk support is not available on this system
Warning message:
S3 methods ‘as.character.tclObj’, ‘as.character.tclVar’,
‘as.double.tclObj’, ‘as.integer.tclObj’, ‘as.logical.tclObj’,
‘as.raw.tclObj’, ‘print.tclObj’, ‘[[.tclArray’, ‘[[<-.tclArray’,
‘$.tclArray’, ‘$<-.tclArray’, ‘names.tclArray’, ‘names<-.tclArray’,
‘length.tclArray’, ‘length<-.tclArray’, ‘tclObj.tclVar’,
‘tclObj<-.tclVar’, ‘tclvalue.default’, ‘tclvalue.tclObj’,
‘tclvalue.tclVar’, ‘tclvalue<-.default’, ‘tclvalue<-.tclVar’,
‘close.tkProgressBar’ were declared in NAMESPACE but not found
>

The question is:  What do I have to do to get Tcl/Tk support?
From the bash prompt:
 > aptitude search tcltk
p   hfsutils-tcltk - Tcl/Tk interfaces for reading and
writing Macintosh volumes
p   hfsutils-tcltk:i386- Tcl/Tk interfaces for reading and
writing Macintosh volumes
p   libtcltk-ruby  - Tcl/Tk interface for Ruby
p   libtcltk-ruby1.9.1 - Tcl/Tk interface for Ruby 1.9.1
p   libtcltk-ruby1.9.1:i386- Tcl/Tk interface for Ruby 1.9.1
p   r-cran-tcltk2  - GNU R package for Tcl/Tk additions
p   ruby2.0-tcltk  - Ruby/Tk for Ruby 2.0
p   ruby2.0-tcltk:i386 - Ruby/Tk for Ruby 2.0

That's the same as what I get on another computer on which tcktl is
available, so it didn't surprise me when installing the r-cran-tcktl
package didn't help.

Where else should I be looking for a difference?

TIA


--
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
   ___Patrick Connolly
 {~._.~}   Great minds discuss ideas
 _( Y )_ Average minds discuss events
(:_~*~_:)  Small minds discuss people
 (_)-(_)  . Eleanor Roosevelt

~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.

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

and provide commented, minimal, 

Re: [R] Packaged exe and Shiny

2018-09-10 Thread Jeff Newmiller
IMO the best short answer is don't target making an install package or msi at 
all... the obstacles are quite significant. Aim for building most of your 
capabilities in packages and having people install them. You can setup an 
in-house package repo to simplify this and give them a startup script that 
configures their R environment.

There is also the option to use R-Portable [1] but this leads to massive 
deployment files that don't upgrade easily.

I also think that when the time crunch happens many people will go to the 
internet and copy-paste solutions that you would be unlikely to have 
anticipated. Closing off that scary console completely will keep you in the hot 
seat indefinitely, whereas giving them the option to go around your UI lets 
more resources be allocated later.

[1] https://www.r-bloggers.com/deploying-desktop-apps-with-r/amp/

On September 10, 2018 3:17:02 PM PDT, Jim Lemon  wrote:
>Hi Kevin,
>It might be just as easy to write R scripts that would do basic
>analyses. Users could "source" these scripts in an R session or from
>the command line. The scripts would be much more compact than the .exe
>files that you describe.
>
>Jim
>
>On Tue, Sep 11, 2018 at 8:06 AM Kevin Kowitski via R-help
> wrote:
>>
>> Hey Everyone,
>>
>>   I do not know if this topic has been covered, I'm sure it must
>have, but is there a good environment for packaging R code into a
>distributed exe. (which includes all of the required libraries, etc.)? 
>I have seen that Shiny is a good GUI / Web library for sharing R
>programs, but I have never used it.
>>
>> What is the groups input on this?
>>
>> My goal is to create some basic tools (with interfaces) at work for
>analyzing .csv files and generating basic graphs and output csv files.
>These tools would be distributed to team members to have on their
>desktops.   I considered doing this in Java, but I am more well versed
>in R so it would be quicker for me to whip up the varying tools in R
>than re-learning Java.
>>
>> Thank you!
>>
>> -Kevin
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>__
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

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

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


Re: [R] Packaged exe and Shiny

2018-09-10 Thread Jim Lemon
Hi Kevin,
It might be just as easy to write R scripts that would do basic
analyses. Users could "source" these scripts in an R session or from
the command line. The scripts would be much more compact than the .exe
files that you describe.

Jim

On Tue, Sep 11, 2018 at 8:06 AM Kevin Kowitski via R-help
 wrote:
>
> Hey Everyone,
>
>   I do not know if this topic has been covered, I'm sure it must have, but is 
> there a good environment for packaging R code into a distributed exe. (which 
> includes all of the required libraries, etc.)?  I have seen that Shiny is a 
> good GUI / Web library for sharing R programs, but I have never used it.
>
> What is the groups input on this?
>
> My goal is to create some basic tools (with interfaces) at work for analyzing 
> .csv files and generating basic graphs and output csv files. These tools 
> would be distributed to team members to have on their desktops.   I 
> considered doing this in Java, but I am more well versed in R so it would be 
> quicker for me to whip up the varying tools in R than re-learning Java.
>
> Thank you!
>
> -Kevin
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


[R] Packaged exe and Shiny

2018-09-10 Thread Kevin Kowitski via R-help

Hey Everyone, 

  I do not know if this topic has been covered, I'm sure it must have, but is 
there a good environment for packaging R code into a distributed exe. (which 
includes all of the required libraries, etc.)?  I have seen that Shiny is a 
good GUI / Web library for sharing R programs, but I have never used it. 

What is the groups input on this?  

My goal is to create some basic tools (with interfaces) at work for analyzing 
.csv files and generating basic graphs and output csv files. These tools would 
be distributed to team members to have on their desktops.   I considered doing 
this in Java, but I am more well versed in R so it would be quicker for me to 
whip up the varying tools in R than re-learning Java. 

Thank you!

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


Re: [R] For loop with multiple iteration indexes

2018-09-10 Thread Berry, Charles
I have a sense of deja vu:

https://www.mail-archive.com/r-help@r-project.org/msg250494.html

There is some good advice there.

> On Sep 9, 2018, at 3:49 PM, David Disabato  wrote:
> 
> Hi R-help,
> 
> I am trying to create a for loop with multiple iteration indexes. I don't
> want to use two different for loops nested together because I don't need
> the full matrix of the two indexes, just the diagonal elements (e.g., i[1]
> & j[1] and i[2] & j[2], but not i[1] & j[2]). Is there a way to specify
> both i and j in a single for loop? Here is a simplified example of
> pseudo-code where x and y are equally sized character vectors with column
> names and dat is their dataframe (obviously this code doesn't run in R, but
> hopefully you perceive my goal):
> 
> r <- list()
> n <- 0
> for (i in x; j in y) {
>   n <- n + 1
>   r[[n]] <- cor(x = dat[, i], y = dat[, j])
> }
> print(r)
> 
> I realize there are other solutions to this particular correlation example,
> but my actual problem is much more complicated, so I am hoping for a
> solution that generalizes across any code within the for loop.

A more aRtful way (than a for loop) to approach this is with mapply:


i <- head(colnames(mtcars))
j <- tail(colnames(mtcars))

r <- mapply(function(i, j, dat) cor( x = dat[, i], y = dat[, j]),
   i=i , j=j , MoreArgs = list( dat = mtcars), 
   SIMPLIFY = FALSE, USE.NAMES = FALSE)


and if you want, maybe USE.NAMES = paste(i, j, sep="_")

Chuck

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


Re: [R] Why can't I make use of tcltk in this installation?

2018-09-10 Thread peter dalgaard
You may need to consult the R-sig-debian list, rather than R-help.

Offhand, I would expect that you need Tcl libraries, Tk libraries and the 
associated -devel or -dev packages. Notice that although they are designed to 
work together, Tcl and Tk are two separate entities, so searching for tcltk may 
not suffice.

-pd

> On 10 Sep 2018, at 12:37 , Albrecht Kauffmann  wrote:
> 
> Hi Patrick,
> 
> did you give the compiler path instructions to tclConfig.sh and tkConfig.sh , 
> as
> 
> ../R-3.5.1/configure  --with-tcl-config=/usr/lib64/tclConfig.sh 
> --with-tk-config=/usr/lib64/tkConfig.sh
> 
> ?
> 
> Best,
> Albrecht
> 
> -- 
>  Albrecht Kauffmann
>  alkau...@fastmail.fm
> 
> Am Mo, 10. Sep 2018, um 10:54, schrieb Patrick Connolly:
>>> sessionInfo()
>> R version 3.5.0 (2018-04-23)
>> Platform: x86_64-pc-linux-gnu (64-bit)
>> Running under: Ubuntu 14.04.5 LTS
>> 
>> Matrix products: default
>> BLAS: /home/pat/local/R-3.5.0/lib/libRblas.so
>> LAPACK: /home/pat/local/R-3.5.0/lib/libRlapack.so
>> 
>> locale:
>> [1] LC_CTYPE=en_NZ.UTF-8   LC_NUMERIC=C  
>> [3] LC_TIME=en_NZ.UTF-8LC_COLLATE=en_NZ.UTF-8
>> [5] LC_MONETARY=en_NZ.UTF-8LC_MESSAGES=en_NZ.UTF-8   
>> [7] LC_PAPER=en_NZ.UTF-8   LC_NAME=C 
>> [9] LC_ADDRESS=C   LC_TELEPHONE=C
>> [11] LC_MEASUREMENT=en_NZ.UTF-8 LC_IDENTIFICATION=C   
>> 
>> attached base packages:
>> [1] utils stats grDevices graphics  methods   base 
>> 
>> other attached packages:
>> [1] lattice_0.20-35
>> 
>> loaded via a namespace (and not attached):
>> [1] Rcpp_0.12.17 dplyr_0.7.6  assertthat_0.2.0 grid_3.5.0  
>> [5] R6_2.2.2 magrittr_1.5 pillar_1.2.3 rlang_0.2.1 
>> [9] bindrcpp_0.2.2   tools_3.5.0  glue_1.2.0   purrr_0.2.5 
>> [13] compiler_3.5.0   pkgconfig_2.0.1  bindr_0.1.1  tidyselect_0.2.4
>> [17] tibble_1.4.2
>>> capabilities()
>>   jpeg pngtiff   tcltk X11aqua 
>>   TRUETRUETRUE   FALSETRUE   FALSE 
>>   http/ftp sockets  libxmlfifo  cledit   iconv 
>>   TRUETRUETRUETRUE   FALSETRUE 
>>NLS profmem   cairo ICU long.double libcurl 
>>   TRUE   FALSETRUETRUETRUETRUE 
>>> 
>> 
>> If I try to load tcltk, no surprise...
>> 
>>> require(tcltk)
>> Loading required package: tcltk
>> Error: package or namespace load failed for ‘tcltk’:
>> .onLoad failed in loadNamespace() for 'tcltk', details:
>>  call: fun(libname, pkgname)
>>  error: Tcl/Tk support is not available on this system
>> Warning message:
>> S3 methods ‘as.character.tclObj’, ‘as.character.tclVar’, 
>> ‘as.double.tclObj’, ‘as.integer.tclObj’, ‘as.logical.tclObj’, 
>> ‘as.raw.tclObj’, ‘print.tclObj’, ‘[[.tclArray’, ‘[[<-.tclArray’, 
>> ‘$.tclArray’, ‘$<-.tclArray’, ‘names.tclArray’, ‘names<-.tclArray’, 
>> ‘length.tclArray’, ‘length<-.tclArray’, ‘tclObj.tclVar’, 
>> ‘tclObj<-.tclVar’, ‘tclvalue.default’, ‘tclvalue.tclObj’, 
>> ‘tclvalue.tclVar’, ‘tclvalue<-.default’, ‘tclvalue<-.tclVar’, 
>> ‘close.tkProgressBar’ were declared in NAMESPACE but not found 
>>> 
>> 
>> The question is:  What do I have to do to get Tcl/Tk support?
>> From the bash prompt:
>>> aptitude search tcltk
>> p   hfsutils-tcltk - Tcl/Tk interfaces for reading and 
>> writing Macintosh volumes 
>> p   hfsutils-tcltk:i386- Tcl/Tk interfaces for reading and 
>> writing Macintosh volumes 
>> p   libtcltk-ruby  - Tcl/Tk interface for Ruby   
>> p   libtcltk-ruby1.9.1 - Tcl/Tk interface for Ruby 1.9.1
>> p   libtcltk-ruby1.9.1:i386- Tcl/Tk interface for Ruby 1.9.1
>> p   r-cran-tcltk2  - GNU R package for Tcl/Tk additions 
>> p   ruby2.0-tcltk  - Ruby/Tk for Ruby 2.0
>> p   ruby2.0-tcltk:i386 - Ruby/Tk for Ruby 2.0  
>> 
>> That's the same as what I get on another computer on which tcktl is
>> available, so it didn't surprise me when installing the r-cran-tcktl
>> package didn't help.
>> 
>> Where else should I be looking for a difference?
>> 
>> TIA
>> 
>> 
>> -- 
>> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.   
>>   ___Patrick Connolly   
>> {~._.~}   Great minds discuss ideas
>> _( Y )_   Average minds discuss events 
>> (:_~*~_:)  Small minds discuss people  
>> (_)-(_). Eleanor Roosevelt
>>
>> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
>> 
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
> 
> 

Re: [R] Why can't I make use of tcltk in this installation?

2018-09-10 Thread Albrecht Kauffmann
Hi Patrick,

did you give the compiler path instructions to tclConfig.sh and tkConfig.sh , as

../R-3.5.1/configure  --with-tcl-config=/usr/lib64/tclConfig.sh 
--with-tk-config=/usr/lib64/tkConfig.sh

?

Best,
Albrecht

-- 
  Albrecht Kauffmann
  alkau...@fastmail.fm

Am Mo, 10. Sep 2018, um 10:54, schrieb Patrick Connolly:
> > sessionInfo()
> R version 3.5.0 (2018-04-23)
> Platform: x86_64-pc-linux-gnu (64-bit)
> Running under: Ubuntu 14.04.5 LTS
> 
> Matrix products: default
> BLAS: /home/pat/local/R-3.5.0/lib/libRblas.so
> LAPACK: /home/pat/local/R-3.5.0/lib/libRlapack.so
> 
> locale:
>  [1] LC_CTYPE=en_NZ.UTF-8   LC_NUMERIC=C  
>  [3] LC_TIME=en_NZ.UTF-8LC_COLLATE=en_NZ.UTF-8
>  [5] LC_MONETARY=en_NZ.UTF-8LC_MESSAGES=en_NZ.UTF-8   
>  [7] LC_PAPER=en_NZ.UTF-8   LC_NAME=C 
>  [9] LC_ADDRESS=C   LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_NZ.UTF-8 LC_IDENTIFICATION=C   
> 
> attached base packages:
> [1] utils stats grDevices graphics  methods   base 
> 
> other attached packages:
> [1] lattice_0.20-35
> 
> loaded via a namespace (and not attached):
>  [1] Rcpp_0.12.17 dplyr_0.7.6  assertthat_0.2.0 grid_3.5.0  
>  [5] R6_2.2.2 magrittr_1.5 pillar_1.2.3 rlang_0.2.1 
>  [9] bindrcpp_0.2.2   tools_3.5.0  glue_1.2.0   purrr_0.2.5 
> [13] compiler_3.5.0   pkgconfig_2.0.1  bindr_0.1.1  tidyselect_0.2.4
> [17] tibble_1.4.2
> > capabilities()
>jpeg pngtiff   tcltk X11aqua 
>TRUETRUETRUE   FALSETRUE   FALSE 
>http/ftp sockets  libxmlfifo  cledit   iconv 
>TRUETRUETRUETRUE   FALSETRUE 
> NLS profmem   cairo ICU long.double libcurl 
>TRUE   FALSETRUETRUETRUETRUE 
> > 
> 
> If I try to load tcltk, no surprise...
> 
> > require(tcltk)
> Loading required package: tcltk
> Error: package or namespace load failed for ‘tcltk’:
>  .onLoad failed in loadNamespace() for 'tcltk', details:
>   call: fun(libname, pkgname)
>   error: Tcl/Tk support is not available on this system
> Warning message:
> S3 methods ‘as.character.tclObj’, ‘as.character.tclVar’, 
> ‘as.double.tclObj’, ‘as.integer.tclObj’, ‘as.logical.tclObj’, 
> ‘as.raw.tclObj’, ‘print.tclObj’, ‘[[.tclArray’, ‘[[<-.tclArray’, 
> ‘$.tclArray’, ‘$<-.tclArray’, ‘names.tclArray’, ‘names<-.tclArray’, 
> ‘length.tclArray’, ‘length<-.tclArray’, ‘tclObj.tclVar’, 
> ‘tclObj<-.tclVar’, ‘tclvalue.default’, ‘tclvalue.tclObj’, 
> ‘tclvalue.tclVar’, ‘tclvalue<-.default’, ‘tclvalue<-.tclVar’, 
> ‘close.tkProgressBar’ were declared in NAMESPACE but not found 
> > 
> 
> The question is:  What do I have to do to get Tcl/Tk support?
> From the bash prompt:
>  > aptitude search tcltk
> p   hfsutils-tcltk - Tcl/Tk interfaces for reading and 
> writing Macintosh volumes 
> p   hfsutils-tcltk:i386- Tcl/Tk interfaces for reading and 
> writing Macintosh volumes 
> p   libtcltk-ruby  - Tcl/Tk interface for Ruby   
> p   libtcltk-ruby1.9.1 - Tcl/Tk interface for Ruby 1.9.1
> p   libtcltk-ruby1.9.1:i386- Tcl/Tk interface for Ruby 1.9.1
> p   r-cran-tcltk2  - GNU R package for Tcl/Tk additions 
> p   ruby2.0-tcltk  - Ruby/Tk for Ruby 2.0
> p   ruby2.0-tcltk:i386 - Ruby/Tk for Ruby 2.0  
> 
> That's the same as what I get on another computer on which tcktl is
> available, so it didn't surprise me when installing the r-cran-tcktl
> package didn't help.
> 
> Where else should I be looking for a difference?
> 
> TIA
> 
> 
> -- 
> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.   
>___Patrick Connolly   
>  {~._.~}   Great minds discuss ideas
>  _( Y )_   Average minds discuss events 
> (:_~*~_:)  Small minds discuss people  
>  (_)-(_). Eleanor Roosevelt
> 
> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


[R] Why can't I make use of tcltk in this installation?

2018-09-10 Thread Patrick Connolly
> sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.5 LTS

Matrix products: default
BLAS: /home/pat/local/R-3.5.0/lib/libRblas.so
LAPACK: /home/pat/local/R-3.5.0/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_NZ.UTF-8   LC_NUMERIC=C  
 [3] LC_TIME=en_NZ.UTF-8LC_COLLATE=en_NZ.UTF-8
 [5] LC_MONETARY=en_NZ.UTF-8LC_MESSAGES=en_NZ.UTF-8   
 [7] LC_PAPER=en_NZ.UTF-8   LC_NAME=C 
 [9] LC_ADDRESS=C   LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_NZ.UTF-8 LC_IDENTIFICATION=C   

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

other attached packages:
[1] lattice_0.20-35

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.17 dplyr_0.7.6  assertthat_0.2.0 grid_3.5.0  
 [5] R6_2.2.2 magrittr_1.5 pillar_1.2.3 rlang_0.2.1 
 [9] bindrcpp_0.2.2   tools_3.5.0  glue_1.2.0   purrr_0.2.5 
[13] compiler_3.5.0   pkgconfig_2.0.1  bindr_0.1.1  tidyselect_0.2.4
[17] tibble_1.4.2
> capabilities()
   jpeg pngtiff   tcltk X11aqua 
   TRUETRUETRUE   FALSETRUE   FALSE 
   http/ftp sockets  libxmlfifo  cledit   iconv 
   TRUETRUETRUETRUE   FALSETRUE 
NLS profmem   cairo ICU long.double libcurl 
   TRUE   FALSETRUETRUETRUETRUE 
> 

If I try to load tcltk, no surprise...

> require(tcltk)
Loading required package: tcltk
Error: package or namespace load failed for ‘tcltk’:
 .onLoad failed in loadNamespace() for 'tcltk', details:
  call: fun(libname, pkgname)
  error: Tcl/Tk support is not available on this system
Warning message:
S3 methods ‘as.character.tclObj’, ‘as.character.tclVar’, ‘as.double.tclObj’, 
‘as.integer.tclObj’, ‘as.logical.tclObj’, ‘as.raw.tclObj’, ‘print.tclObj’, 
‘[[.tclArray’, ‘[[<-.tclArray’, ‘$.tclArray’, ‘$<-.tclArray’, ‘names.tclArray’, 
‘names<-.tclArray’, ‘length.tclArray’, ‘length<-.tclArray’, ‘tclObj.tclVar’, 
‘tclObj<-.tclVar’, ‘tclvalue.default’, ‘tclvalue.tclObj’, ‘tclvalue.tclVar’, 
‘tclvalue<-.default’, ‘tclvalue<-.tclVar’, ‘close.tkProgressBar’ were declared 
in NAMESPACE but not found 
> 

The question is:  What do I have to do to get Tcl/Tk support?
>From the bash prompt:
 > aptitude search tcltk
p   hfsutils-tcltk - Tcl/Tk interfaces for reading and writing 
Macintosh volumes 
p   hfsutils-tcltk:i386- Tcl/Tk interfaces for reading and writing 
Macintosh volumes 
p   libtcltk-ruby  - Tcl/Tk interface for Ruby   
p   libtcltk-ruby1.9.1 - Tcl/Tk interface for Ruby 1.9.1
p   libtcltk-ruby1.9.1:i386- Tcl/Tk interface for Ruby 1.9.1
p   r-cran-tcltk2  - GNU R package for Tcl/Tk additions 
p   ruby2.0-tcltk  - Ruby/Tk for Ruby 2.0
p   ruby2.0-tcltk:i386 - Ruby/Tk for Ruby 2.0  

That's the same as what I get on another computer on which tcktl is
available, so it didn't surprise me when installing the r-cran-tcktl
package didn't help.

Where else should I be looking for a difference?

TIA


-- 
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.   
   ___Patrick Connolly   
 {~._.~}   Great minds discuss ideas
 _( Y )_ Average minds discuss events 
(:_~*~_:)  Small minds discuss people  
 (_)-(_)  . Eleanor Roosevelt
  
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.

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


[R] real time monitoring of streaming audio with R?

2018-09-10 Thread Spencer Graves

Hello, All:


  Is it feasible to do real time monitoring of streaming audio with 
R, writing a compressed copy of what's read to 1-hour long MP3 files?



  I'm a volunteer with a community radio station (kkfi.org).  My 
minimum requirements at the moment are to create MP3 files from what we 
broadcast.  I have a tuner hooked to the audio input of a computer.  I 
can listen to it in real time using the computer audio output jack, and 
I can record it manually using Audacity.  If I have MP3 versions of both 
what we send to the tower and what is actually broadcasted, I can read 
the two into R, compare them, identify substantive differences, write 
appropriate descriptions to files, send emails, etc.  I don't know how 
to sample the live stream.



   I know it can be done in Python, but I don't know how, and I'd 
prefer to use R.  I suspect it can be done with ffplay, part of ffmpeg, 
but again I don't know how.



  Thanks,
  Spencer Graves

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


Re: [R] For loop with multiple iteration indexes

2018-09-10 Thread Albrecht Kauffmann
Hi,

this simple example is very similarly, and it works in R:

r <- list()
n <- 0
x <- c("a","b","c")#x,y: Data from a dataframe
y <- c("A","B","C")
for (k in 1:3) {
n <- n+1
r[[n]] <- paste0(x[k],y[k])#or any other function using x[k] and y[k] as 
arguments
}
print(r)

Is it this what you meant?

Best,
Albrecht

-- 
  Albrecht Kauffmann
  alkau...@fastmail.fm

Am Mo, 10. Sep 2018, um 00:49, schrieb David Disabato:
> Hi R-help,
> 
> I am trying to create a for loop with multiple iteration indexes. I don't
> want to use two different for loops nested together because I don't need
> the full matrix of the two indexes, just the diagonal elements (e.g., i[1]
> & j[1] and i[2] & j[2], but not i[1] & j[2]). Is there a way to specify
> both i and j in a single for loop? Here is a simplified example of
> pseudo-code where x and y are equally sized character vectors with column
> names and dat is their dataframe (obviously this code doesn't run in R, but
> hopefully you perceive my goal):
> 
> r <- list()
> n <- 0
> for (i in x; j in y) {
>n <- n + 1
>r[[n]] <- cor(x = dat[, i], y = dat[, j])
> }
> print(r)
> 
> I realize there are other solutions to this particular correlation example,
> but my actual problem is much more complicated, so I am hoping for a
> solution that generalizes across any code within the for loop.
> 
> -- 
> David J. Disabato, M.A.
> Clinical Psychology Doctoral Student
> George Mason University
> ddisa...@gmu.edu
> 
> Email is not a secure form of communication as information and
> confidentiality cannot be guaranteed. Information provided in an email is
> not intended to be a professional service. In the case of a crisis or
> emergency situation, call 911.
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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