problems opening hdf in R - r

I have scanned through and can't seem to find any thing that deals with "hdf" in R. I currently use rhdf5 but it works more with the hdf5 file format on R 3.0.2 for windows. any suggestions please?

I finally resolved it by downloading ENVIview and Beat software from ENVISAT directly. It allows for easy changes between data formats. the h4toh5 software too was a good option but would ony run with C library. Thanks, Frank.

Related

.json file is too large to be opened in R with rjson

I have a 5.1 GB json file that I would like to read in R using rjson. I want afterwards to construct a dataframe from it, however it won't load because the size is too large.
Is there any way to work around it?
Thank you for your help =)
Nina, I would recommend you using jsonlite package instead of rjson.
library(jsonlite)
your_json <- "your_path.json"
unpacked_json <- jsonlite::stream_in(textConnection(readLines(your_json, n=100000)),verbose=F)
Here you limit the page size to let IDE correctly read your JSON file. For more information I would also recommend you to make some research on this topic:
https://community.rstudio.com/t/how-to-read-large-json-file-in-r/13486
Reading a huge json file in R , issues
I know for sure that it is sometimes really hard to cope with documentation (and as all other human beings we are lazy); and I don't like to read doc-n myself, but I highly recommend you to make yourself familiar with jsonlite documentation and vignettes. Here's the CRAN link: https://cran.r-project.org/web/packages/jsonlite/index.html

readRDS fails to read in file in R. Is there an alternative?

I'm trying to read the RDS file I downloaded from here:
https://github.com/jcheng5/googleCharts/tree/master/inst/examples/bubble
However, when I try to load it into RStudio via:
data<- readRDS('/Users/nathanf/shinyCharts/healthexp.rds')
I get the Error: unknown input format.
I've searched and found a possible solution already posted on StackOverflow, but the solutions mentioned in it do not work.
Does not work:
readRDS(file) in R
Please note, I'm trying to do this with a freshly installed copy of R (3.2.1) on a Mac running Yosemite.
I've found articles online that say the readRDS function is now defunct. https://stat.ethz.ch/R-manual/R-devel/library/base/html/base-defunct.html
Sooooooo....dearest community, what should I do? Is there another way to read RDS files using a new function?
Any help would be much appreciated.
Thank you,
Nathan
I faced exactly the same problem and I can recommend switching from .rds objects into .RData objects. Simply:
save(random_forest1, "random_forest2.RData")
and then
load("random_forest2.RData")
Just for clarity, you will find your object named as random_forest1 after using load function

Export output and command lines in R [duplicate]

Is there an easy way to have R record all input and output from your R session to disk while you are working with R interactively?
In R.app on Mac OS X I can do a File->Save..., but it isn't much help in recovering the commands I had entered when R crashes.
I have tried using sink(...,split=T), but it doesn't seem to do exactly what I am looking for.
Many of us use ESS / Emacs for this very reason. Saving old sessions with extension '.Rt' even gives you mode-specific commands for re-running parts of your session.
Greg Snow wrote recently on the R-help list (a very valuable resource, SO R people!):
"You may also want to look at ?TeachingDemos::txtStart as an alternative to sink, one advantage is that the commands as well as the output can be included. With a little more work you can also include graphical output into a transcript file."
r-help
Check out the savehistory() command
I'm not sure yet how to answer an answer, but there is an updated version of Ranke's vim r-plugin called r-plugin2 available here. It seems more user-friendly and robust than the original.
Emacs is good, but for those of us with a vi preference there's the vim-r plugin at:
http://www.uft.uni-bremen.de/chemie/ranke/index.php?page=vim_R_linux
It works brilliantly and has a tiny memory footprint.

How to read .arff file with R?

Is there any way to do that?
Yes, i'm new to R.
read.arff in package foreign reads data from Weka Attribute-Relation File Format (ARFF) files.
Update: there is a new package on CRAN:
farff: A Faster 'ARFF' File Reader and Writer
In general the answer to questions like this can be found via the sos package, which accesses a full-text search of all the packages on CRAN.
install.packages("sos")
library("sos")
findFn("arff")
finds functions in the foreign (as noted above) and RWeka packages. Since foreign is a recommended package, it will be installed on your system by default. Hence you would have found the answer with
help.search("arff")
in the first place, without installing the sos package. sos is still worth having for times when the string you are searching for isn't in the metadata (title, keywords, alias, etc.), which is all that help.search searches, or not in a package you already have installed on your system (ditto). (Looking through the R Data Import/Export Manual, which also comes with your system, is generally useful but would not have found the answer to this question ...)
It might be useful to know about the RWeka version on the off chance that the version in foreign (which you should try first) fails for some reason.
Even though this question is already answered I realize there is another noteworthy solution. Check the RWeka package that enables you to read and write arff files. Plus it gives you a wrapper for Weka functions. So you could use Weka functionality without installing Weka itself (though it installs .jars). See also this doku -> read.arff.
If you only care about the data and not the relations, you can just use:
read.csv("data.arff", header=FALSE, comment.char = "#")
The easiest way to do it is using the "RWeka" library which has read.arff() function that reads .arff files.
library(RWeka)
test=read.arff("../Test/test.arff")
Hope this helps.

maintaining an input / output log in R

Is there an easy way to have R record all input and output from your R session to disk while you are working with R interactively?
In R.app on Mac OS X I can do a File->Save..., but it isn't much help in recovering the commands I had entered when R crashes.
I have tried using sink(...,split=T), but it doesn't seem to do exactly what I am looking for.
Many of us use ESS / Emacs for this very reason. Saving old sessions with extension '.Rt' even gives you mode-specific commands for re-running parts of your session.
Greg Snow wrote recently on the R-help list (a very valuable resource, SO R people!):
"You may also want to look at ?TeachingDemos::txtStart as an alternative to sink, one advantage is that the commands as well as the output can be included. With a little more work you can also include graphical output into a transcript file."
r-help
Check out the savehistory() command
I'm not sure yet how to answer an answer, but there is an updated version of Ranke's vim r-plugin called r-plugin2 available here. It seems more user-friendly and robust than the original.
Emacs is good, but for those of us with a vi preference there's the vim-r plugin at:
http://www.uft.uni-bremen.de/chemie/ranke/index.php?page=vim_R_linux
It works brilliantly and has a tiny memory footprint.

Resources