Re: [R] Opening or activating a URL to access data, alternative to browseURL

2016-10-11 Thread Duncan Murdoch

On 11/10/2016 7:59 AM, Ryan Utz wrote:

Bob/Duncan,

Thanks for writing. I think some of the things Bob mentioned might work,
but I'm still not quite getting there. Below is the example I'm working
with:



It worked for me when I replaced the browseURL call with a readLines 
call, as I suggested the other day.  What went wrong for you?


Duncan Murdoch


#1
browseURL('http://pick18.discoverlife.org/mp/20m?plot=2=Hypoprepia+fucosa=33.9+-83.3=2011,2012,2013=build_txt:
')
# This opens the URL and creates a link to machine-readable data on the
page, which I can then download by simply doing this:

#2
read.delim('http://pick18.discoverlife.org/tmp/Hypoprepia_fucosa_33.9_-83.3_2011,2012,2013.txt
')
#This is what I need to read in terms of data, but this URL only exists
if the URL ran above is activated first

So, for example, try running line #2 without the first line- it won't
work. Next run #1 then #2- works fine.

See what I mean?


On Thu, Sep 29, 2016 at 5:09 PM, Bob Rudis > wrote:

The rvest/httr/curl trio can do the cookie management pretty well.
Make the initial connection via rvest::html_session() and then
hopefully be able to use other rvest function calls, but curl and
httr calls will use the cached in-memory handle info seamlessly.
You'd need to store and retrieve cookies if you need them preserved
between R sessions.

Failing the above and assuming this would not need to be lightning
fast, use the phantomjs or firefox web driver (either with RSelenium
or some new stuff rOpenSci is cooking up) which will then do what
browsers do best and maintain all this state for you. You can still
slurp the page contents up with xml2::read_html() and use the super
handy processing idioms in the scraping tidyverse (it needs it's own
name).

A concrete example (assuming the URLs aren't sensitive) would enable
me or someone else to mock up something for you.


On Thu, Sep 29, 2016 at 4:59 PM, Duncan Murdoch
> wrote:

On 29/09/2016 3:29 PM, Ryan Utz wrote:

Hi all,

I've got a situation that involves activating a URL so that
a link to some
data becomes available for download. I can easily use
'browseURL' to do so,
but I'm hoping to make this batch-process-able, and I would
prefer to not
have 100s of browser windows open when I go to download
multiple data sets.

Here's the example:

#1
browseURL('

http://pick18.discoverlife.org/mp/20m?plot=2=Hypoprepia+fucosa=33.9+-83.3=2011,2012,2013=build_txt

:
')
# This opens the URL and creates a link to machine-readable
data on the
page, which I can then download by simply doing this:

#2
read.delim('

http://pick18.discoverlife.org/tmp/Hypoprepia_fucosa_33.9_-83.3_2011,2012,2013.txt


')

However, I can only get the second line above to work if the
thing in line
#1 has been opened in a browser already. Is there any way to
allow me to
either 1) close the browser after it's been opened or 2)
execute the line
#2 above without having to open a browser? We have hundreds
of species that
you can see after the '=' bit of the URL, so I'm trying
to keep the
browsing situation sane.

Thanks!
R


You'll need to figure out what happens when you open the first
page. Does it set a cookie?  Does it record your IP address?
Does it just build the file but record nothing about you?

If it's one of the simpler versions, you can just read the first
page, wait a bit, then read the second one.

If you need to manage cookies, you'll need something more
complicated. I don't know the easiest way to do that.

Duncan Murdoch


__
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] Documenting a function using roxygen2

2016-10-11 Thread Jeff Newmiller
I was under the impression that the comment block is attached to the global 
object that immediately follows the comment block, so this placement is NOT 
optional.
-- 
Sent from my phone. Please excuse my brevity.

On October 11, 2016 6:46:51 AM PDT, Thierry Onkelinx  
wrote:
>Dear Georg,
>
>My 2 eurocents.
>
>- I'd place the Roxygen header just above the function instead of
>instead
>the function. That makes your function more readable.
>- Use only tags that Roxygen knows about.
>- Use version controle instead of the version, created and updated
>tags.
>- You can specify the author, license and version at the package level.
>devtools and Roxygen make it very easy to create a package. Even if it
>would contain only one or a few functions.
>
>Best regards,
>
>ir. Thierry Onkelinx
>Instituut voor natuur- en bosonderzoek / Research Institute for Nature
>and
>Forest
>team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
>Kliniekstraat 25
>1070 Anderlecht
>Belgium
>
>To call in the statistician after the experiment is done may be no more
>than asking him to perform a post-mortem examination: he may be able to
>say
>what the experiment died of. ~ Sir Ronald Aylmer Fisher
>The plural of anecdote is not data. ~ Roger Brinner
>The combination of some data and an aching desire for an answer does
>not
>ensure that a reasonable answer can be extracted from a given body of
>data.
>~ John Tukey
>
>2016-10-11 13:13 GMT+02:00 :
>
>> Hi All,
>>
>> I began to document my functions using roxygen2. This is an example
>of a
>> function I would like to write for training and testing purposes:
>>
>> t_simple_table <- function(variable,
>>useNA = TRUE,
>>print = FALSE) {
>> #' @title Create a simple table for one variable.
>> #'
>> #' @description t_simple_table() creates absolute and relative
>> #' frequencies, cumulative sums and column sums for both as well
>as
>> #' overall statistics about valid N and missing values.
>> #'
>> #'
>> #' @param variable (vector, list, data.frame): variable the table
>is
>> #' created for.
>> #' @param useNA (logical): flag to include or exclude missing
>values
>> #' from the computation.
>> #' @param print (logical): flag to print/not print a table before
>> #' returning it as an object.
>> #'
>> #' @operation
>> #' Coerces the given variable to a factor.
>> #' If useNA = TRUE NA is also transformed to a valid value,
>> #' if useNA = FALSE it is disregarded in all operations.
>> #'
>> #' @return Returns a table with the following statistics:
>> #'
>> #'  Frequencies   Percent   Cumulative
>> #' Percent
>> #' Valid . .
>> #' Missing   . .
>> #' Total .   100
>> #' Categories
>> #'   Cat 1   . ..
>> #'   Cat 2   . ..
>> #'   Cat 3   . ..
>> #'   ... . .  100
>> #'   Total   .   100
>> #'
>> #' @errorhandling None
>> #'
>> #' @version "0.1"
>> #'
>> #' @created "2016-10-11"
>> #' @updated "2016-10-11"
>> #'
>> #' @status development
>> #'
>> #' @see Manderscheid: Sozialwissenschaftliche Datenanalyse mit R,
>> #' p. 79ff
>> #'
>> #' @author Georg
>> #'
>> #' @license GPL-2
>>
>> # function body to be defined
>>
>> }
>>
>> Is this a correct header for a function?
>>
>> How could I do better?
>>
>> Kind regards
>>
>> Georg
>>
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/
>> posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>   [[alternative HTML version deleted]]
>
>__
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

__
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] Error in reading netcdf files into R

2016-10-11 Thread mamuash bukana
Dear all,
I have installed necessary packages such as ncdf4 and RNetCDF. But
still my machine can't read netcdf files into R. Below are the file
formats and the respective errors:

> open.nc("cru.ts3.23.1901.2014.tmx.dat.nc")
Error: No such file or directory

> open.nc("cru_ts3_23_1901_2014_pre_dat.nc")
Error: NetCDF: Unknown file format


I am using Windows 7 64-bit.


Thanks for your suggestions and comments in advance

Mamuash

__
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] multiple uses ifelse function

2016-10-11 Thread S Ellison


> -Original Message-
> testseq<-seq(1:20)
> testchange<-ifelse(testseq<=4,'x',testseq)
> testchange<-c(ifelse(testseq<=4,'x',testseq),ifelse(testseq>=5,'y',testseq))
> 
> The last instruction causes the vector 'testchange' to change dimensions,

Of course it does. ifelse(test, yes, no) returns a vector of length 
length(test). Your last line concatenates two of them, so you'll get a vector 
of length 40.

You might also want to note that you are replacing numbers with character 
strings, so 
ifelse(testseq<=4,'x',testseq)

will return four 'x's and then - because R has to coerce everything to a single 
type - character representations of numbers 5:20. That will not then respond 
well to subsequent numeric comparisons ...

S Ellison


***
This email and any attachments are confidential. Any use...{{dropped:8}}

__
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] Output formatting in PDF

2016-10-11 Thread Jeff Newmiller
Or package "knitr". Note that knitr can be used with LaTeX or markdown syntax, 
but from your description the former would be advised. 
-- 
Sent from my phone. Please excuse my brevity.

On October 11, 2016 1:59:59 AM PDT, Enrico Schumann  
wrote:
>On Tue, 11 Oct 2016, Preetam Pal  writes:
>
>> Hi,
>>
>> Can you please help me with the following output formatting:
>> I am planning to include 2 plots and some general description in a
>one-page
>> PDF document, such that
>>
>>- I'll leave some appropriate margin on the PDF- say, 1.5 inches
>>top,right, bottom and left (will decide based on overall
>appearance)
>>- the 2 plots are placed side-by-side (looks best for comparison)
>>- the margins for each plot can be 4 lines on the top and the
>bottom &
>> 2 lines on the left and the right
>>- each of these 2 plots would have time (0 to 260) along x-axis
>and two
>>time-series (daily USD-GBP and USD-EUR FX rates) on the y-axis,
>i.e. 2
>>time-series would be plotted on each of the 2 graphs. I would need
>a
>>different color for each plot to demarcate them
>>- I need to add some text (eg: "Independent analysis of Exchange
>Rate
>>dynamics") with reduced font size (not high priority though-just
>good to
>>have a different size)
>>- The general discussion (may be a paragraph) would come right
>below the
>>2 plots - I can specify this text as an argument in a function,
>may be. I
>>am not sure how to arrange the entire PDF as per the format I
>mentioned
>>above
>>
>> I shall really appreciate any help with this - the time series
>analysis is
>> not difficult, I can manage that - however, I don't know how to
>manage the
>> formatting part though, so that the 1-pager output looks decently
>> presentable. Thanks.
>>
>> Regards,
>> Preetam
>
>If using LaTeX is an option, I would suggest
>?Sweave. There are many tutorials on the web that
>should get you started.

__
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] Documenting a function using roxygen2

2016-10-11 Thread Thierry Onkelinx
Dear Georg,

My 2 eurocents.

