John Fox | 25 Oct 16:43 2014
Picon
Picon

R Markdown and scan()

Dear JJ and list members,

I wonder whether it's possible to get scan() to read in-line data in an R Markdown document. The following
code, for example, works (of course) when entered in the R console but fails in an R block in an R Markdown
document (using an up-to-date version of RStudio):

```{r}
x <- scan()
1 2 3
4 5 6

x
````

I'm aware of a couple of work-arounds, such as putting the data in a file or a character string (as below), but
am interested in whether it's possible to get this to work directly.

```{r}
text <- "
1 2 3
4 5 6
"
(x <- scan(file=textConnection(text)))
````

Any help would be appreciated.

John

------------------------------------------------
(Continue reading)

Axel Urbiz | 25 Oct 10:51 2014
Picon

Rubik cube-like plot in R

Hi there,

I need to create a Rubik cube plot in R, except that I don't need the face
colours (all faces with the same colour is fine).

I'd appreciate your guidance in terms of what graphic tool would be best
for this purpose.

Best,
Axel.

	[[alternative HTML version deleted]]

Hafizuddin Arshad | 25 Oct 04:14 2014
Picon

Finding Sum

Hi,

I really need help on this. I have this data set:

structure(list(Year = c(1971L, 1971L, 1971L, 1971L, 1971L, 1971L,
1971L, 1971L, 1971L, 1972L, 1972L, 1972L, 1972L, 1972L, 1972L,
1973L, 1973L, 1973L, 1973L, 1973L, 1973L, 1973L, 1973L, 1973L,
1973L, 1974L, 1974L, 1974L, 1974L, 1974L, 1974L, 1974L, 1974L,
1974L, 1975L, 1975L, 1975L, 1975L, 1975L, 1975L, 1975L, 1976L,
1976L, 1976L, 1976L, 1976L, 1976L, 1976L, 1976L, 1976L, 1977L,
1977L, 1977L, 1977L, 1977L, 1977L, 1978L, 1978L, 1978L, 1978L,
1978L, 1978L, 1978L, 1979L, 1979L, 1979L, 1979L, 1979L, 1980L,
1980L, 1980L, 1980L, 1980L, 1980L, 1980L, 1981L, 1981L, 1981L,
1981L, 1982L, 1982L, 1982L, 1982L, 1982L, 1982L, 1983L, 1983L,
1983L, 1983L, 1983L, 1983L, 1983L, 1983L, 1983L, 1984L, 1984L,
1984L, 1985L, 1985L, 1985L, 1985L, 1985L, 1985L, 1987L, 1987L,
1987L, 1987L, 1987L, 1987L, 1988L, 1988L, 1988L, 1988L, 1988L,
1988L, 1988L, 1989L, 1989L, 1989L, 1989L, 1989L, 1989L, 1989L,
1990L, 1990L, 1991L, 1991L, 1991L, 1991L, 1991L, 1991L, 1991L,
1991L, 1991L, 1991L, 1991L, 1992L, 1992L, 1993L, 1993L, 1993L,
1994L, 1994L, 1994L, 1994L, 1994L, 1994L, 1994L, 1994L, 1994L,
1994L, 1994L, 1994L, 1994L, 1995L, 1995L, 1995L, 1995L), Month = c(3L,
6L, 10L, 10L, 11L, 11L, 11L, 11L, 12L, 2L, 9L, 12L, 12L, 12L,
12L, 3L, 9L, 10L, 11L, 11L, 11L, 11L, 12L, 12L, 12L, 8L, 9L,
11L, 11L, 11L, 11L, 11L, 12L, 12L, 1L, 2L, 4L, 10L, 11L, 12L,
12L, 10L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 9L, 10L, 11L,
12L, 12L, 12L, 6L, 6L, 9L, 11L, 11L, 12L, 12L, 10L, 11L, 11L,
11L, 11L, 7L, 9L, 11L, 12L, 12L, 12L, 12L, 7L, 11L, 12L, 12L,
7L, 10L, 12L, 12L, 12L, 12L, 5L, 11L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 11L, 12L, 12L, 3L, 3L, 11L, 12L, 12L, 12L, 6L, 12L,
(Continue reading)

Thomas Nyberg | 25 Oct 00:37 2014
Picon

readChar maxing out at screen width when using gnu screen?

I am running:

R version 3.1.1 (2014-07-10) -- "Sock it to Me"
Platform: x86_64-unknown-linux-gnu (64-bit)

It is an Amazon 64 Linux instance with the following version: 
3.3.4-5.fc17.x86_64

I compiled R myself as well as the newest version of gnu screen.

I create a file with a couple hundred bytes by doing the following 
(using bash):

 > for i in {1..100}; do echo $i >> testfile; done

Next I load R and run the following:

 > readChar('testfile', 200)
[1] 
"1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n2"

That output is exactly the width of the screen (as in the window in gnu 
screen). If I double the screen width (which I can do by removing my 
split screen mode), it will return the following string:

[1] 
"1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n41\n42\n43\n44\n"

Now my normal belief here would be that screen is somehow causing the 
bug, but honestly that makes no sense at all. What global changes could 
(Continue reading)

dotnet sql | 24 Oct 23:50 2014
Picon

RCurl memory leak in getURL method

Hi

It looks like we have hit a bug in RCurl. The method getURL seems to be
leaking memory. A simple test case to reproduce the bug is given here:

>library(RCurl)
>handle<-getCurlHandle()
>range<-1:100
>for (r in range) {x<-getURL(url="news.google.com.au",curl=handle)}

If I run this code, the memory allocated to the R session is never
recovered.

We are using RCurl for some long running experiments and we are running out
of memory on the test system.

The specs of our test system are as follows:
OS: Ubuntu 14.04 (64 bit)
Memory: 24 GB
RCurl version: 1.95-4.3

Any ideas about how to get around this issue?

Thanks

	[[alternative HTML version deleted]]

Eric Archer - NOAA Federal | 24 Oct 23:54 2014
Picon

"command not found" from system() call in GUI with proper PATH

<Apologies for the cross-posting, but I couldn't tell if this was a general
R issue, or Mac-specific>

When running a system file from within R, I have just started to get a
"command not found" error although my PATH seems to be properly set and I
can run the same system file from the terminal. The program I am trying to
run is 'fastsimcoal' and is in /usr/local/bin. I confirm this in the
terminal with

SWC-EARCHER-ML-3:~ eric.archer$ which fastsimcoal
/usr/local/bin/fastsimcoal

In the examples below, Sys.getenv("PATH") shows that /usr/local/bin is in
the PATH. I get the same error for any program in /usr/local/bin. However,
programs in other folders in the path seem to run through system()
properly.

Also, note that the return from Sys.getenv("PATH") is the same for running
in R-Studio vs. R in the terminal, but is truncated in the R GUI. As far as
I can tell I do not have a .Rprofile file in my default working directory,
R_HOME, or R_HOME/etc.

A final piece of information: I have just upgraded to OSX Yosemite v10.10.
This was not happening at some point prior to the upgrade, but it has been
a while since I tried this particular command, so I do not know if it was
working immediately prior to the OS upgrade.

Any help or insight is greatly appreciated.

Cheers,
(Continue reading)

Andrews, Chris | 24 Oct 22:11 2014
Picon
Picon

Default Display of hist.Date with breaks="months"

Hi all,

The default display of random dates with breaks="months" is less than optimal.

set.seed(20141024)
random.dates <- as.Date("2001/1/1") + round(365*stats::runif(100))
hist(random.dates, "months")

The 13 edges of the 12 bars are labelled "Dec", "Jan", "Feb", ..., "Nov", "Dec".
The first bar represents the number of days in January, the label on the RIGHT edge of the bar.

It is clear what is happening if the format is changed.

hist(random.dates, "months", format = "%d %b", las=2)

The labels are now "Dec 31", "Jan 31", "Feb 28", ....  which isn't intuitive to me.

I'd rather have this as the default behavior (but without having to explicitly create the breaks)

hist(random.dates, breaks=as.Date(c(paste("2001",1:12,"1",sep="/"), "2002/1/1")), right=FALSE)
hist(random.dates, breaks=as.Date(c(paste("2001",1:12,"1",sep="/"), "2002/1/1")),
right=FALSE, format = "%d %b", las=2)

I guess none of that is a question.  Have a nice weekend.

Chris

R version 3.1.1 (2014-07-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)

(Continue reading)

Dan Vatnik | 24 Oct 17:31 2014
Picon

Extra documentation not appearing

Hi,

I have loaded my first package to CRAN and I have noticed a documentation
issue.
When I install the package from CRAN, it installs a Windows binary since I
am using a Windows machine.
I have a PDF file in my doc folder. Originally, it was in the inst/doc/
folder but when I load the binary, there
is no more inst folder so the doc folder is directly in the package folder.
The issue arises in my package's index page. It has a link to the
DESCRIPTION file and it has a link to the
Extra documentation section on top. The link to the Extra documentation
does not lead anywhere so my PDF
is inaccessible.
My package is named "traj".
Do you know what might be the issue?

Thank You,
Dan

	[[alternative HTML version deleted]]

Guido Biele | 24 Oct 12:06 2014

rgdal: Convert ESRI ArcGis geo database (gdb directory) to geojson, or shapefile map

Hello,

I have an ESRI  ArGis geo database directory which I would like to convert
to geojson or a shape file (or anything else that I can read into R).

Unfortunately that does not work out of the box with rgdal, because it does
not come with the fileGDB or openfileGDB driver.
I could successfully install gdal and the fileGDB driver/extension, but it
seems that i can use gdal only to convert the gdb file to a SQL database.

So before I start to learn about SQL, I thought I ask if anybody can point
me to a tutorial or similar that explains how to convert the contents of a
GDB folder to a R-readable format.

I also wondered if it would be possible to let rgdal know that it could
access the required drivers because I installed them manually.
I would appreciate any hint about this too!

Thanks in advance!
Best Guido

	[[alternative HTML version deleted]]

Alemu Tadesse | 24 Oct 19:13 2014
Picon

I cannot get files from this site

Dear r-help users,

I have been trying to download files from this link
ftp://ftp.bsrn.awi.de/tat/tat0100.dat.gz sinsce yesterday using
download.file (which I use very often for such task) and unfortunately it
did not work for me for this ftp site. I can manually download the files -
but not with script with both R and python. Is there any tip for this ?

Thank you in Advance and happy Friday.

Alemu

	[[alternative HTML version deleted]]

Mike Beddo | 24 Oct 18:24 2014

Error: Line starting 'Package: tools ...' is malformed!

I'm building R-3.1.1 (64 bit) from source on AIX 7.1. It was going well until I hit this:

xlc_r -q64 -Wl,-brtl -Wl,-G -Wl,-bexpall -Wl,-bnoentry -lc -L/opt/freeware/lib64
-L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib64:/opt/freeware/lib:/usr/lib:/lib
-Wl,-bmaxdata:0x80000000 -o tools.so text.o init.o Rmd5.o md5.o signals.o install.o getfmts.o
http.o gramLatex.o gramRd.o -lm
make[6]: Entering directory `/home/meb/source/R-3.1.1/src/library/tools/src'
mkdir -p -- ../../../../library/tools/libs
make[6]: Leaving directory `/home/meb/source/R-3.1.1/src/library/tools/src'
make[5]: Leaving directory `/home/meb/source/R-3.1.1/src/library/tools/src'
make[4]: Leaving directory `/home/meb/source/R-3.1.1/src/library/tools'
Error: Line starting 'Package: tools ...' is malformed!
Execution halted
make[3]: *** [all] Error 1
make[3]: Leaving directory `/home/meb/source/R-3.1.1/src/library/tools'
make[2]: *** [R] Error 1
make[2]: Leaving directory `/home/meb/source/R-3.1.1/src/library'
make[1]: *** [R] Error 1
make[1]: Leaving directory `/home/meb/source/R-3.1.1/src'
make: *** [R] Error 1
$ oslevel
7.1.0.0

Can someone help?

Thanks,

Mike

(Continue reading)


Gmane