Re: [R] Use case for HDF5 dataspace interface

2017-08-03 Thread Koustav Pal
1. This relates to the package *rhdf5* and its implementation of the HDF5
dataspace interface. I am asking for an example of how other people who use
this package make use of the HDF5 data space interface exposed by the
library.

Longer answer:

As per my understanding, the dataspace interface exposes data locations
within a dataspace, but even while retrieving data from an hdf5 file using
methods implemented within rhdf5, the methods need to convert the requested
data retrieval call to dataspace locations. So what is the usefulness in
using the dataspace interface, and can I see this usefulness in a code
example using the rhdf5 dataspace interface.


2. Not related to comp bio.



---
Koustav Pal,
PhD student in Computational Biology,
Francesco Ferrari's group,
IFOM - The FIRC Institute of Molecular Oncology
Milan, Italy.

On 1 August 2017 at 16:30, Bert Gunter <bgunter.4...@gmail.com> wrote:

> 1. What does this have to do with R?
>
> 2. If it concerns computational biology, the Bioconductor Help list
> may be a better place to post.
>
>
> Cheers,
> Bert
>
>
> Bert Gunter
>
> "The trouble with having an open mind is that people keep coming along
> and sticking things into it."
> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>
>
> On Tue, Aug 1, 2017 at 2:28 AM, Koustav Pal <koustavpal.de...@gmail.com>
> wrote:
> > This question is a clone of my stackoverflow question which never got
> > answered (o_O). Therefore I am posting it here. I would really like some
> > inputs if possible.
> >
> > I am currently building some applications which make use of HDF5 files.
> >
> > I have already taken a look at the hdfgroup website with regards to
> > dataspace <https://support.hdfgroup.org/HDF5/doc/H5.user/Dataspaces.html
> >
> > and I think I understand the concept. But I am very much unable to
> > understand it's real world use.
> >
> > Can someone please, tell me what is the dataspace interface supposed to
> be
> > used for?
> >
> > Currently, I think if I load a matrix of size 1.5M x 1.5M I may be able
> to
> > store dataspace coordinates and then retrieve that piece of data much
> > faster. Is this correct?
> >
> > It would be great if you can provide some example use cases.
> >
> >
> > Link to original question:
> > https://stackoverflow.com/questions/44697599/hdf5-
> dataspace-interface-what-does-it-do-and-what-is-its-real-world-applicati
> >
> > 
> ---
> > Koustav Pal,
> > PhD student in Computational Biology,
> > Francesco Ferrari's group,
> > IFOM - The FIRC Institute of Molecular Oncology
> > Milan, Italy.
> >
> > [[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.


[R] Use case for HDF5 dataspace interface

2017-08-01 Thread Koustav Pal
This question is a clone of my stackoverflow question which never got
answered (o_O). Therefore I am posting it here. I would really like some
inputs if possible.

I am currently building some applications which make use of HDF5 files.

I have already taken a look at the hdfgroup website with regards to
dataspace <https://support.hdfgroup.org/HDF5/doc/H5.user/Dataspaces.html>
and I think I understand the concept. But I am very much unable to
understand it's real world use.

Can someone please, tell me what is the dataspace interface supposed to be
used for?

Currently, I think if I load a matrix of size 1.5M x 1.5M I may be able to
store dataspace coordinates and then retrieve that piece of data much
faster. Is this correct?

It would be great if you can provide some example use cases.


Link to original question:
https://stackoverflow.com/questions/44697599/hdf5-dataspace-interface-what-does-it-do-and-what-is-its-real-world-applicati

---
Koustav Pal,
PhD student in Computational Biology,
Francesco Ferrari's group,
IFOM - The FIRC Institute of Molecular Oncology
Milan, Italy.

[[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] R Programming help needed - Returning dataframes + 2 Variables dynamically

2017-07-28 Thread Koustav Pal
When you pass a variable to a function only the value is passed on, the
variable itself remains unchanged. Updated x and y values will be in
test_data[[1]] and test_data[[2]] respectively.

---
Koustav Pal,
PhD student in Computational Biology,
Francesco Ferrari's group,
IFOM - The FIRC Institute of Molecular Oncology
Milan, Italy.

On 28 July 2017 at 11:08, Mathew Guilfoyle <mrguilfo...@gmail.com> wrote:

> The returned values are in the list you assign to test_data, the original
> x and y are not modified, i.e the returned value for x will be
> test_data[[1]] and for y will be test_data[[2]].  Using the same variable
> names in the function and test is perhaps what is leading to confusion.
>
> > On 28 Jul 2017, at 09:13, Vijaya Kumar Regati <
> vijayakumar.reg...@m3bi.com> wrote:
> >
> > Hi,
> >
> >
> > That was very useful information. Thanks.
> >
> > But still I am not able to get the desired output with updated code.
> >
> > Kindly help if you have any further thoughts ...
> >
> > Updated code :
> > x <- 0
> > y <- 0
> >
> > Logic_fn <- function(x,y){
> >
> > print("Passed Values")
> > print(x)
> > print(y)
> > x <- x + 1
> > y <- y + 1
> >
> > print("After addition :")
> > print(x)
> > print(y)
> >
> > test_data <- rbind(x,y)
> > test_data <- data.frame(test_data)
> > return(list(x,y,test_data))
> > }
> >
> > for ( i in 1:1 ) {
> > test_data <- Logic_fn(x,y)
> > print("Returned Values :")
> > print(x)
> > print(y)
> > }
> >
> >
> > Wrong output :
> > [1] "Passed Values"
> > [1] 0
> > [1] 0
> > [1] "After addition :"
> > [1] 1
> > [1] 1
> > [1] "Returned Values :"
> > [1] 0
> > [1] 0
> >
> >
> > With Regards,
> > Vijaya Kumar Regati
> > Technical Lead, M3bi India Private Ltd
> > Work: 040-67064732
> >
> > 
> > From: Koustav Pal <koustavpal.de...@gmail.com>
> > Sent: Friday, July 28, 2017 12:25:54 PM
> > To: Vijaya Kumar Regati
> > Cc: vijaykr@gmail.com; r-help@R-project.org
> > Subject: Re: [R] R Programming help needed - Returning dataframes + 2
> Variables dynamically
> >
> > c() is used for constructing vectors. Or in other words using the method
> c(x,y) provides a vector of length 2 (hopefully). Therefore, you are
> pushing a single vector to your function and not two arguments as you want.
> >
> > It should be Logic_fn(x,y) not Logic_fn(c(x,y)).
> >
> > Furthermore, i would recommend reading up on how function constructs
> work. Two return statements within a function are redundant because the
> function will exit after the first return statement, and anything else just
> creates more ambiguity. If you want to return the x y variables as well,
> you should use a list like so, list(test_data, x, y) and then retrieve
> information from the list like this Boo[[1]].
> >
> > Finally i would also like to point out that you should note R's
> behaviour unless explicitly stated while calling the function is to assign
> the first argument to the first declared variable and the second to the
> second. So, if you called Logic_fn(y,x), then y will be assigned to x and x
> to y. So to avoid such a scenario you can mention it explicitly as
> Logic_fn(y=y,x=x).
> >
> >
> > On Jul 28, 2017 8:39 AM, "Vijaya Kumar Regati" <
> vijayakumar.reg...@m3bi.com<mailto:vijayakumar.reg...@m3bi.com>> wrote:
> > Hi,
> >
> >
> > Can someone please help me on below issue I am facing :
> >
> >
> > I am trying to play with returning a dataframe+2 variables using a fn.
> > But facing an issue :
> >
> > Error in Logic_fn(c(x, y)) : argument "y" is missing, with no default
> >
> > This is the code I am using :
> >
> >
> > x <- 0
> > y <- 0
> >
> > Logic_fn <- function(x,y){
> > x <- x + 1
> > y < y + 1
> > test_data <- rbind(x,y)
> > test_data <- data.frame(test_data)
> > return(test_data)
> > return(c(x,y))
> > }
> >
> > for ( i in 1:1) {
> >  test_data <- Logic_fn(c(x,y))
> > test_data[1]
> > test_data[2]
> > test_data
> >
> > }
> >
> > With Regards,
> > Vijaya Kumar Regati
> >
> >
> > Disclaimer: IMPORTANT NOTICE: This e-mail

Re: [R] R Programming help needed - Returning dataframes + 2 Variables dynamically

2017-07-28 Thread Koustav Pal
c() is used for constructing vectors. Or in other words using the method
c(x,y) provides a vector of length 2 (hopefully). Therefore, you are
pushing a single vector to your function and not two arguments as you want.

It should be Logic_fn(x,y) not Logic_fn(c(x,y)).

Furthermore, i would recommend reading up on how function constructs work.
Two return statements within a function are redundant because the function
will exit after the first return statement, and anything else just creates
more ambiguity. If you want to return the x y variables as well, you should
use a list like so, list(test_data, x, y) and then retrieve information
from the list like this Boo[[1]].

Finally i would also like to point out that you should note R's behaviour
unless explicitly stated while calling the function is to assign the first
argument to the first declared variable and the second to the second. So,
if you called Logic_fn(y,x), then y will be assigned to x and x to y. So to
avoid such a scenario you can mention it explicitly as Logic_fn(y=y,x=x).


On Jul 28, 2017 8:39 AM, "Vijaya Kumar Regati" 
wrote:

Hi,


Can someone please help me on below issue I am facing :


I am trying to play with returning a dataframe+2 variables using a fn.
But facing an issue :

Error in Logic_fn(c(x, y)) : argument "y" is missing, with no default

This is the code I am using :


x <- 0
y <- 0

Logic_fn <- function(x,y){
x <- x + 1
y < y + 1
test_data <- rbind(x,y)
test_data <- data.frame(test_data)
return(test_data)
return(c(x,y))
}

for ( i in 1:1) {
  test_data <- Logic_fn(c(x,y))
test_data[1]
test_data[2]
test_data

}

With Regards,
Vijaya Kumar Regati


Disclaimer: IMPORTANT NOTICE: This e-mail (including any attachments) are
confidential, may contain proprietary or privileged information and is
intended for the named recipient(s) only. If you are not the intended
recipient, any disclosures, use, review, distribution, printing or copying
of the information contained in this e-mail message and/or attachments to
it are strictly prohibited. If you have received this email in error,
please notify the sender by return e-mail or telephone immediately and
permanently delete the message and any attachments.

[[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] Ifelse statements and combining columns

2017-07-24 Thread Koustav Pal
That ifelse statement is a mess, it is missing brackets, comma separators
between arguments and & or | between conditions. The bracket error points
towards the invalid bracket you had in the second ifelse since it expects
and yes and a no argument alongside conditions.

ifelse(test = (dat$cond == "cond1" | dat$cond == "cond2"  | dat$cond ==
"cond3" | dat$cond == "cond4"),yes = "Uniform" , no =
ifelse(test = (dat$cond == "cond5" | dat$cond =="cond6" | dat$cond ==
"cond7" | dat$cond == "cond8"), yes = "Biased Low" ,no = "Biased High"))

This should be what you want.


cbind is a function, therefor it is not subsettable.

if you are passing 2 arguments to cbind then cbind takes the form
cbind(c(1:n),c(1:n)) and constructs a matrix of dimension 2 x n. For
unequal vectors the shorter vector will be recycled.


On 24 July 2017 at 14:23, Kirsten Morehouse  wrote:

> Hi everyone,
>
> I'm having some trouble with my ifelse statements.
>
> I'm trying to put 12 conditions within 3 groups. Here is the code I have so
> far:
>
> dat$cond <- ifelse(test = dat$cond == "cond1" | dat$cond == "cond2"  |
> dat$cond == "cond3" dat$cond == "cond4"
>yes = "Uniform"
>no = ifelse(test = dat$cond == "cond5" | dat$cond ==
> "cond6") | dat$cond == "cond7" dat$cond == "cond8"
>yes = "Biased Low"
>no = "Biased High" )
>
>
> I keep getting an error statement about an invalid ). I've tried several
> permutations to fix, but without luck.
>
> Also, can anyone help me bind columns together? I've tried:
>
>  cbind[, c(15:25)] but get the error:  object of type 'closure' is not
> subsettable
>
> Thank you in advance!
>
> Kirsten
>
> [[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.