- I'd place the Roxygen header just above the function instead of instead
the function. That makes your function more readable.
- Use only tags that Roxygen knows about.
- Use version controle instead of the version, created and updated tags.
- You can specify the author, license and version at the package level.
devtools and Roxygen make it very easy to create a package. Even if it
would contain only one or a few functions.

Best regards,

ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to say
what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey

2016-10-11 13:13 GMT+02:00 :

> Hi All,
>
> I began to document my functions using roxygen2. This is an example of a
> function I would like to write for training and testing purposes:
>
> t_simple_table <- function(variable,
>useNA = TRUE,
>print = FALSE) {
> #' @title Create a simple table for one variable.
> #'
> #' @description t_simple_table() creates absolute and relative
> #' frequencies, cumulative sums and column sums for both as well as
> #' overall statistics about valid N and missing values.
> #'
> #'
> #' @param variable (vector, list, data.frame): variable the table is
> #' created for.
> #' @param useNA (logical): flag to include or exclude missing values
> #' from the computation.
> #' @param print (logical): flag to print/not print a table before
> #' returning it as an object.
> #'
> #' @operation
> #' Coerces the given variable to a factor.
> #' If useNA = TRUE NA is also transformed to a valid value,
> #' if useNA = FALSE it is disregarded in all operations.
> #'
> #' @return Returns a table with the following statistics:
> #'
> #'  Frequencies   Percent   Cumulative
> #' Percent
> #' Valid . .
> #' Missing   . .
> #' Total .   100
> #' Categories
> #'   Cat 1   . ..
> #'   Cat 2   . ..
> #'   Cat 3   . ..
> #'   ... . .  100
> #'   Total   .   100
> #'
> #' @errorhandling None
> #'
> #' @version "0.1"
> #'
> #' @created "2016-10-11"
> #' @updated "2016-10-11"
> #'
> #' @status development
> #'
> #' @see Manderscheid: Sozialwissenschaftliche Datenanalyse mit R,
> #' p. 79ff
> #'
> #' @author Georg
> #'
> #' @license GPL-2
>
> # function body to be defined
>
> }
>
> Is this a correct header for a function?
>
> How could I do better?
>
> Kind regards
>
> Georg
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

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


[R] Documenting a function using roxygen2

2016-10-11 Thread G . Maubach
Hi All,

I began to document my functions using roxygen2. This is an example of a 
function I would like to write for training and testing purposes:

t_simple_table <- function(variable,
   useNA = TRUE,
   print = FALSE) {
#' @title Create a simple table for one variable.
#'
#' @description t_simple_table() creates absolute and relative 
#' frequencies, cumulative sums and column sums for both as well as
#' overall statistics about valid N and missing values.
#' 
#' 
#' @param variable (vector, list, data.frame): variable the table is
#' created for.
#' @param useNA (logical): flag to include or exclude missing values
#' from the computation.
#' @param print (logical): flag to print/not print a table before
#' returning it as an object.
#' 
#' @operation
#' Coerces the given variable to a factor.
#' If useNA = TRUE NA is also transformed to a valid value,
#' if useNA = FALSE it is disregarded in all operations.
#' 
#' @return Returns a table with the following statistics:
#' 
#'  Frequencies   Percent   Cumulative
#' Percent
#' Valid . .
#' Missing   . .
#' Total .   100
#' Categories
#'   Cat 1   . ..
#'   Cat 2   . ..
#'   Cat 3   . ..
#'   ... . .  100
#'   Total   .   100
#'
#' @errorhandling None
#' 
#' @version "0.1"
#' 
#' @created "2016-10-11"
#' @updated "2016-10-11"
#' 
#' @status development
#'
#' @see Manderscheid: Sozialwissenschaftliche Datenanalyse mit R, 
#' p. 79ff
#'
#' @author Georg
#'
#' @license GPL-2
 
# function body to be defined

}

Is this a correct header for a function?

How could I do better?

Kind regards

Georg

__
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] Output formatting in PDF

2016-10-11 Thread Preetam Pal
Hey Enrico,
LaTex is not possible actually.

On Tue, Oct 11, 2016 at 2:29 PM, Enrico Schumann 
wrote:

> On Tue, 11 Oct 2016, Preetam Pal  writes:
>
> > Hi,
> >
> > Can you please help me with the following output formatting:
> > I am planning to include 2 plots and some general description in a
> one-page
> > PDF document, such that
> >
> >- I'll leave some appropriate margin on the PDF- say, 1.5 inches
> >top,right, bottom and left (will decide based on overall appearance)
> >- the 2 plots are placed side-by-side (looks best for comparison)
> >- the margins for each plot can be 4 lines on the top and the bottom &
> > 2 lines on the left and the right
> >- each of these 2 plots would have time (0 to 260) along x-axis and
> two
> >time-series (daily USD-GBP and USD-EUR FX rates) on the y-axis, i.e. 2
> >time-series would be plotted on each of the 2 graphs. I would need a
> >different color for each plot to demarcate them
> >- I need to add some text (eg: "Independent analysis of Exchange Rate
> >dynamics") with reduced font size (not high priority though-just good
> to
> >have a different size)
> >- The general discussion (may be a paragraph) would come right below
> the
> >2 plots - I can specify this text as an argument in a function, may
> be. I
> >am not sure how to arrange the entire PDF as per the format I
> mentioned
> >above
> >
> > I shall really appreciate any help with this - the time series analysis
> is
> > not difficult, I can manage that - however, I don't know how to manage
> the
> > formatting part though, so that the 1-pager output looks decently
> > presentable. Thanks.
> >
> > Regards,
> > Preetam
>
> If using LaTeX is an option, I would suggest
> ?Sweave. There are many tutorials on the web that
> should get you started.
>
>
> --
> Enrico Schumann
> Lucerne, Switzerland
> http://enricoschumann.net
>



-- 
Preetam Pal
(+91)-9432212774
M-Stat 2nd Year, Room No. N-114
Statistics Division,   C.V.Raman
Hall
Indian Statistical Institute, B.H.O.S.
Kolkata.

