OpasnetUtils/Opasnet.data: Difference between revisions

From Opasnet
Jump to navigation Jump to search
(Created page with "Category:Opasnet Category:R tools {{method|moderator=|stub=Yes}} ==Description== opasnet.data downloads a file from Finnish Opasnet wiki, English Opasnet wiki, or Opasne...")
 
mNo edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Category:Opasnet]]
[[Category:Opasnet]]
[[Category:R tools]]
[[Category:R tools]]
[[Category:OpasnetUtils]]
{{method|moderator=|stub=Yes}}
{{method|moderator=|stub=Yes}}


Line 8: Line 9:
==Parameters==
==Parameters==
* filename is the URL without the first part (see below), wiki is "opasnet_en", "opasnet_fi", or "M-files".
* filename is the URL without the first part (see below), wiki is "opasnet_en", "opasnet_fi", or "M-files".
* If table is TRUE then a table file for read.table function is assumed; all other parameters are for this read.table function.
* For reading files, use '''opasnet.data'''. For reading csv files as data.frames, use '''opasnet.csv'''.


==Parameters==
==Parameters==


==Code==
==Code==
<rcode
name="answer"
label="Initiate functions"
graphics="1"
>
library(OpasnetBaseUtils)
library(xtable)


n <- 5
https://www.opasnet.org/svn/opasnet_utils/trunk/R/opasnet.R
 
# OPASNET.DATA #####################################
## opasnet.data downloads a file from Finnish Opasnet wiki, English Opasnet wiki, or Opasnet File.
## Parameters: filename is the URL without the first part (see below), wiki is "opasnet_en", "opasnet_fi", or "M-files".
## If table is TRUE then a table file for read.table function is assumed; all other parameters are for this read.table function.
 
opasnet.data <- function(filename, wiki = "opasnet_en", table = FALSE, ...)
{
if (wiki == "opasnet_en")
{
file <- paste("http://en.opasnet.org/en-opwiki/images/", filename, sep = "")
}
if (wiki == "opasnet_fi")
{
file <- paste("http://fi.opasnet.org/fi_wiki/images/", filename, sep = "")
}
if (wiki == "M-files")
{
file <- paste("http://http://fi.opasnet.org/fi_wiki/extensions/mfiles/", filename, sep = "")
}
 
#if(table == TRUE) {
#file <- re#ad.table(file, header = FALSE, sep = "", quote = "\"'",
#          dec = ".", row.names, col.names,
#          as.is = !stringsAsFactors,
#          na.strings = "NA", colClasses = NA, nrows = -1,
#          skip = 0, check.names = TRUE, fill = !blank.lines.skip,
#          strip.white = FALSE, blank.lines.skip = TRUE,
#          comment.char = "#",
#          allowEscapes = FALSE, flush = FALSE,
#          stringsAsFactors = default.stringsAsFactors(),
#          fileEncoding = "", encoding = "unknown")
#return(file)
#}
#else {return(ge#tURL(file))}
}
 
</rcode>


==See also==
==See also==

Latest revision as of 23:10, 5 November 2012



Description

opasnet.data downloads a file from Finnish Opasnet wiki, English Opasnet wiki, or Opasnet File.

Parameters

  • filename is the URL without the first part (see below), wiki is "opasnet_en", "opasnet_fi", or "M-files".
  • For reading files, use opasnet.data. For reading csv files as data.frames, use opasnet.csv.

Parameters

Code

https://www.opasnet.org/svn/opasnet_utils/trunk/R/opasnet.R

See also