[[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] Output formatting in PDF

2016-10-11 Thread Dominik Schneider
You may be able to do everything you need with the cowplot package.

On Tue, Oct 11, 2016 at 4:26 AM, Preetam Pal  wrote:

> Hey Enrico,
> LaTex is not possible actually.
>
> On Tue, Oct 11, 2016 at 2:29 PM, Enrico Schumann 
> wrote:
>
> > On Tue, 11 Oct 2016, Preetam Pal  writes:
> >
> > > Hi,
> > >
> > > Can you please help me with the following output formatting:
> > > I am planning to include 2 plots and some general description in a
> > one-page
> > > PDF document, such that
> > >
> > >- I'll leave some appropriate margin on the PDF- say, 1.5 inches
> > >top,right, bottom and left (will decide based on overall appearance)
> > >- the 2 plots are placed side-by-side (looks best for comparison)
> > >- the margins for each plot can be 4 lines on the top and the
> bottom &
> > > 2 lines on the left and the right
> > >- each of these 2 plots would have time (0 to 260) along x-axis and
> > two
> > >time-series (daily USD-GBP and USD-EUR FX rates) on the y-axis,
> i.e. 2
> > >time-series would be plotted on each of the 2 graphs. I would need a
> > >different color for each plot to demarcate them
> > >- I need to add some text (eg: "Independent analysis of Exchange
> Rate
> > >dynamics") with reduced font size (not high priority though-just
> good
> > to
> > >have a different size)
> > >- The general discussion (may be a paragraph) would come right below
> > the
> > >2 plots - I can specify this text as an argument in a function, may
> > be. I
> > >am not sure how to arrange the entire PDF as per the format I
> > mentioned
> > >above
> > >
> > > I shall really appreciate any help with this - the time series analysis
> > is
> > > not difficult, I can manage that - however, I don't know how to manage
> > the
> > > formatting part though, so that the 1-pager output looks decently
> > > presentable. Thanks.
> > >
> > > Regards,
> > > Preetam
> >
> > If using LaTeX is an option, I would suggest
> > ?Sweave. There are many tutorials on the web that
> > should get you started.
> >
> >
> > --
> > Enrico Schumann
> > Lucerne, Switzerland
> > http://enricoschumann.net
> >
>
>
>
> --
> Preetam Pal
> (+91)-9432212774
> M-Stat 2nd Year, Room No. N-114
> Statistics Division,   C.V.Raman
> Hall
> Indian Statistical Institute, B.H.O.S.
> Kolkata.
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

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


Re: [R] Opening or activating a URL to access data, alternative to browseURL

2016-10-11 Thread Ryan Utz
Bob/Duncan,

Thanks for writing. I think some of the things Bob mentioned might work,
but I'm still not quite getting there. Below is the example I'm working
with:

#1
browseURL('http://pick18.discoverlife.org/mp/20m?plot=
2=Hypoprepia+fucosa=33.9+-83.3=2011,2012,
2013=build_txt:')
# This opens the URL and creates a link to machine-readable data on the
page, which I can then download by simply doing this:

#2
read.delim('http://pick18.discoverlife.org/tmp/Hypoprepia_fucosa_33.9_-83.3_
2011,2012,2013.txt')
#This is what I need to read in terms of data, but this URL only exists if
the URL ran above is activated first

So, for example, try running line #2 without the first line- it won't work.
Next run #1 then #2- works fine.

See what I mean?


On Thu, Sep 29, 2016 at 5:09 PM, Bob Rudis  wrote:

> The rvest/httr/curl trio can do the cookie management pretty well. Make
> the initial connection via rvest::html_session() and then hopefully be able
> to use other rvest function calls, but curl and httr calls will use the
> cached in-memory handle info seamlessly. You'd need to store and retrieve
> cookies if you need them preserved between R sessions.
>
> Failing the above and assuming this would not need to be lightning fast,
> use the phantomjs or firefox web driver (either with RSelenium or some new
> stuff rOpenSci is cooking up) which will then do what browsers do best and
> maintain all this state for you. You can still slurp the page contents up
> with xml2::read_html() and use the super handy processing idioms in the
> scraping tidyverse (it needs it's own name).
>
> A concrete example (assuming the URLs aren't sensitive) would enable me or
> someone else to mock up something for you.
>
>
> On Thu, Sep 29, 2016 at 4:59 PM, Duncan Murdoch 
> wrote:
>
>> On 29/09/2016 3:29 PM, Ryan Utz wrote:
>>
>>> Hi all,
>>>
>>> I've got a situation that involves activating a URL so that a link to
>>> some
>>> data becomes available for download. I can easily use 'browseURL' to do
>>> so,
>>> but I'm hoping to make this batch-process-able, and I would prefer to not
>>> have 100s of browser windows open when I go to download multiple data
>>> sets.
>>>
>>> Here's the example:
>>>
>>> #1
>>> browseURL('
>>> http://pick18.discoverlife.org/mp/20m?plot=2=Hypoprepia
>>> +fucosa=33.9+-83.3=2011,2012,2013=build_txt:
>>> ')
>>> # This opens the URL and creates a link to machine-readable data on the
>>> page, which I can then download by simply doing this:
>>>
>>> #2
>>> read.delim('
>>> http://pick18.discoverlife.org/tmp/Hypoprepia_fucosa_33.9_-8
>>> 3.3_2011,2012,2013.txt
>>> ')
>>>
>>> However, I can only get the second line above to work if the thing in
>>> line
>>> #1 has been opened in a browser already. Is there any way to allow me to
>>> either 1) close the browser after it's been opened or 2) execute the line
>>> #2 above without having to open a browser? We have hundreds of species
>>> that
>>> you can see after the '=' bit of the URL, so I'm trying to keep the
>>> browsing situation sane.
>>>
>>> Thanks!
>>> R
>>>
>>>
>> You'll need to figure out what happens when you open the first page. Does
>> it set a cookie?  Does it record your IP address?  Does it just build the
>> file but record nothing about you?
>>
>> If it's one of the simpler versions, you can just read the first page,
>> wait a bit, then read the second one.
>>
>> If you need to manage cookies, you'll need something more complicated. I
>> don't know the easiest way to do that.
>>
>> Duncan Murdoch
>>
>>
>> __
>> 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/posti
>> ng-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>


-- 

Ryan Utz, Ph.D.
Assistant professor of water resources
*chatham**UNIVERSITY*
Home/Cell: (724) 272-7769

[[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] multiple uses ifelse function

2016-10-11 Thread Jorge Cimentada
Hi Letter,

This should do it:
testchange <- ifelse(testseq <= 4,'x', ifelse(testseq >= 5, 'y', testseq))

Read it as: if testseq <=4, print x, ifelse test seq >=5, print y, any
other case, print testseq.

[[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] Recoding lists of categories of a variable

2016-10-11 Thread peter dalgaard

On 11 Oct 2016, at 01:32 , S Ellison  wrote:

>> Well, I think that's kind of overkill.
> Depends whether you want to recode all or some, and how robust you want the 
> answer to be. 
> recode() allows you to recode a few levels of many, without dependence on 
> level ordering; that's kind of neat. 
> 
> tbh, though,  I don't use recode() a lot; I generally find myself need to 
> change a fair proportion of level labels. 
> 
> But I do get nervous about relying on specific ordering; it can break without 
> visible warning if the data change (eg if you lose a factor level with a 
> slightly different data set, integer indexing will give you apparently valid 
> reassignment to the wrong new codes).  So I tend to go via named vectors even 
> if it costs me a lot of typing. For example to change 
> lcase<-c('a', 'b', 'c') 
> 
> to c('B', 'A', 'C') I'll use something like 
> 
> c(a='B', b='A', c='C')[lcase] 
> 
> or, if lcase were a factor, 
> c(a='B', b='A', c='C')[as.character(lcase)] 

Notice that similar functionality is available via levels<-() (see help page 
for more features)

> f <- factor(c("a","b","c"))
> levels(f) <- list(A="a", B="b", C="c")
> f
[1] A B C
Levels: A B C

The main advantage of this is that you control the level ordering, and also 
that you don't quite as easily get caught out by unused levels:

> f <- factor(c("a","c"))
> levels(f) <- list(A="a", B="b", C="c")
> table(f)
f
A B C 
1 0 1 

(in which the 0 count might be important).

-pd

> 
> Unlike using the numeric levels, that doesn't fail if some of the levels I 
> expect are absent; it only fails (and does so visibly) when there's a value 
> in there that I haven't assigned a coding to. So it's a tad more robust.
> 
> Steve E
> 
> 
> 
> 
> 
> 
> ***
> This email and any attachments are confidential. Any use...{{dropped:8}}
> 
> __
> 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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com

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


Re: [R] multiple uses ifelse function

2016-10-11 Thread PIKAL Petr
Hi

> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Jorge
> Cimentada
> Sent: Tuesday, October 11, 2016 11:47 AM
> To: message 
> Cc: r-help@R-project.org
> Subject: Re: [R] multiple uses ifelse function
>
> Hi Letter,
>
> This should do it:
> testchange <- ifelse(testseq <= 4,'x', ifelse(testseq >= 5, 'y', testseq))

This is a little bit complicated.

Enough for this simple recoding is
testchange<-ifelse(testseq<=4,'x',"y")

However

testchange <- cut(testseq, breaks=c(0,4,21), labels=c("x","y"))

is more versatile as it can handle easily more than 2 levels.

Cheers
Petr

>
> Read it as: if testseq <=4, print x, ifelse test seq >=5, print y, any other 
> case,
> print testseq.
>
>   [[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.


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 -- 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] Recoding lists of categories of a variable

2016-10-11 Thread S Ellison
> If you are concerned about missing levels -- which I agree is legitimate -- 
> then
> the following simple modification works (for
> **factors** of course):
> 
> > d <- factor(letters[1:2],levels= letters[1:3]) d
> [1] a b
> Levels: a b c
> > f <- factor(d,levels = levels(d), labels = LETTERS[3:1]) f
> [1] C B
> Levels: C B A
> 
> ## No levels lost !
> 
> Does that allay your concerns?

If you control the factor creation, sure. But it gets a bit untidy if your 
factors are created on data reading or similar; read.table doesn’t give you the 
option to set levels on factor creation. You have to go back over your data 
frame etc to fix it. That's legit, of course, but would amount to recoding the 
same factor twice - once to re-set the levels to the full set, and a second 
time to recode them.

Hardly a showstopper though; we're in timtowdi territory here and we're allowed 
a bit of personal preference. My preference just happens to be conditioned by 
SQL and other applications where ordering is explicitly _not_ guaranteed unless 
you specify it. So relying on implicit ordering makes me decidedly nervous, and 
I see associative arrays and other order-independent operations as  much safer. 

S




***
This email and any attachments are confidential. Any use, copying or
disclosure other than by the intended recipient is unauthorised. If 
you have received this message in error, please notify the sender 
immediately via +44(0)20 8943 7000 or notify postmas...@lgcgroup.com 
and delete this message and any copies from your computer and network. 
LGC Limited. Registered in England 2991879. 
Registered office: Queens Road, Teddington, Middlesex, TW11 0LY, UK
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] date comparison doesn't match value

2016-10-11 Thread Simon, Heather
Thanks Jim and others who have responded to this post!

Jim, this is exactly what happened.  I was having some trouble with date 
comparisons which turned out to be a time zone conversion issue even though the 
two dates I was comparing both said they were EST, when you subtracted one from 
the other the differences was 4 hours off from what the answer should have been 
(i.e. one date was interpreted as GMT).  However, when I started trying to 
debug I compared the as.POSIXct object to a date character string.  R 
interpreted the character string as a numeric value that translated to sometime 
in the year 1309.

Thanks for everyone's help.

Cheers,
Heather

-Original Message-
From: Jim Lemon [mailto:drjimle...@gmail.com] 
Sent: Saturday, October 08, 2016 6:04 AM
To: Simon, Heather 
Subject: Re: [R] date comparison doesn't match value

Hi Heather,
I think the problem may be that you are trying to compare a date field and a 
character string. R helpfully tries to wrangle the two into comparable data 
types. While I don't know exactly what you have done, as R for:

as.numeric(alldata$new.date.local)

and look at the value you get.

JIm


On Sat, Oct 8, 2016 at 3:41 AM, Simon, Heather  wrote:
> I am running into trouble when trying to compare date fields in my dataset.  
> When I view a field, it looks like it is a date in 2011:
>
>
>> alldata$new.date.local[1]
> [1] "2011-07-01 12:08:07 EDT"
>
> However, when I try to compare it to a character string, it seems to 
> think it is equal to sometime between the years 1310 and 1309
>
>> alldata$new.date.local[1] < "1310-01-01 00:00:00 EDT"
> [1] TRUE
>> alldata$new.date.local[1] < "1309-12-31 23:59:59 EDT"
> [1] FALSE
>
> But not exactly equal to midnight of Dec 31 in 1309, so it is not equal to 
> any exact time:
>
>> alldata$new.date.local[1] == "1309-12-31 23:59:59 EDT"
> [1] FALSE
>> alldata$new.date.local[1] < "1309-12-31 23:59:59 EDT"
> [1] FALSE
>> alldata$new.date.local[1] > "1309-12-31 23:59:59 EDT"
> [1] TRUE
>
> Even though this date field was created using as.POSIXct from a text string, 
> I have tried fixing this by reapplying the as.POSIXct function:
>
>>alldata$new.date.local <- as.POSIXct(alldata$new.date.local, tz = 
>>"EDT")
>
> But this does not seem to fix the problem.  When I try recreating the date 
> from a character string I get the same behavior.  Any suggestions would be 
> much appreciated.
>
> -Heather
>
>
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Recoding lists of categories of a variable

2016-10-11 Thread Bert Gunter
> Hardly a showstopper though; we're in timtowdi territory here and we're 
> allowed a bit of personal preference.


Absolutely. I appreciate your constructive comments, however.

Cheers,
Bert

__
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] Hclust

2016-10-11 Thread David L Carlson
Not for hclust() since it provides results for all clusters from 1 to n (the 
number of observations). Adding a point can change the definition of the 
clusters. You could use cutree() to assign the observations to clusters for a 
particular number of clusters, but then you must decide what rule to use in 
assigning your new point to one of those clusters (the method= argument in 
hclust). A simple solution would be to identify to which of the original 
points, your new point is closest. Assign the new point to the cluster that 
point is in. Another would be to use aggregate() to compute the centers of the 
clusters and assign the new point to the closest center. These two approaches 
will not necessarily agree with one another.

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



-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of TJUN KIAT TEO
Sent: Tuesday, October 11, 2016 2:57 AM
To: r-help@r-project.org
Subject: [R] Hclust

For the hclust function in R, is there a predict function that would  work to 
tell me which cluster does a new observation belong to? Same question for 
dbscan and self organizing map


Thanks


Tjun Kiat Teo

[[alternative HTML version deleted]]

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

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


Re: [R] Output formatting in PDF

2016-10-11 Thread Duncan Mackay
Hi

There is also the basic option of using the grid package and viewports.
You can then place the plots where you want and annotate them

pdf(file= paste0("01", ".pdf"),
height  = 3.5,
width   = 7,
paper   = "special",
onefile = TRUE,
family  = "Helvetica",
pointsize = 12,
colormodel = "rgb")

vpl <- viewport(x = 0.25, y = 0.5, width = 0.45, height = 0.9)
pushViewport(vpl)
grid.rect(gp = gpar(lty = "dashed"))
popViewport()

vpr <- viewport(x = 0.75, y = 0.5, width = 0.45, height = 0.9)
pushViewport(vpr)
grid.rect(gp = gpar(lty = "dashed"))
grid.circle(x = 0.6, y = 0.4, r = 0.3)
popViewport()

dev.off()

In your case you may need to have a viewport of the whole page

see  http://www.amstat.org/publications/jse/v18n3/zhou.pdf for examples

also have a look at the grid.clip function

Regards

Duncan Mackay

Duncan Mackay
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2351
Email: home: mac...@northnet.com.au


-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Preetam Pal
Sent: Tuesday, 11 October 2016 19:14
To: r-help@r-project.org
Subject: [R] Output formatting in PDF

Hi,

Can you please help me with the following output formatting:
I am planning to include 2 plots and some general description in a one-page
PDF document, such that

   - I'll leave some appropriate margin on the PDF- say, 1.5 inches
   top,right, bottom and left (will decide based on overall appearance)
   - the 2 plots are placed side-by-side (looks best for comparison)
   - the margins for each plot can be 4 lines on the top and the bottom &
2 lines on the left and the right
   - each of these 2 plots would have time (0 to 260) along x-axis and two
   time-series (daily USD-GBP and USD-EUR FX rates) on the y-axis, i.e. 2
   time-series would be plotted on each of the 2 graphs. I would need a
   different color for each plot to demarcate them
   - I need to add some text (eg: "Independent analysis of Exchange Rate
   dynamics") with reduced font size (not high priority though-just good to
   have a different size)
   - The general discussion (may be a paragraph) would come right below the
   2 plots - I can specify this text as an argument in a function, may be. I
   am not sure how to arrange the entire PDF as per the format I mentioned
   above

I shall really appreciate any help with this - the time series analysis is
not difficult, I can manage that - however, I don't know how to manage the
formatting part though, so that the 1-pager output looks decently
presentable. Thanks.

Regards,
Preetam

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


[R] which properly to avoid pointer copy Tcl Tk? 'externalptr'

2016-10-11 Thread Cleber N.Borges
hello,
I'm trying to disable an tkentry widget with a tkcheckbutton using an R
function via the command flag.
but I get an error regardding copy of the pointer: 'externalptr'
which properly way to avoid this?

thanks,
cleber

 > library( tcltk )
 > tp <- tktoplevel()
 >
 > chk <- tclVar( TRUE )
 > statusentry <- tclVar( "normal" ) # normal, disabled
 > anystring <- tclVar( "anystring" )
 >
 > chebut <- ttkcheckbutton( tp, variable=chk, text='Save with new name:
', onvalue=TRUE, offvalue=FALSE,
+ command=function(...) ifelse( as.numeric(tclvalue(chk)),
+tkconfigure(ent1,'-state','normal'),
+tkconfigure(ent1,'-state','disabled') )
+   )
 > tcl( 'pack', chebut )

 >
 > ent1 <- ttkentry( tp, textvariable=anystring, state='normal' )
 > tcl( 'pack', ent1 )

Error in rep(no, length.out = length(ans)) :
   attempt to replicate an object of type 'externalptr'
 >



---
Este email foi escaneado pelo Avast antivírus.
https://www.avast.com/antivirus

[[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] Output formatting in PDF

2016-10-11 Thread Preetam Pal
Hi,

Can you please help me with the following output formatting:
I am planning to include 2 plots and some general description in a one-page
PDF document, such that

   - I'll leave some appropriate margin on the PDF- say, 1.5 inches
   top,right, bottom and left (will decide based on overall appearance)
   - the 2 plots are placed side-by-side (looks best for comparison)
   - the margins for each plot can be 4 lines on the top and the bottom &
2 lines on the left and the right
   - each of these 2 plots would have time (0 to 260) along x-axis and two
   time-series (daily USD-GBP and USD-EUR FX rates) on the y-axis, i.e. 2
   time-series would be plotted on each of the 2 graphs. I would need a
   different color for each plot to demarcate them
   - I need to add some text (eg: "Independent analysis of Exchange Rate
   dynamics") with reduced font size (not high priority though-just good to
   have a different size)
   - The general discussion (may be a paragraph) would come right below the
   2 plots - I can specify this text as an argument in a function, may be. I
   am not sure how to arrange the entire PDF as per the format I mentioned
   above

I shall really appreciate any help with this - the time series analysis is
not difficult, I can manage that - however, I don't know how to manage the
formatting part though, so that the 1-pager output looks decently
presentable. Thanks.

Regards,
Preetam

[[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] turning comma separated string from multiple choices into

2016-10-11 Thread Bob Rudis
Take a look at tidyr::separate()

On Fri, Oct 7, 2016 at 12:57 PM, silvia giussani
 wrote:
> Hi all,
>
>
>
> could you please tell me if you find a solution to this problem (in
> Subject)?
>
>
>
> June Kim wrote:
>
>>* Hello,*
>
>>
>
>>* I use google docs' Forms to conduct surveys online. Multiple choices*
>
>>* questions are coded as comma separated values.*
>
>>
>
>>* For example,*
>
>>
>
>>* if the question is like:*
>
>>
>
>>* 1. What magazines do you currently subscribe to? (you can choose*
>
>>* multiple choices)*
>
>>* 1) Fast Company*
>
>>* 2) Havard Business Review*
>
>>* 3) Business Week*
>
>>* 4) The Economist*
>
>>
>
>>* And if the subject chose 1) and 3), the data is coded as a cell in a*
>
>>* spreadsheet as,*
>
>>
>
>>* "Fast Company, Business Week"*
>
>>
>
>>* I read the data with read.csv into R. To analyze the data, I have to*
>
>>* change that string into something like flags(indicator variables?).*
>
>>* That is, there should be 4 variables, of which values are either 1 or*
>
>>* 0, indicating chosen or not-chosen respectively.*
>
>>
>
>>* Suppose the data is something like,*
>
>>
>
>>
>
>>>* survey1*
>
>>>
>
>>*   agefavorite_magazine*
>
>>* 1  29 Fast Company*
>
>>* 2  31  Fast Company, Business Week*
>
>>* 3  32 Havard Business Review, Business Week, The Economist*
>
>>
>
>>
>
>>* Then I have to chop the string in favorite_magazine column to turn*
>
>>* that data into something like,*
>
>>
>
>>
>
>>>* survey1transformed*
>
>>>
>
>>*   age Fast Company Havard Business Review Business Week The Economist*
>
>>* 1  291  0 0 0*
>
>>* 2  311  0 1 0*
>
>>* 3  320  1 1 1*
>
>>
>
>>
>
>>* Actually I have many more multiple choice questions in the survey.*
>
>>
>
>>* What is the easy elegant and natural way in R to do the job?*
>
>>
>
>
>
> I'd look into something like as.data.frame(lapply(strings, grep,
>
> x=favorite_magazine, fixed=TRUE)), where strings <- c("Fast Company",
>
> "Havard Business Review", ...).
>
>
>
> (I take it that the mechanism is such that you can rely on at least
>
> having everything misspelled in the same way? If it is alternatingly
>
> "Havard" and "Harvard", then things get a bit trickier.)
>
>
>
> Thank you and regards,
>
> Silvia Giussani
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] Question about ggplot2 symbol and legend change

2016-10-11 Thread Thierry Onkelinx
Dear Luis,

Please don't post in HTML, it mangles the code.

You want something like

p + scale_shape_manual(values = c(16, 2))

Untested as you failed to provide a reproducible example.

Best regards,

ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to say
what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey

2016-10-11 4:25 GMT+02:00 Luis Fernando García :

> Dear R experts,
>
> Maybe my question is too basic and I apologize for that. I am having an
> issue currently by trying to change manually the symbols of the series. I
> need to put them manually, instead of using the symbols that R gives by
> default and produce a plot with the classic style. For example I need to
> put the symbols 16 and 2, but I have been unable to do it so far. Also, I
> need to remove the grey background from the seiries but I have been unable
> to do it too.
>
> Any help you can provide will be really helpful.
>
> Below, I am providing the script as well as the picture I gio with it If
> necessary I added the dataset.
>
> Many thanks
>
>
> 
> #
>
>
> it<-read.table("immotime.txt",header=TRUE)
> it
> str(it)
> names(it)
> fit3<-lm(Time ~ Sp*Ratio, data=it)
> anova(fit3)
> plot(fit3)
> summary(fit3)
> a$lPeso <- log(Peso)
> library(ggplot2)
> p <- ggplot(it,aes(x=Ratio,y=Time)) + geom_point(aes(shape=factor(Sp)))
> p=p + geom_smooth(aes(linetype=factor(Sp), ),colour="black", method='lm',
> se=F)+theme(panel.grid.major = element_blank(), panel.grid.minor =
> element_blank(),
>   panel.background = element_blank(), axis.line =
> element_line(colour = "black"))
> p
>
>
>
> 
> #
>
> Plot: https://postimg.org/image/3vm2uleip/
> dataset "it" http://textuploader.com/d593h
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

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

Re: [R] Output formatting in PDF

2016-10-11 Thread Enrico Schumann
On Tue, 11 Oct 2016, Preetam Pal  writes:

> Hi,
>
> Can you please help me with the following output formatting:
> I am planning to include 2 plots and some general description in a one-page
> PDF document, such that
>
>- I'll leave some appropriate margin on the PDF- say, 1.5 inches
>top,right, bottom and left (will decide based on overall appearance)
>- the 2 plots are placed side-by-side (looks best for comparison)
>- the margins for each plot can be 4 lines on the top and the bottom &
> 2 lines on the left and the right
>- each of these 2 plots would have time (0 to 260) along x-axis and two
>time-series (daily USD-GBP and USD-EUR FX rates) on the y-axis, i.e. 2
>time-series would be plotted on each of the 2 graphs. I would need a
>different color for each plot to demarcate them
>- I need to add some text (eg: "Independent analysis of Exchange Rate
>dynamics") with reduced font size (not high priority though-just good to
>have a different size)
>- The general discussion (may be a paragraph) would come right below the
>2 plots - I can specify this text as an argument in a function, may be. I
>am not sure how to arrange the entire PDF as per the format I mentioned
>above
>
> I shall really appreciate any help with this - the time series analysis is
> not difficult, I can manage that - however, I don't know how to manage the
> formatting part though, so that the 1-pager output looks decently
> presentable. Thanks.
>
> Regards,
> Preetam

If using LaTeX is an option, I would suggest
?Sweave. There are many tutorials on the web that
should get you started.


-- 
Enrico Schumann
Lucerne, Switzerland
http://enricoschumann.net

__
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] multiple uses ifelse function

2016-10-11 Thread message

Readers,

Could someone please explain how to apply the function 'ifelse' to 
change a vector, for various conditions?


testseq<-seq(1:20)
testchange<-ifelse(testseq<=4,'x',testseq)
testchange<-c(ifelse(testseq<=4,'x',testseq),ifelse(testseq>=5,'y',testseq))

The last instruction causes the vector 'testchange' to change 
dimensions, when the result wanted is:


testchange
x x x x y y y y y y y y y y y y y y y y

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


Re: [R-es] Alto rendimiento

2016-10-11 Thread javier.ruben.marcuzzi
Estimado Carlos Gil Bellosta

¿Cómo está usted? En estos lados de América del sur comienza la primavera, 
desde la ventana miro la parra contando las posibles uvas, siempre aparece un 
ave que se arrima a la ventana o incluso llegan hasta la computadora como si 
supiesen usarla.

Ahora en R.

En ese esquema un modelo lineal tendría que ir con mlib que es aportada por 
sparklyr, en ese caso tendría toda la capacidad de proceso, pero no en un ml 
tradicional como modelo <- lm (y ~ var1 + var2).

En otras palabras http://spark.rstudio.com/mllib.html aporta beneficios, pero 
lo que está por fuera correría como el R de CRAN con un hilo del procesador.

Los otros días vi el video de la charla, no me quedo claro si Microsoft 
optimiza las librerías de sus repositorios al compilarlas o solo las de su 
propiedad.

Javier Rubén Marcuzzi

De: Carlos J. Gil Bellosta 
Enviado: martes, 11 de octubre de 2016 10:59
Para: Javier Marcuzzi
CC: r-help-es
Asunto: Re: [R-es] Alto rendimiento

Hola, ¿qué tal?

Spark correría en tantos hilos como estuviese configurado a utilizar (con 
límite en los existentes). La promesa de sparklyr es que se trata de una mera 
interfaz que delega el procesamiento de datos en Spark. Spark paralelizaría 
(que de eso trata).

Un saludo,

Carlos J. Gil Bellosta
http://www.datanalytics.com



El 11 de octubre de 2016, 15:55,  escribió:
Estimados

En el sitio de https://www.rstudio.com/  hay un aviso sobre 
http://spark.rstudio.com/index.html ( sparklyr ).

Microsoft publico un artículo donde comparan el R Server que está dentro de SQL 
server (o por separado, depende un poco), o el Microsoft R, junto con algunas 
librerías que se pueden compilar y obtener lo mismo en Ubuntu.

Supongamos que tengo el dinero como para comprar por ejemplo 
http://www.intel.la/content/www/xl/es/processors/xeon/xeon-processor-e7-family.html
 uno de estos procesadores con 36 núcleos.

Supongamos que tengo aún más dinero y puedo comprar 4 computadoras y colocarlas 
de tal forma que puedan trabajar en conjunto.

Ahora mi pregunta, spark (sparklyr) utiliza mis cuatro computadoras pero ¿un 
solo núcleo o los 36? (java usa solo un núcleo)

La parte de Microsoft utiliza los 36 procesadores, pero las librerías que están 
en los repositorios de Microsoft (no las de CRAN) ¿están optimizadas para los 
36 procesadores?

O solo hay partes en spark como mlib o lo específico de R Microsoft optimizado, 
que puedan utilizar todos los núcleos y/o procesadores. Por ejemplo MCMCglmm 
¿tiene beneficios en cualquiera de estas tecnologías o solo utiliza lo mismo 
que puede procesar en una portátil?

O si compro los cuatro equipos con 36 núcleos, instalo la versión de Microsoft 
junto con sparklyr y: ¿tengo una capacidad de cálculo impresionante, o esa 
capacidad es solo en sectores de R siendo el resto procesado en forma 
tradicional?

¿Hay comentarios al respecto desde la experiencia de alguno del grupo?

Javier Rubén Marcuzzi


        [[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-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


Re: [R-es] Alto rendimiento

2016-10-11 Thread Carlos J. Gil Bellosta
Hola, ¿qué tal?

Spark correría en tantos hilos como estuviese configurado a utilizar (con
límite en los existentes). La promesa de sparklyr es que se trata de una
mera interfaz que delega el procesamiento de datos en Spark. Spark
paralelizaría (que de eso trata).

Un saludo,

Carlos J. Gil Bellosta
http://www.datanalytics.com



El 11 de octubre de 2016, 15:55,  escribió:

> Estimados
>
> En el sitio de https://www.rstudio.com/  hay un aviso sobre
> http://spark.rstudio.com/index.html ( sparklyr ).
>
> Microsoft publico un artículo donde comparan el R Server que está dentro
> de SQL server (o por separado, depende un poco), o el Microsoft R, junto
> con algunas librerías que se pueden compilar y obtener lo mismo en Ubuntu.
>
> Supongamos que tengo el dinero como para comprar por ejemplo
> http://www.intel.la/content/www/xl/es/processors/xeon/
> xeon-processor-e7-family.html uno de estos procesadores con 36 núcleos.
>
> Supongamos que tengo aún más dinero y puedo comprar 4 computadoras y
> colocarlas de tal forma que puedan trabajar en conjunto.
>
> Ahora mi pregunta, spark (sparklyr) utiliza mis cuatro computadoras pero
> ¿un solo núcleo o los 36? (java usa solo un núcleo)
>
> La parte de Microsoft utiliza los 36 procesadores, pero las librerías que
> están en los repositorios de Microsoft (no las de CRAN) ¿están optimizadas
> para los 36 procesadores?
>
> O solo hay partes en spark como mlib o lo específico de R Microsoft
> optimizado, que puedan utilizar todos los núcleos y/o procesadores. Por
> ejemplo MCMCglmm ¿tiene beneficios en cualquiera de estas tecnologías o
> solo utiliza lo mismo que puede procesar en una portátil?
>
> O si compro los cuatro equipos con 36 núcleos, instalo la versión de
> Microsoft junto con sparklyr y: ¿tengo una capacidad de cálculo
> impresionante, o esa capacidad es solo en sectores de R siendo el resto
> procesado en forma tradicional?
>
> ¿Hay comentarios al respecto desde la experiencia de alguno del grupo?
>
> Javier Rubén Marcuzzi
>
>
> [[alternative HTML version deleted]]
>
> ___
> R-help-es mailing list
> R-help-es@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-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


Re: [R-es] Alto rendimiento

2016-10-11 Thread Carlos Ortega
Hola,

Son muchas cosas juntas... por separar:

   - Las librerías de Microsoft.
  - ¿Te refieres a las que soporta su versión de R: "Open R"?
  - Están modificadas para que en Windows puedas utilizar fácilmente
  varios cores (varios hilos) utilizando una librería de Intel que
se instala
  con la versión.
  - Si es la versión que está en la nube, que también hablaron de ello
  (Azure Machine Learning), ahí tienen sus algoritmos propietarios
que puedes
  complementarlos con "R" y gran parte de las librerías que están en CRAN.
 - En este caso, en lo que te ayuda estar en su cloud si quieres
 usar sólo la parte de "R" es en tener por debajo máquinas con
mucha RAM.
  - Lo de "sparklyr":
  - Si te montas varias máquinas en un clúster como dices e instalas
  Linux sobre el que pones Hadoop y Spark puedes con esta librería
de RStudio
  trabajar en modo distribuido.
 - El configurar un clúster de este tipo no es trivialhay
 ejemplos comentado por ahí de cómo hacerlo en EC2 Amazon.
  - Puedes ejecutar procesos de machine learning en modo paralelo, pero
  solamente los que incluyen las librerías MLlib de Spark que no son todos
  los que hay disponibles en CRAN, no todos los algoritmos son
  paralelizables. Pero sí que se contemplan los de clúster, los glm,
  randomForest, gbm, survival, etc (http://spark.rstudio.com/mllib.html).
  También es capaz de distribuir trabajos sobre H2O, que también tiene
  básicamente las mismas librerías que las MLlib con el añadido de
  "deeplearning".
  - En este caso, escribes en lenguaje R (en concreto dplyr) y esta
  librería "traduce" a lenguaje que entiende Spark. Puedes como
verás incluso
  lanzar igualmente sentencias SQL.


Saludos,
Carlos Ortega.
www.qualityexcellence.es



El 11 de octubre de 2016, 16:22,  escribió:

> Estimado Carlos Gil Bellosta
>
> ¿Cómo está usted? En estos lados de América del sur comienza la primavera,
> desde la ventana miro la parra contando las posibles uvas, siempre aparece
> un ave que se arrima a la ventana o incluso llegan hasta la computadora
> como si supiesen usarla.
>
> Ahora en R.
>
> En ese esquema un modelo lineal tendría que ir con mlib que es aportada
> por sparklyr, en ese caso tendría toda la capacidad de proceso, pero no en
> un ml tradicional como modelo <- lm (y ~ var1 + var2).
>
> En otras palabras http://spark.rstudio.com/mllib.html aporta beneficios,
> pero lo que está por fuera correría como el R de CRAN con un hilo del
> procesador.
>
> Los otros días vi el video de la charla, no me quedo claro si Microsoft
> optimiza las librerías de sus repositorios al compilarlas o solo las de su
> propiedad.
>
> Javier Rubén Marcuzzi
>
> De: Carlos J. Gil Bellosta
> Enviado: martes, 11 de octubre de 2016 10:59
> Para: Javier Marcuzzi
> CC: r-help-es
> Asunto: Re: [R-es] Alto rendimiento
>
> Hola, ¿qué tal?
>
> Spark correría en tantos hilos como estuviese configurado a utilizar (con
> límite en los existentes). La promesa de sparklyr es que se trata de una
> mera interfaz que delega el procesamiento de datos en Spark. Spark
> paralelizaría (que de eso trata).
>
> Un saludo,
>
> Carlos J. Gil Bellosta
> http://www.datanalytics.com
>
>
>
> El 11 de octubre de 2016, 15:55, 
> escribió:
> Estimados
>
> En el sitio de https://www.rstudio.com/  hay un aviso sobre
> http://spark.rstudio.com/index.html ( sparklyr ).
>
> Microsoft publico un artículo donde comparan el R Server que está dentro
> de SQL server (o por separado, depende un poco), o el Microsoft R, junto
> con algunas librerías que se pueden compilar y obtener lo mismo en Ubuntu.
>
> Supongamos que tengo el dinero como para comprar por ejemplo
> http://www.intel.la/content/www/xl/es/processors/xeon/xeon-
> processor-e7-family.html uno de estos procesadores con 36 núcleos.
>
> Supongamos que tengo aún más dinero y puedo comprar 4 computadoras y
> colocarlas de tal forma que puedan trabajar en conjunto.
>
> Ahora mi pregunta, spark (sparklyr) utiliza mis cuatro computadoras pero
> ¿un solo núcleo o los 36? (java usa solo un núcleo)
>
> La parte de Microsoft utiliza los 36 procesadores, pero las librerías que
> están en los repositorios de Microsoft (no las de CRAN) ¿están optimizadas
> para los 36 procesadores?
>
> O solo hay partes en spark como mlib o lo específico de R Microsoft
> optimizado, que puedan utilizar todos los núcleos y/o procesadores. Por
> ejemplo MCMCglmm ¿tiene beneficios en cualquiera de estas tecnologías o
> solo utiliza lo mismo que puede procesar en una portátil?
>
> O si compro los cuatro equipos con 36 núcleos, instalo la versión de
> Microsoft junto con sparklyr y: ¿tengo una capacidad de cálculo
> impresionante, o esa capacidad es solo en sectores de R siendo el resto
> procesado en forma tradicional?
>
> ¿Hay comentarios al respecto desde la experiencia de alguno del grupo?

Re: [R-es] Alto rendimiento

2016-10-11 Thread javier.ruben.marcuzzi
Estimado Carlos Ortega

Comprendo que hay que tener el paquete compilado para acceder al alto 
rendimiento, por lo cuál si está todo preparado para trabajar en un clúster y 
para aprovechar múltiples hilos, no habría problemas, calculo que si una 
librería no tiene esa tecnología no traería inconvenientes, ¿o  por el 
contrario si está distribuido crea varias instancias y al correr separadas hay 
“lío”?

Ejemplo esquemático para simplificar mi duda

paso 1) mllib,  
paso 2) mllib, 
paso 3) NO mllib “problema”
paso 4) mllib

Otra parte, hay un artículo que encontré donde da la pista para utilizar la 
tecnología de Microsoft pero en Linux, sin tener que pagar licencias.

https://blogs.technet.microsoft.com/machinelearning/2016/09/15/building-deep-neural-networks-in-the-cloud-with-azure-gpu-vms-mxnet-and-microsoft-r-server/

Hace unos años tuve que compilar un paquete en macosx con el compilador de 
Intel, si el código fuente no está preparado para procesar en varios núcleos, 
el compilador de Intel en Linux puede ser gratis y tiene una optimización mayor.

Posiblemente, Microsoft abrió una puerta para que casi cualquiera puede montar 
un cluster de R bajo Linux utilizando tecnología propietaria, algo como una 
gran donación a la ciencia.

Javier Rubén Marcuzzi

De: Carlos Ortega
Enviado: martes, 11 de octubre de 2016 14:21
Para: Javier Marcuzzi
CC: Carlos J. Gil Bellosta; r-help-es
Asunto: Re: [R-es] Alto rendimiento

Hola,

Son muchas cosas juntas... por separar:
• Las librerías de Microsoft.
o ¿Te refieres a las que soporta su versión de R: "Open R"?
o Están modificadas para que en Windows puedas utilizar fácilmente varios cores 
(varios hilos) utilizando una librería de Intel que se instala con la versión.
o Si es la versión que está en la nube, que también hablaron de ello (Azure 
Machine Learning), ahí tienen sus algoritmos propietarios que puedes 
complementarlos con "R" y gran parte de las librerías que están en CRAN.
• En este caso, en lo que te ayuda estar en su cloud si quieres usar sólo la 
parte de "R" es en tener por debajo máquinas con mucha RAM.
• Lo de "sparklyr":
o Si te montas varias máquinas en un clúster como dices e instalas Linux sobre 
el que pones Hadoop y Spark puedes con esta librería de RStudio trabajar en 
modo distribuido.
• El configurar un clúster de este tipo no es trivialhay ejemplos comentado 
por ahí de cómo hacerlo en EC2 Amazon.
o Puedes ejecutar procesos de machine learning en modo paralelo, pero solamente 
los que incluyen las librerías MLlib de Spark que no son todos los que hay 
disponibles en CRAN, no todos los algoritmos son paralelizables. Pero sí que se 
contemplan los de clúster, los glm, randomForest, gbm, survival, etc 
(http://spark.rstudio.com/mllib.html). También es capaz de distribuir trabajos 
sobre H2O, que también tiene básicamente las mismas librerías que las MLlib con 
el añadido de "deeplearning".
o En este caso, escribes en lenguaje R (en concreto dplyr) y esta librería 
"traduce" a lenguaje que entiende Spark. Puedes como verás incluso lanzar 
igualmente sentencias SQL.

Saludos,
Carlos Ortega.
www.qualityexcellence.es



El 11 de octubre de 2016, 16:22,  escribió:
Estimado Carlos Gil Bellosta

¿Cómo está usted? En estos lados de América del sur comienza la primavera, 
desde la ventana miro la parra contando las posibles uvas, siempre aparece un 
ave que se arrima a la ventana o incluso llegan hasta la computadora como si 
supiesen usarla.

Ahora en R.

En ese esquema un modelo lineal tendría que ir con mlib que es aportada por 
sparklyr, en ese caso tendría toda la capacidad de proceso, pero no en un ml 
tradicional como modelo <- lm (y ~ var1 + var2).

En otras palabras http://spark.rstudio.com/mllib.html aporta beneficios, pero 
lo que está por fuera correría como el R de CRAN con un hilo del procesador.

Los otros días vi el video de la charla, no me quedo claro si Microsoft 
optimiza las librerías de sus repositorios al compilarlas o solo las de su 
propiedad.

Javier Rubén Marcuzzi

De: Carlos J. Gil Bellosta
Enviado: martes, 11 de octubre de 2016 10:59
Para: Javier Marcuzzi
CC: r-help-es
Asunto: Re: [R-es] Alto rendimiento

Hola, ¿qué tal?

Spark correría en tantos hilos como estuviese configurado a utilizar (con 
límite en los existentes). La promesa de sparklyr es que se trata de una mera 
interfaz que delega el procesamiento de datos en Spark. Spark paralelizaría 
(que de eso trata).

Un saludo,

Carlos J. Gil Bellosta
http://www.datanalytics.com



El 11 de octubre de 2016, 15:55,  escribió:
Estimados

En el sitio de https://www.rstudio.com/  hay un aviso sobre 
http://spark.rstudio.com/index.html ( sparklyr ).

Microsoft publico un artículo donde comparan el R Server que está dentro de SQL 
server (o por separado, depende un poco), o el Microsoft R, junto con algunas 
librerías que se pueden compilar y obtener lo mismo en Ubuntu.

Supongamos que tengo el dinero como 

Re: [R-es] Colapsar una matriz con NA en una única fila

2016-10-11 Thread javier.ruben.marcuzzi
Estimado Oscar Benitez

Yo utilizo algo como lo siguiente: 

Datos<- Datos[ !is.na(Datos$DatoX),]#Solo dejo filas en las que las 
tratamiento son diferentes de cero

Javier Rubén Marcuzzi

De: Oscar Benitez
Enviado: martes, 11 de octubre de 2016 15:22
Para: R-help-es
Asunto: [R-es] Colapsar una matriz con NA en una única fila

Hola

Consulto por un problema que no consigo resolver.

Tengo un dataframe con muchas columnas todas de texto. Cada columna tiene
solamente un valor válido y el resto son NAs. También cada fila tiene un
único valor válido. Quiero colapsar ese data frame en uno que tenga
solamente una fila y todas las columnas. Intenté con loops, while,  apply y
otros parecidos pero no lo logro

El ejemplo del data frame sería así:
V1V2  V3
a3310-04
 
d52725   
 

Y quiero lograr algo así

V1  V2V3
a33 d52725 10-04

Mi script es así:

Nombre.1<-colnames(df0) #df0 es el dataframe que obtengo con NA

df<-data.frame(1) #inicio un nuevo data frame con una variable sin nombre y
valor 1


for (i in Nombre.1)
  {merge(df, subset(paste("df0$",i,sep=''),!is.na(paste("df0$",i,sep=''}
#el loop

Cualquier ayuda será apreciada

-- 
Oscar Benitez

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-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


[R-es] Colapsar una matriz con NA en una única fila

2016-10-11 Thread Oscar Benitez
Hola

Consulto por un problema que no consigo resolver.

Tengo un dataframe con muchas columnas todas de texto. Cada columna tiene
solamente un valor válido y el resto son NAs. También cada fila tiene un
único valor válido. Quiero colapsar ese data frame en uno que tenga
solamente una fila y todas las columnas. Intenté con loops, while,  apply y
otros parecidos pero no lo logro

El ejemplo del data frame sería así:
V1V2  V3
a3310-04
 
d52725   
 

Y quiero lograr algo así

V1  V2V3
a33 d52725 10-04

Mi script es así:

Nombre.1<-colnames(df0) #df0 es el dataframe que obtengo con NA

df<-data.frame(1) #inicio un nuevo data frame con una variable sin nombre y
valor 1


for (i in Nombre.1)
  {merge(df, subset(paste("df0$",i,sep=''),!is.na(paste("df0$",i,sep=''}
#el loop

Cualquier ayuda será apreciada

-- 
Oscar Benitez

[[alternative HTML version deleted]]

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


Re: [R-es] Colapsar una matriz con NA en una única fila

2016-10-11 Thread Carlos Ortega
Hola,

Esto te puede valer...

> # Crear un df con NAs y solo un elemento por columna no NA
> df <- as.data.frame(matrix(data = NA, nrow = 10, ncol = 5 ))
> set.seed(1)
> df2 <- apply(df, 2, function(x) { x[sample(1:10,1)] <- rnorm(1); x})
> df2
  V1   V2   V3   V4V5
 [1,] NA   NA   NA   NANA
 [2,] NA   NA   NA -1.53995NA
 [3,] NA   NA   NA   NANA
 [4,] NA   NA   NA   NANA
 [5,] NA   NA   NA   NANA
 [6,] -0.6264538   NA   NA   NANA
 [7,] NA   NA 1.595281   NANA
 [8,] NA   NA   NA   NA 0.4874291
 [9,] NA 1.329799   NA   NANA
[10,] NA   NA   NA   NANA
>
> # Encuentra en cada col las filas con NAs
> idx <- apply(df2,2, function(x) { which(!is.na(x)) } )
> # Extrae de cada col del df con NA el elemento no NA
> idx_df <- data.frame()
> for(i in 1:ncol(df2)) {
+   idx_df[1,i] <- df2[idx[i], i]
+ }
> idx_df
  V1   V2   V3   V4V5
1 -0.6264538 1.329799 1.595281 -1.53995 0.4874291
>



Saludos,
Carlos Ortega
www.qualityexcellence.es

El 11 de octubre de 2016, 20:53, Oscar Benitez 
escribió:

> Javier
> Muchas gracias por su respuesta
> Aunque no está funcionando, pues si ejecuto:
>
> EncDTE1<- t.EncDTE1[ !is.na(t.EncDTE1$Var1),]  obtengo Var1, Var2,
> Var3,...Varn con datos "texto", NA, NANA
>
> Pero al ejecutar
>
> EncDTE1<- t.EncDTE1[ !is.na(t.EncDTE1$Var2),]  obtengo Var1, Var2,
> Var3,...Varn con datos NA,"texto", NANA
>
>
> Estoy tratando de dar la vuelta con el loop otra vez, pero aún no lo
> consigo...
> Muchas gracias
>
>
>
>
> El 11 de octubre de 2016, 15:27, 
> escribió:
>
> > Estimado Oscar Benitez
> >
> >
> >
> > Yo utilizo algo como lo siguiente:
> >
> >
> >
> > Datos<- Datos[ !is.na(Datos$DatoX),]#Solo dejo filas en las que las
> > tratamiento son diferentes de cero
> >
> >
> >
> > Javier Rubén Marcuzzi
> >
> >
> >
> > *De: *Oscar Benitez 
> > *Enviado: *martes, 11 de octubre de 2016 15:22
> > *Para: *R-help-es 
> > *Asunto: *[R-es] Colapsar una matriz con NA en una única fila
> >
> >
> >
> > Hola
> >
> >
> >
> > Consulto por un problema que no consigo resolver.
> >
> >
> >
> > Tengo un dataframe con muchas columnas todas de texto. Cada columna tiene
> >
> > solamente un valor válido y el resto son NAs. También cada fila tiene un
> >
> > único valor válido. Quiero colapsar ese data frame en uno que tenga
> >
> > solamente una fila y todas las columnas. Intenté con loops, while,
> apply y
> >
> > otros parecidos pero no lo logro
> >
> >
> >
> > El ejemplo del data frame sería así:
> >
> > V1V2  V3
> >
> > a3310-04
> >
> >  
> >
> > d52725   
> >
> >  
> >
> >
> >
> > Y quiero lograr algo así
> >
> >
> >
> > V1  V2V3
> >
> > a33 d52725 10-04
> >
> >
> >
> > Mi script es así:
> >
> >
> >
> > Nombre.1<-colnames(df0) #df0 es el dataframe que obtengo con NA
> >
> >
> >
> > df<-data.frame(1) #inicio un nuevo data frame con una variable sin
> nombre y
> >
> > valor 1
> >
> >
> >
> >
> >
> > for (i in Nombre.1)
> >
> >   {merge(df, subset(paste("df0$",i,sep=''),!is.na
> (paste("df0$",i,sep=''))
> > ))}
> >
> > #el loop
> >
> >
> >
> > Cualquier ayuda será apreciada
> >
> >
> >
> > --
> >
> > Oscar Benitez
> >
> >
> >
> > [[alternative HTML version deleted]]
> >
> >
> >
> > ___
> >
> > R-help-es mailing list
> >
> > R-help-es@r-project.org
> >
> > https://stat.ethz.ch/mailman/listinfo/r-help-es
> >
> >
> >
>
>
>
> --
> Oscar Benitez
>
> [[alternative HTML version deleted]]
>
> ___
> 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


Re: [R-es] Alto rendimiento

2016-10-11 Thread Carlos Ortega
Hola,


   - Si tu "paso 3" te refieres a un algoritmo que no está en MLlib, este
   algoritmo se ejecutaría en el "Master" sin distribuir. El problema vendría
   de si tiene suficiente capacidad para procesar todo lo que le devuelva el
   "paso 2".


   - Lo que comentas de Microsoft, ¿no pagas licencias?... No pagas
   licencias por instalar diferentes librerías (para procesado con GPUs, la de
   la red MXNET que son libres) y versiones de R que son igualmente libres (R
   Open), pero pagas y mucho por tener todo esto en la nube de Microsoft.


   - Por matizar también lo último que comentas de MaxOS y compilar sobre
   un micro de Intel; es algo que ahora haces a diario con cada paquete que te
   instalas en R. Puedes instalarlo en binario o compilarlo directamente (vaya
   como en Linux). Pero esta compilación no tiene nada que ver con ninguna
   cesión de Microsoft. Con esto no quiero decir que Microsoft no ha cedido
   nada al mundo Linux, especialmente de un tiempo a esta parte es de los que
   más: http://thenextweb.com/microsoft/2016/09/15/in-your-face-google/#gref

Saludos,
Carlos Ortega
www.qualityexcellence.es


El 11 de octubre de 2016, 19:48,  escribió:

> Estimado Carlos Ortega
>
>
>
> Comprendo que hay que tener el paquete compilado para acceder al alto
> rendimiento, por lo cuál si está todo preparado para trabajar en un clúster
> y para aprovechar múltiples hilos, no habría problemas, calculo que si una
> librería no tiene esa tecnología no traería inconvenientes, ¿o  por el
> contrario si está distribuido crea varias instancias y al correr separadas
> hay “lío”?
>
>
>
> Ejemplo esquemático para simplificar mi duda
>
>
>
> paso 1) mllib,
>
> paso 2) mllib,
>
> paso 3) NO mllib “problema”
>
> paso 4) mllib
>
>
>
> Otra parte, hay un artículo que encontré donde da la pista para utilizar
> la tecnología de Microsoft pero en Linux, sin tener que pagar licencias.
>
>
>
> https://blogs.technet.microsoft.com/machinelearning/
> 2016/09/15/building-deep-neural-networks-in-the-cloud-
> with-azure-gpu-vms-mxnet-and-microsoft-r-server/
>
>
>
> Hace unos años tuve que compilar un paquete en macosx con el compilador de
> Intel, si el código fuente no está preparado para procesar en varios
> núcleos, el compilador de Intel en Linux puede ser gratis y tiene una
> optimización mayor.
>
>
>
> Posiblemente, Microsoft abrió una puerta para que casi cualquiera puede
> montar un cluster de R bajo Linux utilizando tecnología propietaria, algo
> como una gran donación a la ciencia.
>
>
>
> Javier Rubén Marcuzzi
>
>
>
> *De: *Carlos Ortega 
> *Enviado: *martes, 11 de octubre de 2016 14:21
> *Para: *Javier Marcuzzi 
> *CC: *Carlos J. Gil Bellosta ; r-help-es
> 
>
> *Asunto: *Re: [R-es] Alto rendimiento
>
>
>
> Hola,
>
>
>
> Son muchas cosas juntas... por separar:
>
>- Las librerías de Microsoft.
>
>
>- ¿Te refieres a las que soporta su versión de R: "Open R"?
>   - Están modificadas para que en Windows puedas utilizar fácilmente
>   varios cores (varios hilos) utilizando una librería de Intel que se 
> instala
>   con la versión.
>   - Si es la versión que está en la nube, que también hablaron de
>   ello (Azure Machine Learning), ahí tienen sus algoritmos propietarios 
> que
>   puedes complementarlos con "R" y gran parte de las librerías que están 
> en
>   CRAN.
>
>
>- En este caso, en lo que te ayuda estar en su cloud si quieres usar
>  sólo la parte de "R" es en tener por debajo máquinas con mucha RAM.
>
>
>- Lo de "sparklyr":
>
>
>- Si te montas varias máquinas en un clúster como dices e instalas
>   Linux sobre el que pones Hadoop y Spark puedes con esta librería de 
> RStudio
>   trabajar en modo distribuido.
>
>
>- El configurar un clúster de este tipo no es trivialhay ejemplos
>  comentado por ahí de cómo hacerlo en EC2 Amazon.
>
>
>- Puedes ejecutar procesos de machine learning en modo paralelo, pero
>   solamente los que incluyen las librerías MLlib de Spark que no son todos
>   los que hay disponibles en CRAN, no todos los algoritmos son
>   paralelizables. Pero sí que se contemplan los de clúster, los glm,
>   randomForest, gbm, survival, etc (http://spark.rstudio.com/
>   mllib.html). También es capaz de distribuir trabajos sobre H2O, que
>   también tiene básicamente las mismas librerías que las MLlib con el 
> añadido
>   de "deeplearning".
>   - En este caso, escribes en lenguaje R (en concreto dplyr) y esta
>   librería "traduce" a lenguaje que entiende Spark. Puedes como verás 
> incluso
>   lanzar igualmente sentencias SQL.
>
>
>
> Saludos,
>
> Carlos Ortega.
>
> www.qualityexcellence.es
>
>
>
>
>
>
>
> El 11 de octubre de 2016, 16:22, 
> escribió:
>
> Estimado Carlos Gil Bellosta
>
> ¿Cómo está 

Re: [R-es] Alto rendimiento

2016-10-11 Thread javier.ruben.marcuzzi
Estimado Carlos Ortega

Comprendo, si se ejecuta en el master no se distribuye y no habría problemas, 
salvo la capacidad de cálculo en máquina, que por más optimización de código la 
memoria y el proceso son necesarios y no se pueden esquivar.

Los servicios me Microsoft son desde gratis a precios elevados, claro que lo 
gratis dura muy poco, algo personal o en desarrollo podría utilizar tecnología 
sin tener de pagar, luego para mi billetera es muy elevado.

Por eso pensé en la parte de spark, que documenta entre algunas cosas a 
postgresql, aunque también este último se conecta por sí solo a R, lo bueno es 
que hay básicamente dos formas de tener una base de datos en conjunto con R, 
sin tener que pasar por Microsoft (sqlserver) u Oracle (mysql u Oracle).

Hace mucho que no compilo algo en R, pero se puede, sobre todo en Linux, donde 
un servicio rest o web está bastante aceitado. 

Gracias a los dos Carlos, tenía una duda que me resolvieron.

Javier Rubén Marcuzzi

De: Carlos Ortega
Enviado: martes, 11 de octubre de 2016 16:45
Para: Javier Marcuzzi
CC: r-help-es
Asunto: Re: [R-es] Alto rendimiento

Hola,

• Si tu "paso 3" te refieres a un algoritmo que no está en MLlib, este 
algoritmo se ejecutaría en el "Master" sin distribuir. El problema vendría de 
si tiene suficiente capacidad para procesar todo lo que le devuelva el "paso 2".
• Lo que comentas de Microsoft, ¿no pagas licencias?... No pagas licencias por 
instalar diferentes librerías (para procesado con GPUs, la de la red MXNET que 
son libres) y versiones de R que son igualmente libres (R Open), pero pagas y 
mucho por tener todo esto en la nube de Microsoft.
• Por matizar también lo último que comentas de MaxOS y compilar sobre un micro 
de Intel; es algo que ahora haces a diario con cada paquete que te instalas en 
R. Puedes instalarlo en binario o compilarlo directamente (vaya como en Linux). 
Pero esta compilación no tiene nada que ver con ninguna cesión de Microsoft. 
Con esto no quiero decir que Microsoft no ha cedido nada al mundo Linux, 
especialmente de un tiempo a esta parte es de los que más: 
http://thenextweb.com/microsoft/2016/09/15/in-your-face-google/#gref
Saludos,
Carlos Ortega
www.qualityexcellence.es


El 11 de octubre de 2016, 19:48,  escribió:
Estimado Carlos Ortega
 
Comprendo que hay que tener el paquete compilado para acceder al alto 
rendimiento, por lo cuál si está todo preparado para trabajar en un clúster y 
para aprovechar múltiples hilos, no habría problemas, calculo que si una 
librería no tiene esa tecnología no traería inconvenientes, ¿o  por el 
contrario si está distribuido crea varias instancias y al correr separadas hay 
“lío”?
 
Ejemplo esquemático para simplificar mi duda
 
paso 1) mllib,  
paso 2) mllib, 
paso 3) NO mllib “problema”
paso 4) mllib
 
Otra parte, hay un artículo que encontré donde da la pista para utilizar la 
tecnología de Microsoft pero en Linux, sin tener que pagar licencias.
 
https://blogs.technet.microsoft.com/machinelearning/2016/09/15/building-deep-neural-networks-in-the-cloud-with-azure-gpu-vms-mxnet-and-microsoft-r-server/
 
Hace unos años tuve que compilar un paquete en macosx con el compilador de 
Intel, si el código fuente no está preparado para procesar en varios núcleos, 
el compilador de Intel en Linux puede ser gratis y tiene una optimización mayor.
 
Posiblemente, Microsoft abrió una puerta para que casi cualquiera puede montar 
un cluster de R bajo Linux utilizando tecnología propietaria, algo como una 
gran donación a la ciencia.
 
Javier Rubén Marcuzzi
 
De: Carlos Ortega
Enviado: martes, 11 de octubre de 2016 14:21
Para: Javier Marcuzzi
CC: Carlos J. Gil Bellosta; r-help-es

Asunto: Re: [R-es] Alto rendimiento
 
Hola,
 
Son muchas cosas juntas... por separar:
• Las librerías de Microsoft.
o ¿Te refieres a las que soporta su versión de R: "Open R"?
o Están modificadas para que en Windows puedas utilizar fácilmente varios cores 
(varios hilos) utilizando una librería de Intel que se instala con la versión.
o Si es la versión que está en la nube, que también hablaron de ello (Azure 
Machine Learning), ahí tienen sus algoritmos propietarios que puedes 
complementarlos con "R" y gran parte de las librerías que están en CRAN.
• En este caso, en lo que te ayuda estar en su cloud si quieres usar sólo la 
parte de "R" es en tener por debajo máquinas con mucha RAM.
• Lo de "sparklyr":
o Si te montas varias máquinas en un clúster como dices e instalas Linux sobre 
el que pones Hadoop y Spark puedes con esta librería de RStudio trabajar en 
modo distribuido.
• El configurar un clúster de este tipo no es trivialhay ejemplos comentado 
por ahí de cómo hacerlo en EC2 Amazon.
o Puedes ejecutar procesos de machine learning en modo paralelo, pero solamente 
los que incluyen las librerías MLlib de Spark que no son todos los que hay 
disponibles en CRAN, no todos los algoritmos son paralelizables. Pero sí que se 
contemplan los de clúster, los glm, 

Re: [R-es] Colapsar una matriz con NA en una única fila

2016-10-11 Thread javier.ruben.marcuzzi
Estimado Oscar Benitez

Use la solución de Carlos Ortega, mi solución busca cuándo no tienen NA, pero 
si están en distinta fila a usted le sirve y yo lo descarto.

Javier Rubén Marcuzzi

De: javier.ruben.marcu...@gmail.com
Enviado: martes, 11 de octubre de 2016 19:29
Para: Oscar Benitez
CC: R-help-es
Asunto: RE: [R-es] Colapsar una matriz con NA en una única fila

Estimado Oscar Benitez

Tendría que probarlo, pero el código que yo le envié no está para copiar y 
pegar, lo que esta entre [] filtra una Var, no las tres, para las tres al mismo 
tiempo debe completar el código entre [ …]

Algo tipo:

lista <- lista[!is.na(lista$Var1) & !is.na(lista$Var2),]

Javier Rubén Marcuzzi

De: Oscar Benitez
Enviado: martes, 11 de octubre de 2016 15:53
Para: Javier Marcuzzi
CC: R-help-es
Asunto: Re: [R-es] Colapsar una matriz con NA en una única fila

Javier
Muchas gracias por su respuesta
Aunque no está funcionando, pues si ejecuto:

EncDTE1<- t.EncDTE1[ !is.na(t.EncDTE1$Var1),]  obtengo Var1, Var2, Var3,...Varn 
con datos "texto", NA, NANA

Pero al ejecutar

EncDTE1<- t.EncDTE1[ !is.na(t.EncDTE1$Var2),]  obtengo Var1, Var2, Var3,...Varn 
con datos NA,"texto", NANA


Estoy tratando de dar la vuelta con el loop otra vez, pero aún no lo consigo...
Muchas gracias




El 11 de octubre de 2016, 15:27,  escribió:
Estimado Oscar Benitez
 
Yo utilizo algo como lo siguiente: 
 
Datos<- Datos[ !is.na(Datos$DatoX),]    #Solo dejo filas en las que las 
tratamiento son diferentes de cero
 
Javier Rubén Marcuzzi
 
De: Oscar Benitez
Enviado: martes, 11 de octubre de 2016 15:22
Para: R-help-es
Asunto: [R-es] Colapsar una matriz con NA en una única fila
 
Hola
 
Consulto por un problema que no consigo resolver.
 
Tengo un dataframe con muchas columnas todas de texto. Cada columna tiene
solamente un valor válido y el resto son NAs. También cada fila tiene un
único valor válido. Quiero colapsar ese data frame en uno que tenga
solamente una fila y todas las columnas. Intenté con loops, while,  apply y
otros parecidos pero no lo logro
 
El ejemplo del data frame sería así:
V1    V2  V3
a33        10-04
     
    d52725   
     
 
Y quiero lograr algo así
 
V1  V2    V3
a33 d52725 10-04
 
Mi script es así:
 
Nombre.1<-colnames(df0) #df0 es el dataframe que obtengo con NA
 
df<-data.frame(1) #inicio un nuevo data frame con una variable sin nombre y
valor 1
 
 
for (i in Nombre.1)
  {merge(df, subset(paste("df0$",i,sep=''),!is.na(paste("df0$",i,sep=''}
#el loop
 
Cualquier ayuda será apreciada
 
-- 
Oscar Benitez
 
    [[alternative HTML version deleted]]
 
___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es
 




-- 
Oscar Benitez



[[alternative HTML version deleted]]

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

Re: [R-es] Colapsar una matriz con NA en una única fila

2016-10-11 Thread javier.ruben.marcuzzi
Estimado Oscar Benitez

Tendría que probarlo, pero el código que yo le envié no está para copiar y 
pegar, lo que esta entre [] filtra una Var, no las tres, para las tres al mismo 
tiempo debe completar el código entre [ …]

Algo tipo:

lista <- lista[!is.na(lista$Var1) & !is.na(lista$Var2),]

Javier Rubén Marcuzzi

De: Oscar Benitez
Enviado: martes, 11 de octubre de 2016 15:53
Para: Javier Marcuzzi
CC: R-help-es
Asunto: Re: [R-es] Colapsar una matriz con NA en una única fila

Javier
Muchas gracias por su respuesta
Aunque no está funcionando, pues si ejecuto:

EncDTE1<- t.EncDTE1[ !is.na(t.EncDTE1$Var1),]  obtengo Var1, Var2, Var3,...Varn 
con datos "texto", NA, NANA

Pero al ejecutar

EncDTE1<- t.EncDTE1[ !is.na(t.EncDTE1$Var2),]  obtengo Var1, Var2, Var3,...Varn 
con datos NA,"texto", NANA


Estoy tratando de dar la vuelta con el loop otra vez, pero aún no lo consigo...
Muchas gracias




El 11 de octubre de 2016, 15:27,  escribió:
Estimado Oscar Benitez
 
Yo utilizo algo como lo siguiente: 
 
Datos<- Datos[ !is.na(Datos$DatoX),]    #Solo dejo filas en las que las 
tratamiento son diferentes de cero
 
Javier Rubén Marcuzzi
 
De: Oscar Benitez
Enviado: martes, 11 de octubre de 2016 15:22
Para: R-help-es
Asunto: [R-es] Colapsar una matriz con NA en una única fila
 
Hola
 
Consulto por un problema que no consigo resolver.
 
Tengo un dataframe con muchas columnas todas de texto. Cada columna tiene
solamente un valor válido y el resto son NAs. También cada fila tiene un
único valor válido. Quiero colapsar ese data frame en uno que tenga
solamente una fila y todas las columnas. Intenté con loops, while,  apply y
otros parecidos pero no lo logro
 
El ejemplo del data frame sería así:
V1    V2  V3
a33        10-04
     
    d52725   
     
 
Y quiero lograr algo así
 
V1  V2    V3
a33 d52725 10-04
 
Mi script es así:
 
Nombre.1<-colnames(df0) #df0 es el dataframe que obtengo con NA
 
df<-data.frame(1) #inicio un nuevo data frame con una variable sin nombre y
valor 1
 
 
for (i in Nombre.1)
  {merge(df, subset(paste("df0$",i,sep=''),!is.na(paste("df0$",i,sep=''}
#el loop
 
Cualquier ayuda será apreciada
 
-- 
Oscar Benitez
 
    [[alternative HTML version deleted]]
 
___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es
 




-- 
Oscar Benitez


[[alternative HTML version deleted]]

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