Re: [R] How to import an excel data file

2023-09-24 Thread Rainer Hurling

Dear David,

Am 23.09.23 um 01:10 schrieb Parkhurst, David:

I know I should save it as a .csv file, which I have done.
I�m told I should use the read_excel() function from the readxl package.
My question is, how do I express the location of the file.  The file is named 
KurtzData.csv.
Its location in my Mac files is DFPfiles/ae/FriendsMonroe/KurtzData.csv
How exactly---What �, etc.---do I type with its name in the read_excel() 
function?
It�s been a long time since I�ve used R.
Thanks for any help.


[[alternative HTML version deleted]]


Even though there are already some answers, I would like to comment on 
the question.


The advice to export the excel data to a csv file to import it 
afterwards from the readxl package into R using read_excel() is a bit 
around the corner. Instead, the readxl package can better read the Excel 
format directly, both the one as .xls format and the new .xlsx format.


I am basically a proponent for reading original data (here Excel) 
directly and not via an intermediate format like csv. This avoids, among 
other things, that subsequently supplemented or corrected original Excel 
data are not converted to csv by mistake and are thus not available the 
next time they are imported into R.


In order to take the path to the data into account when reading it with 
read_excel(), you can proceed as follows (analogous if your path is 
relativ to your R working directory), for example:


Kurtz <- readxl::read_excel(path = 
'/DFPfiles/ae/FriendsMonroe/KurtzData.xlsx', sheet = 
'name-or-number-of-the-sheet')



Additional parameters may be necessary, e.g. to specify whether to skip 
headers when reading the Excel data. The help page for the function 
gives valuable hints here:


?readxl::read_excel


Besides the R package readxl I have also had very good experiences 
reading and writing Excel files with the package openxlsx ;)


HTH,
Rainer Hurling

__
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] is.na(strptime (...)) return TRUE on FreeBSD

2023-05-11 Thread Rainer Hurling

Am 11.05.23 um 16:15 schrieb Jinsong Zhao:

Hi there,

The following codes may cause the problem in R 4.3.0 on FreeBSD in my 
last post: Error in as.POSIXlt.character(x, tz, ...)


 > (d <- strptime("1970-01-01 12:00:00 UTC", "%Y-%m-%d %H:%M:%OS", tz = 
""))

[1] "1970-01-01 12:00:00 CST"
 > is.na(d)
[1] TRUE

In R 4.3.0 on windows,

 > (d <- strptime("1970-01-01 12:00:00 UTC", "%Y-%m-%d %H:%M:%OS", tz = 
""))

[1] "1970-01-01 12:00:00 CST"
 > is.na(d)
[1] FALSE

The only difference is the result of is.na().

Best,
Jinsong


I can't confirm, that is.na(d) returns TRUE on FreeBSD. On my boxes it 
always gives


  > (d <- strptime("1970-01-01 12:00:00 UTC",
   "%Y-%m-%d %H:%M:%OS", tz = ""))
  [1] "1970-01-01 12:00:00 CET"
  > is.na(d)
  [1] FALSE


# uname ...
14.0-CURRENT FreeBSD 14.0-CURRENT #0 main-n262658-b347c2284603: Sat Apr 
29 11:20:31 CEST 2023


Best wishes,
Rainer

__
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] A humble request

2022-07-02 Thread Rainer Hurling

Hi Muhammad,

Am 02.07.22 um 18:11 schrieb Muhammad Zubair Chishti:

Dear Experts,
I cannot find a package "wmtsa" for my R version "R 4.2.0". Kindly help me
to find it or share the link with me.
Although I tried the old version of "wmtsa" but failed.
Thank you for your precious time.

Regards
Muhammad Zubair Chishti

[[alternative HTML version deleted]]


AFAIK there is no package wmtsa anymore. It has been archived on 
2020-06-09 [1], the latest version was wmtsa_2.0-3.tar.gz from 2017-12-06.


[1] https://cran.r-project.org/src/contrib/Archive/wmtsa/

HTH,
Rainer

__
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 format

2020-05-12 Thread Rainer Hurling

Hi Medic,

Am 10.05.20 um 09:15 schrieb Medic:

I took a SAMPLE CODE (for Connected scatterplot) from the R gallery
and applied to MY DATA, but got:
"Don't know how to automatically pick scale for object ..."
P.S. 1) R ver. 4.0 (Yes, Jeff);  2) Attached: mydata_dput (1 КБ)

SAMPLE CODE
library(ggplot2)
library(dplyr)
library(hrbrthemes)
data <- 
read.table("https://raw.githubusercontent.com/holtzy/data_to_viz/master/Example_dataset/3_TwoNumOrdered.csv
", header=T)

data$date <- as.Date(data$date)

# Plot
data %>%
   tail(10) %>%
   ggplot( aes(x=date, y=value)) +
 geom_line( color="grey") +
 geom_point(shape=21, color="black", fill="#69b3a2", size=6) +
 theme_ipsum() +
 ggtitle("Evolution of bitcoin price")

==
MY DATA
mydata <- read.table("E:/mydata.csv", header=TRUE, sep=";", dec=",")

str(mydata)
'data.frame': 7 obs. of  2 variables:
  $ date : chr  "01.01.2000" "02.01.2000" ...
  $ value: int  11 12 ...

mydata$date <- as.Date(mydata$date, "%d.%m.%Y")

str(mydata$date)
Date[1:7], format: "2000-01-01"

# Bert, thanks for the explanation!
# Rainer, thanks for the specific code!

# And then the problem:
mydata %>%
 tail(10) %>%
 ggplot( aes(x=mydata, y=value)) +
 geom_line( color="grey") +
 geom_point(shape=21, color="black", fill="#69b3a2", size=6) +
 theme_ipsum() +
 ggtitle("Evolution")

"Don't know how to automatically pick scale for object of type
data.frame. Defaulting to continuous.
Error: Aesthetics must be either length 1 or the same as the data (7): x"


Perhaps only a little typo? Pls try

ggplot( aes(x=date, y=value))
  

__
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 format

2020-05-10 Thread Rainer Hurling
Am 10.05.20 um 04:17 schrieb Bert Gunter:
> $date is a factor, which is coded as numeric values internally, which
> as.date sees as numeric, and therefore:
> "as.Date will accept numeric data (the number of days since an epoch),
> but only if origin is supplied." (from ?as.Date)

as.Date is also able to read ISO date formatted strings by default (w/o
format).

as.Date("2013-04-28") works, as.Date("28.04.2013") not. The second
example needs as.Date("28.04.2013", format = "%d.%m.%Y").

> 
> You need to supply a format argument to as.Date to get it to handle
> the factor properly; e.g.
> "%d.%m.%Y"  should work. See ?strptime for formatting details.
> 
> 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 Sat, May 9, 2020 at 5:31 PM Medic  wrote:
>>
>> I took a SAMPLE CODE (for Connected scatterplot) from the R gallery
>> and applied to MY DATA, but got:
>> "Error in as.Date.numeric(mydata$date) : 'origin' must be supplied".
>> P.S. I can not understand ?as.Date()
>>
>> SAMPLE CODE
>> library(ggplot2)
>> library(dplyr)
>> library(hrbrthemes)
>> data <- 
>> read.table("https://raw.githubusercontent.com/holtzy/data_to_viz/master/Example_dataset/3_TwoNumOrdered.csv;,
>> header=T)
>>
>> str(data)
>> 'data.frame': 1822 obs. of  2 variables:
>>  $ date : chr  "2013-04-28" "2013-04-29" "2013-04-30" "2013-05-01" ...
>>  $ value: num  136 147 147 140 126 ...
>>
>> data$date <- as.Date(data$date)
>>
>> # Plot
>> data %>%
>>   tail(10) %>%
>>   ggplot( aes(x=date, y=value)) +
>> geom_line( color="grey") +
>> geom_point(shape=21, color="black", fill="#69b3a2", size=6) +
>> theme_ipsum() +
>> ggtitle("Evolution of bitcoin price")
>>
>>
>> MY DATA
>> mydata <- read.table("E:/mydata.csv", header=TRUE, sep=";", dec=",")
>>
>> str(mydata)
>> 'data.frame': 7 obs. of  2 variables:
>>  $ date : chr  "01.01.2000" "02.01.2000" "03.01.2000" "04.01.2000" ...
>>  $ value: int  11 12 13 14 15 16 17
>>
>> mydata$date <- as.Date(mydata$date)
>> Error in as.Date.numeric(mydata$date) : 'origin' must be supplied
>>
>> __
>> 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-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] Help with knitr pkg

2018-07-19 Thread Rainer Hurling
 33904 022
5:   51318643  5 3 M 000 149385
79765  33904   00504
6:   85833537  7 2 F 0003240182   
116998  46635   00504
CurrentBilled ClaimLineSavings StatusChangeMo   
  Grouping AppealOverturned PrimaryDXRevCodeCats
1:  14394.0802018-04  Ambulatory Health Care 
Facilities2  8442AmbSurgCare
2:  14394.0802018-04  Ambulatory Health Care 
Facilities2  8442AmbSurgCare
3:  14394.0802018-04  Ambulatory Health Care 
Facilities2  8442 MedSurgSuppandDevs
4:  14394.0802018-04  Ambulatory Health Care 
Facilities2  8442AmbSurgCare
5:  14394.0802018-04  Ambulatory Health Care 
Facilities2  8442 MedSurgSuppandDevs
6:  23472.9202018-04  Ambulatory Health Care 
Facilities1 M1712 MedSurgSuppandDevs
 AgeCat ClaimLevelSavings
1: [31-40]  0.00
2: [31-40]  0.00
3: [31-40]  0.00
4: [31-40]  0.00
5: [31-40]      0.00
6: [61-70]296.25


Maybe I am in over my head in this pursuit given my novice status with R, 
however, any direction would be appreciated.

Thank you.

WHP

Confidentiality Notice This message is sent from Zelis. ...{{dropped:15}}




Not sure, if I get you right. Seems, that you use knitr:: and code 
chunks without the necessary context?


Please have a look at https://rmarkdown.rstudio.com/ to get a more 
general understanding about using knitr within RMarkdown context.


HTH,
Rainer Hurling

__
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] Add annotation text outside of an xyplot (lattice package)

2016-09-24 Thread Rainer Hurling
Hi,

one possible solution is to use ltext().

ltext(xcoord, ycoord, label="TEST", adj=c(0.5,0.5))

You have to know or to find out best fitting coordinates.

Via adj you can control, if the text should adjust left, center or right
to the coords, and above, center or bottom of them.

HTH,
Rainer Hurling


Am 22.09.2016 um 16:04 schrieb Jun Shen:
> Dear list,
> 
> Just wonder if there is a way to add annotation text outside an xyplot,
> (e.g. the bottom of the plot). the panel.text seems only add text within
> the plot. Thanks.
> 
> Jun

__
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] read.xlsx function crashing R Studio

2016-08-29 Thread Rainer Hurling
Hi Kevin,

Am 21.08.2016 um 19:30 schrieb Kevin Kowitski:
> Hey everyone, 
> 
>I have used read.xlsx in the past rather than XLConnect for importing
> Excel data to R.  However, I have been finding now that the read.xlsx
> function has been causing my R studio to Time out.  I thought it might
> be because the R studio I had was out of date so I installed R studio
> X64 3.3.1 and reinstalled the xlsx package but it is still failing.  I
> have been trying to use XLConnect in it's place which has been working,
> excpet that I am running into memory error:
>   Error: OutOfMemoryError (Java): GC overhead limit exceeded
>   
> I did some online searching and found an option to increase memory:
>   "options(java.parameters = "-Xmx4g" )
> 
> but it resulted in this new memory Error:
> 
>  Error: OutOfMemoryError (Java): Java heap space
> 
> Can anyone provide me with some help on getting the read.xlsx function
> working?
> 
> -Kevin

There are interesting alternatives with other packages, as mentioned
before by Jim Holtman and Hadley Wickham.

If there are serious reasons to use the xlsx package, I had success with
the following, somewhat ugly workaround:


# Increase before package loading
options(java.parameters = "-Xmx8000m")
# Java garbage collection function
jgc <- function() .jcall("java/lang/System", method = "gc")
library(xlsx)
# if you like to use ISO dates
options(xlsx.date.format="-mm-dd")
# ATTENTION:  Loading of package xlsx changes decimal point
# to comma in a German locale
Sys.setlocale(category = "LC_NUMERIC", locale="C")  # UGLY HACK !!!


# Later in your code, i.e. before using addDataFrame(), use
jgc()


HTH,
Rainer Hurling

__
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] Build command in library(devtools)

2016-07-24 Thread Rainer Hurling
I think, in your case the problem might be the version of Rtools. If you
want to use R > 3.0.x, you also have to use newer versions of Rtools [1].

HTH,
Rainer Hurling

[1]  https://cran.r-project.org/bin/windows/Rtools/


Am 21.07.16 um 02:24 schrieb Steven Yen:
> Here is what I found. I had to go back to as early as R 3.0.3 (March, 
> 2014) along with Rtools30.exe that works with that version of R, in 
> order for devtools to work right. With other/later version of R, I end 
> up building a package with
> library(devtools); build("yenlib",binary=F)
> with no error message but the package does not run correctly; or with
> library(devtools); build("yenlib",binary=T)
> which deliver an error that says zip command failed (bevtools calls 
> Rtools when binary=T).
> 
> Updated versions are good, but what's the use if they do not work for a 
> situation like this.
> 
> Any help/insight would be appreciated.
> 
> On 7/20/2016 10:08 AM, Steven Yen wrote:
>> On 7/19/2016 4:38 PM, John McKown wrote:
>>> On Tue, Jul 19, 2016 at 3:15 PM, Steven Yen <sye...@gmail.com
>>> <mailto:sye...@gmail.com>>wrote:
>>>
>>> I recently updated my R and RStudio to the latest version and
>>> now the
>>> binary option in the "build" command in devtools stops working.
>>>
>>> I went around and used the binary=F option which worked by I get
>>> the
>>> .tar.gz file instead of the .zip file which I prefer.
>>>
>>> Does anyone understand the following error message:
>>>
>>> status 127
>>> running 'zip' failed
>>>
>>>
>>> ​I'm not totally sure, but I think that means that R cannot find the
>>> "zip" program in order to run it. ​
> 
> 
>   [[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] exporting tables from an access database using parallel foreach

2015-11-21 Thread Rainer Hurling
Am 22.11.15 um 02:38 schrieb John McKown:
> On Sat, Nov 21, 2015 at 11:55 AM, Vivek Sutradhara 
> wrote:
> 
>> Hi John and Jeff,
>> Thanks a lot for your help. I agree that row numbers are not a standard
>> feature in SQL. What I am looking for is some kind of a hack. After all,
>> the sqlFetch command is able to return a specific number of rows. And the
>> sqlFetchMore command is able to take up the baton from that row onwards to
>> futher return rows corresponding to the max parameter.
>>
>> I wonder if it is possible to straight away hop to a certain row number
>> (without going through sqlfetch and sqlFetchMore and without loading any
>> data into memory) and then return the contents corresponding to a certain
>> number of rows. The question is : is there a "catch" for accessing a row
>> location, and what could be the "hook" for that? I am interested in the the
>> recent updated rows to a table after a certain date. Is it possible to
>> identify them in a quick way? Running sql queries on such large tables
>> appears to take too long a time.
>>
>>  I understand that there is no provision to do this by available methods.
>> But, is it possible to get under the hood and find some hack?
>>
> 
> ​Now you're talking about the internals of Microsoft Access. And you're
> _way_ beyond my knowledge. Is there such knowledge? I sure there is. But,
> unfortunately, once you get into that depth, you can get into real trouble
> when (not if) MS decides to change the internals out from under you without
> any warning at all. If you are really needing this, try looking the the
> "MDB Tools" software at either https://github.com/brianb/mdbtools or
> http://mdbtools.sourceforge.net/​ I don't think this does exactly what you
> want, but it may give you the information you need to read the MDB file
> yourself directly in R code. 

The mdb-tools give direct access to the physical mdb files, lying around
in a filesystem. A database file xxx.mdb has not to be 'active' within a
MS Access 'Server', to read in its contents via mdb-tools. The idea
behind is, that one should be able to read the contents of mdb files,
even when there is no MS Access you can connect to and/or when no
Windows installation is running.

In my knowledge, mdb-tools is not available for Windows platforms, only
for Unix alikes and Linux, maybe OSX.

The R package 'Hmisc' is able to use mdb-tools, if they are also present
on that system.

Unfortunately, it seems, that mdb-tools also has no direct way to select
rows by their number.

> 
> ​What you would really want is something like the ROWID in SQLite. That is
> a "system" maintained column in every table in SQLite. It is a 64-bit
> unique number. Basically, it starts at 1 and increments every time you add
> a new row.
> 
> What would be "best", IMO, would be if you could alter your Access database
> to have a "serial" column which would be your "row number" You could then
> get "directly" there by using a SELECT similar to:
> 
> SELECT * FROM table WHERE serial BETWEEN (first-row,last-row)
> 
> 
> 
>>
>> Jeff, I will take your suggestion and try my luck at the R-sig-db mailing
>> list.
>> Thanks,
>> Vivek
>>
>>
>>

__
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] JAGS 4.x, rjags 4.x problems | Linux -- solved

2015-11-05 Thread Rainer Hurling
Am 05.11.2015 um 15:44 schrieb Evan Cooch:
> Well, sort of. I got sufficiently frustrated that I completely
> uninstalled R, jags, and everything related. Did a re-install using only
> versions of R nd JAGS found in the epel repo. No muss, no muss -- all
> works.
> 
> Out of curiosity, uninstalled again, and tried my usual sequence of
> manually compile R from source, same with JAGS. R works, JAGS works, but
> can't get any R package linking the two (say, rjags, R2jags), to
> recognize that JAGS is installed.
> 
> Ah well, at least the 'install from repos' approach works. I'll have to
> make do with that.


Just took another look in my installation call, I made some time ago.
What I did to get it work on FreeBSD was:


R CMD INSTALL rjags_4-4.tar.gz --configure-args='CPPFLAGS="-fPIC"
LDFLAGS="-L/usr/local/lib -ljags"
--with-jags-include=/usr/local/include/JAGS --with-jags-lib=/usr/local/lib'


So I used --configure-args, LDFLAGS, --with-jags-inlcue and
--with-jags-lib in my installation procedure. Perhaps it is worth
another try?

__
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] JAGS 4.x, rjags 4.x problems | Linux

2015-11-05 Thread Rainer Hurling

Am 04.11.2015 um 21:36 schrieb Evan Cooch:



On 11/4/2015 2:08 PM, Evan Cooch wrote:

Greetings --

This has also been posted on the jags forum, but since I suspect the
problem is more 'R-related' than jags, will aos post here.

Decided to 'upgrade' from jags 3.x.x to 4.x.x today, on my GNU/Linux
boxes (which run latest RHEL). Here are the basic details:

1\ used R 3.2.2 compiled from source. 64-bit -- nothing fancy, other
than the fact that I used OpenBLAS instead of 'generic'. Works fine.

2\ downloaded and compiled JAGS 4.0.1 from source (nothing fancy,
./configure & make & make install) -- no errors. Runs fine as a
standalone app from CLI.


3\ Downloaded rjags_4-3.tar.gz, and installed from R CLI (within R --
usual R CMD INSTALL approach). Again, no errors reported.


However, when I fire up R, and try something simple like

library(R2jags)

I get a whole slew of error messages - following is reproducible on
all my machines:

Loading required package: rjags
Loading required package: coda
Error : .onLoad failed in loadNamespace() for 'rjags', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object
'/usr/lib64/R/library/rjags/libs/rjags.so':
libjags.so.3: cannot open shared object file: No such file or directory
Error: package ‘rjags’ could not be loaded




Further puzzlement -- I uninstalled R2jags and rjags, with the idea that
re-installing them (ostensibly with the 'latest and greatest') would do
the trick. While the process went fine for R2jags, when I tried to
re-install rjags, got the following error messages:

checking for gcc -m64 -std=gnu99 option to accept ISO C89... none needed
checking for jags_version in -ljags... yes
checking version of JAGS library... wrong version
configure: error: rjags requires JAGS version 4.x.y
ERROR: configuration failed for package ‘rjags’
* removing ‘/usr/lib64/R/library/rjags’
* restoring previous ‘/usr/lib64/R/library/rjags’


Hmm, is it possible, that your JAGS 4.x.y installation is fine, but an 
old libjags.so library is lying around from a not fully completed 
deinstallation? Could you have a look for older libjags.so versions, please?


Just a thought.




I'm confused as to how it is not finding JAGS 4.x.y, which is not only
most definitely on the system, but in the path:

[root@euler egc]# jags
Welcome to JAGS 4.0.1 on Wed Nov  4 15:35:12 2015
JAGS is free software and comes with ABSOLUTELY NO WARRANTY
Loading module: basemod: ok
Loading module: bugs: ok


__
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] JAGS 4.x, rjags 4.x problems | Linux

2015-11-04 Thread Rainer Hurling
Am 04.11.2015 um 20:08 schrieb Evan Cooch:
> Greetings --
> 
> This has also been posted on the jags forum, but since I suspect the
> problem is more 'R-related' than jags, will aos post here.
> 
> Decided to 'upgrade' from jags 3.x.x to 4.x.x today, on my GNU/Linux
> boxes (which run latest RHEL). Here are the basic details:
> 
> 1\ used R 3.2.2 compiled from source. 64-bit -- nothing fancy, other
> than the fact that I used OpenBLAS instead of 'generic'. Works fine.
> 
> 2\ downloaded and compiled JAGS 4.0.1 from source (nothing fancy,
> ./configure & make & make install) -- no errors. Runs fine as a
> standalone app from CLI.
> 
> 
> 3\ Downloaded rjags_4-3.tar.gz, and installed from R CLI (within R --
> usual R CMD INSTALL approach). Again, no errors reported.
> 
> 
> However, when I fire up R, and try something simple like
> 
> library(R2jags)


On FreeBSD, I get the following, when I try to load package R2jags:

library(R2jags)
Lade nötiges Paket: rjags
Lade nötiges Paket: coda
Linked to JAGS 4.0.0
Loaded modules: basemod,bugs
Attache Paket: ‘R2jags’
The following object is masked from ‘package:coda’:
traceplot

So, in principle, it should work on Unix alike platforms.

I suggest, your next step should be to rebuild packages coda, basemod
and bugs, and of course, package R2jags_0.5-7?

Sorry, no other clue so far.

Greetings,
Rainer


> 
> I get a whole slew of error messages - following is reproducible on all
> my machines:
> 
> Loading required package: rjags
> Loading required package: coda
> Error : .onLoad failed in loadNamespace() for 'rjags', details:
> call: dyn.load(file, DLLpath = DLLpath, ...)
> error: unable to load shared object
> '/usr/lib64/R/library/rjags/libs/rjags.so':
> libjags.so.3: cannot open shared object file: No such file or directory
> Error: package ‘rjags’ could not be loaded
> 
> 
> Meaning, what? I checked, and rjags.so is where its supposed to be.If I run
> 
>  R CMD ldd /usr/lib64/R/library/rjags/libs/rjags.so
> 
> no failures at any point.
> 
> Suggestions? Pointers to the obvious?
> 
> Thanks very much in advance.

__
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] Rmarkdown / knitr naming the output file

2015-07-12 Thread Rainer Hurling
Am 06.07.2015 um 14:24 schrieb AURORA GONZALEZ VIDAL:
 Hello.
 I have a question for Rmarkdown users.
 
 Is there any way to give a name to the output document inside the Rmd?
 
 For example, my rmd's name is bb.Rmd but when I knitr to pdf I want it to
 name the pdf differently than bb.pdf, for example, doc1.pdf. Is there
 any way to do this?

Here is another way of changing the output filename. I am using it from
R's commandline:

rmarkdown::render(
  input=filename_orig.R,
  output_format=pdf_document,
  output_file=filename_different.pdf
)

Greetings,
Rainer Hurling


 
 Thank you very much
 
 
 --
 Aurora González Vidal
 
 Sección Apoyo Estadístico.
 Servicio de Apoyo a la Investigación (SAI).
 Vicerrectorado de Investigación.
 Universidad de Murcia
 Edif. SACE . Campus de Espinardo.
 30100 Murcia
 
 @. aurora.gonzal...@um.es
 T. 868 88 7315
 F. 868 88 7302
 www.um.es/sai
 www.um.es/ae

__
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] library(xlsx) fails with an error: Error: package ‘rJava’ could not be loaded

2015-04-20 Thread Rainer Hurling
Hi John,

Am 18.04.2015 um 22:07 schrieb John Sorkin:
 Windows 7 64-bit
 R 3.1.3
 RStudio 0.98.1103
 
 
 I am having difficulty loading and installing the xlsx package. The
 loading occurred without any problem, however the library command
 library(xlsx) produced an error related to rJava. I tried to install
 rJava seperately, re-loaded the xlsx package, and entered the
 library(xlsx) command but received the same error message about rJave.
 Please see terminal messages below. Any suggestion that would allow me
 to load and run xlsx would be appreciated.
 Thank you,
 John
 
 
 install.packages(xlsx)
 Installing package into ‘C:/Users/John/Documents/R/win-library/3.1’
 (as ‘lib’ is unspecified)
 trying URL
 'http://cran.rstudio.com/bin/windows/contrib/3.1/xlsx_0.5.7.zip'
 Content type 'application/zip' length 400944 bytes (391 KB)
 opened URL
 downloaded 391 KB
 
 
 package ‘xlsx’ successfully unpacked and MD5 sums checked
 
 
 The downloaded binary packages are in
   C:\Users\John\AppData\Local\Temp\Rtmp4CO5m7\downloaded_packages
 library(xlsx)
 Loading required package: rJava
 Error : .onLoad failed in loadNamespace() for 'rJava', details:
   call: inDL(x, as.logical(local), as.logical(now), ...)
   error: unable to load shared object
 'C:/Users/John/Documents/R/win-library/3.1/rJava/libs/x64/rJava.dll':
   LoadLibrary failure:  The specified module could not be found.
 
 
 Error: package ‘rJava’ could not be loaded
 install.packages(rJava)
 Installing package into ‘C:/Users/John/Documents/R/win-library/3.1’
 (as ‘lib’ is unspecified)
 trying URL
 'http://cran.rstudio.com/bin/windows/contrib/3.1/rJava_0.9-6.zip'
 Content type 'application/zip' length 759396 bytes (741 KB)
 opened URL
 downloaded 741 KB
 
 
 package ‘rJava’ successfully unpacked and MD5 sums checked
 
 
 The downloaded binary packages are in
   C:\Users\John\AppData\Local\Temp\Rtmp4CO5m7\downloaded_packages
 library(rJava)
 Error : .onLoad failed in loadNamespace() for 'rJava', details:
   call: inDL(x, as.logical(local), as.logical(now), ...)
   error: unable to load shared object
 'C:/Users/John/Documents/R/win-library/3.1/rJava/libs/x64/rJava.dll':
   LoadLibrary failure:  The specified module could not be found.
 
 
 Error: package or namespace load failed for ‘rJava’
 library(xlsx)
 Loading required package: rJava
 Error : .onLoad failed in loadNamespace() for 'rJava', details:
   call: inDL(x, as.logical(local), as.logical(now), ...)
   error: unable to load shared object
 'C:/Users/John/Documents/R/win-library/3.1/rJava/libs/x64/rJava.dll':
   LoadLibrary failure:  The specified module could not be found.
 
 
 Error: package ‘rJava’ could not be loaded

There are several possibilities, why your rJava does not find rJava.dll.
A good start give [1] to [3].

Did you have the right installation of JAVA itself?

I think, in your case, the JAVA installation itself should be the 64bit
version, and probably better version 1.8 than 1.7 [3] (someone please
correct me, if I am wrong here).

You get some hints about parameters with
R CMD javareconf --help

HTH.
Regards,
Rainer Hurling


[1]
http://cran.at.r-project.org/doc/manuals/r-release/R-admin.html#Java-support
[2]
http://cran.at.r-project.org/bin/windows/base/rw-FAQ.html#Loading-a-package-fails_002e
[3]
http://stackoverflow.com/questions/7019912/using-the-rjava-package-on-win7-64-bit-with-r


 
 
 John David Sorkin M.D., Ph.D.
 Professor of Medicine
 Chief, Biostatistics and Informatics
 University of Maryland School of Medicine Division of Gerontology and
 Geriatric Medicine
 Baltimore VA Medical Center
 10 North Greene Street
 GRECC (BT/18/GR)
 Baltimore, MD 21201-1524
 (Phone) 410-605-7119
 (Fax) 410-605-7913 (Please call phone number above prior to faxing)

__
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] XLSX package + Excel creation question

2013-08-29 Thread Rainer Hurling
Am 29.08.2013 12:08 (UTC+1) schrieb Zsurzsa Laszlo:
 Dear R users,
 
 I have a question about the xlsx package. It's possible to create excel
 files and color cells and etc.

yes, with package xlsx you can colourize you data sheets, even the
fonts. See for example ?CellStyle .

A good demonstration of the capabilities is on
http://tradeblotter.wordpress.com/2013/05/02/writing-from-r-to-excel-with-xlsx/

 
 My question would be that is it possible to color only some part of the
 data hold in a cell. Let's assume I've got the following data :
 167,153,120,100 and I want to color to red everything that is bigger then
 120. How can I achive this using R.
 
 Example file setup with a few lines in attachment. (SEL_MASS column can be
 used for example)

Attachment missing ...

HTH,
Rainer

 
 Thank you in advance,
 -
 - László-András Zsurzsa,-
 - Msc. Infromatics, Technical University Munich, Germany -
 - Scientific Employee, TUM -
 -

__
R-help@r-project.org mailing list
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] XLSX package + Excel creation question

2013-08-29 Thread Rainer Hurling
Am 29.08.2013 15:03 (UTC+1) schrieb Zsurzsa Laszlo:
 First of all thank you for the quick resposen.
 
 I know I can color and set up every cell. I will take a look again *
 CellStyle* but is it possbile for example to write an array to a single
 cell that has different colors for some data. Basically the color depends
 on the data.

As far as I know there is no ready to use functionality to mask groups
of selected cells. You have to write your own function, which selects
the right cells and changes their style with setCellStyle(cell, cellStyle).

Some hints are given in the examples section of ?CellStyle.

 
 -
 - László-András Zsurzsa,-
 - Msc. Infromatics, Technical University Munich, Germany -
 - Scientific Employee, TUM -
 -
 
 
 On Thu, Aug 29, 2013 at 2:55 PM, Rainer Hurling rhur...@gwdg.de wrote:
 
 Am 29.08.2013 12:08 (UTC+1) schrieb Zsurzsa Laszlo:
 Dear R users,

 I have a question about the xlsx package. It's possible to create excel
 files and color cells and etc.

 yes, with package xlsx you can colourize you data sheets, even the
 fonts. See for example ?CellStyle .

 A good demonstration of the capabilities is on

 http://tradeblotter.wordpress.com/2013/05/02/writing-from-r-to-excel-with-xlsx/


 My question would be that is it possible to color only some part of the
 data hold in a cell. Let's assume I've got the following data :
 167,153,120,100 and I want to color to red everything that is bigger then
 120. How can I achive this using R.

 Example file setup with a few lines in attachment. (SEL_MASS column can
 be
 used for example)

 Attachment missing ...

 HTH,
 Rainer


 Thank you in advance,

 -
 - László-András Zsurzsa,-
 - Msc. Infromatics, Technical University Munich, Germany -
 - Scientific Employee, TUM -

 -

 
   [[alternative HTML version deleted]]
 
 
 
 __
 R-help@r-project.org mailing list
 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
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] latin1 encoding in WriteXLS

2013-08-18 Thread Rainer Hurling
[maintainer CC'ed]


Am 17.08.2013 11:28, schrieb Hugo Varet:
 Yes, it also occurs with WriteXLS version 3.2.1.
 
 This test on several computers always leads to the same error.

Oops, sorry. I just realised that this happens on both Windows and Unix
alikes. On Win7 I am using ActivePerl 5.16.3 (X64).

The relevant perl scripts (WriteXLS.pl and Encode.pm) seem to be the
same on Unix/Linux and on Windows.

The first lines of the temporary file '1.csv', from which the xls should
be created, looks like:

Sepal.Length,Sepal.Width,Petal.Length,Petal.Width,Species
WRITEXLS COMMENT: ,WRITEXLS COMMENT: ,WRITEXLS COMMENT: ,WRITEXLS
COMMENT: ,WRITEXLS COMMENT: 
5.1,3.5,1.4,0.2,setosa
4.9,3,1.4,0.2,setosa
4.7,3.2,1.3,0.2,setosa
4.6,3.1,1.5,0.2,setosa
5,3.6,1.4,0.2,setosa
5.4,3.9,1.7,0.4,setosa
4.6,3.4,1.4,0.3,setosa
5,3.4,1.5,0.2,setosa
4.4,2.9,1.4,0.2,setosa
4.9,3.1,1.5,0.1,setosa
5.4,3.7,1.5,0.2,setosa
4.8,3.4,1.6,0.2,setosa
4.8,3,1.4,0.1,setosa
[..]


The sequence to call the converting perl script from WriteXLS by
system() is:

cmd - paste(perl,  -I, shQuote(Perl.Path),  , shQuote(Fn.Path),
 --CSVPath , shQuote(Tmp.Dir),  --verbose , verbose,
 --AdjWidth , AdjWidth,  --AutoFilter , AutoFilter, 
--BoldHeaderRow ,
BoldHeaderRow,  --FreezeRow , FreezeRow,  --FreezeCol ,
FreezeCol,  --Encoding , Encoding,  , shQuote(ExcelFileName),
sep = )


WriteXLS is calling the perl code by 'Result - system(cmd)':

perl -I'/usr/local/lib/R/library/WriteXLS/Perl'
'/usr/local/lib/R/library/WriteXLS/Perl/WriteXLS.pl' --CSVPath
'/tmp/RtmpFpgjq6/WriteXLS' --verbose FALSE --AdjWidth FALSE --AutoFilter
FALSE --BoldHeaderRow FALSE --FreezeRow 0 --FreezeCol 0 --Encoding
latin1 '/usr/home/rhurlin/iris.xls'


In Perl, '/usr/local/lib/R/library/WriteXLS/Perl/WriteXLS.pl' is calling
'/usr/local/lib/R/library/WriteXLS/Perl/Encode.pm' to decode the csv
file (in this case iso8859-1) and encode again in uft8, if needed.

It seems to me that 'sub decode' in Encode.pm is doing something wrong.
Unfortunately I do not understand what is going on here. Perhaps the
Marc as maintainer has an idea?

Regards,
Rainer Hurling


sessionInfo()
R Under development (unstable) (2013-08-15 r63591)
Platform: amd64-portbld-freebsd10.0 (64-bit)

locale:
[1] C/de_DE.UTF-8/de_DE.UTF-8/C/de_DE.UTF-8/de_DE.UTF-8

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

other attached packages:
[1] WriteXLS_3.2.1

loaded via a namespace (and not attached):
[1] tools_3.1.0


 
 Hugo Varet
 
 
 
 2013/8/17 Rainer Hurling rhur...@gwdg.de
 
 Am 13.08.2013 19:40, schrieb Hugo Varet:
 Dear R users,

 I've just updated the WriteXLS package (on R 3.0.1) and I now have an
 error
 when exporting a data.frame with the argument Encoding=latin1. For
 example, these two lines work:
library(WriteXLS)
WriteXLS(iris, iris.xls)
 whereas these ones don't work:
   library(WriteXLS)
   WriteXLS(iris, irislatin1.xls,Encoding=latin1)
 I get this message:
 Argument Sepal.Length isn't numeric in subroutine entry at
 C:/Perl64/lib/Encode.pm line 217, CSVFILE line 1.
 Modification of a read-only value attempted at C:/Perl64/lib/Encode.pm
 line
 218, CSVFILE line 1.
 The Perl script 'WriteXLS.pl' failed to run successfully.
 Message d'avis :
 l'exécution de la commande 'perl
 -IC:/Users/varet/Documents/R/win-library/3.0/WriteXLS/Perl
 C:/Users/varet/Documents/R/win-library/3.0/WriteXLS/Perl/WriteXLS.pl
 --CSVPath C:\Users\varet\AppData\Local\Temp\RtmpEzqFNz/WriteXLS
 --verbose
 FALSE --AdjWidth FALSE --AutoFilter FALSE --BoldHeaderRow FALSE
 --FreezeRow
 0 --FreezeCol 0 --Encoding latin1
 C:\Users\varet\Desktop\irislatin1.xls'
 renvoie un statut 255

 Does anyone know why it failed? May it be a problem with Perl?

 Thanks for your help,

 Hugo Varet

 Does this also occur with WriteXLS version 3.2.1 ?

__
R-help@r-project.org mailing list
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] latin1 encoding in WriteXLS

2013-08-16 Thread Rainer Hurling
Am 13.08.2013 19:40, schrieb Hugo Varet:
 Dear R users,
 
 I've just updated the WriteXLS package (on R 3.0.1) and I now have an error
 when exporting a data.frame with the argument Encoding=latin1. For
 example, these two lines work:
library(WriteXLS)
WriteXLS(iris, iris.xls)
 whereas these ones don't work:
   library(WriteXLS)
   WriteXLS(iris, irislatin1.xls,Encoding=latin1)
 I get this message:
 Argument Sepal.Length isn't numeric in subroutine entry at
 C:/Perl64/lib/Encode.pm line 217, CSVFILE line 1.
 Modification of a read-only value attempted at C:/Perl64/lib/Encode.pm line
 218, CSVFILE line 1.
 The Perl script 'WriteXLS.pl' failed to run successfully.
 Message d'avis :
 l'exécution de la commande 'perl
 -IC:/Users/varet/Documents/R/win-library/3.0/WriteXLS/Perl
 C:/Users/varet/Documents/R/win-library/3.0/WriteXLS/Perl/WriteXLS.pl
 --CSVPath C:\Users\varet\AppData\Local\Temp\RtmpEzqFNz/WriteXLS --verbose
 FALSE --AdjWidth FALSE --AutoFilter FALSE --BoldHeaderRow FALSE --FreezeRow
 0 --FreezeCol 0 --Encoding latin1 C:\Users\varet\Desktop\irislatin1.xls'
 renvoie un statut 255
 
 Does anyone know why it failed? May it be a problem with Perl?
 
 Thanks for your help,
 
 Hugo Varet

Does this also occur with WriteXLS version 3.2.1 ?

__
R-help@r-project.org mailing list
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] Is there a neat R trick for this?

2013-02-12 Thread Rainer Hurling
Am 12.02.2013 11:09 (UTC+1) schrieb Robert Latest:
 x - c(4,5,6)
 y - c(10,1,5,12,4,13,14)

Please try

#match(x,y)
[1]  5  3 NA

HTH,
Rainer Hurling

__
R-help@r-project.org mailing list
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] FreeBSD installation problems

2012-10-21 Thread Rainer Hurling
On 21.10.2012 02:47 (UTC+2), J. Maxwell wrote:
 R Compiliing or installation failure on FreeBSD
 9.0-RELEASE FreeBSD ; I386 box.
 
 configuring with the default settings, no 'options' =
 
 ./configure

Is there any reason that you are not using the FreeBSD ports system, in
this case /usr/ports/math/R? It builds and installs just fine. I am
using it for years now.

In many cases it should be useful to enable the ports option LIBR to get
a R shared library and a dynamically linked R.

Hope this helps,
Rainer


 ...
 ...
 ...
 
 checking whether gcc -std=gnu99 supports -c -o FILE.lo... yes
 checking for gcc -std=gnu99 option to support OpenMP... -fopenmp
 checking how to get verbose linking output from fc... configure:
 WARNING: compilation failed
 
 checking for Fortran 77 libraries of fc...
 checking how to get verbose linking output from gcc -std=gnu99... -v
 checking for C libraries of gcc -std=gnu99...  -L/usr/local/lib
 -L/usr/lib -lgcc_s
 checking for dummy main to link with Fortran 77 libraries... none
 checking for Fortran 77 name-mangling scheme... configure: error: in
 `/usr/local/src/R-2.15.1':
 configure: error: cannot compile a simple Fortran program
 See `config.log' for more details
 
 jaymax-#393:# ls config.log
 config.log
 
 jaymax-#394:# wc config.log
 3859   14227  118427 config.log
 
 jaymax-#395:# tail -30 config.log
 ...
 ...
 ...
 #define HAVE_INTPTR_T 1
 #define HAVE_UINTPTR_T 1
 #define R_INLINE inline
 #define SIZEOF_INT 4
 #define INT_32_BITS 1
 #define SIZEOF_LONG 4
 #define SIZEOF_LONG_LONG 8
 #define SIZEOF_DOUBLE 8
 #define SIZEOF_LONG_DOUBLE 12
 #define SIZEOF_SIZE_T 4
 
 configure: exit 1
 jaymax-#396:#
 
 I then provided the compilers explicitly
 ./configure cc=gcc47 F77=gfortran47 CXX=g++47 FC=gfortran47
 
 which seemed to run to completion w/ 1 SNAFU
 
   R is now configured for i386-unknown-freebsd9.0
 
   Source directory:  .
   Installation directory:/usr/local
 
   C compiler:gcc -std=gnu99  -g -O2
   Fortran 77 compiler:   gfortran47  -g -O2
 
   C++ compiler:  g++47  -g -O2
   Fortran 90/95 compiler:gfortran47 -g -O2
   Obj-C compiler:
 
   Interfaces supported:  X11
   External libraries:readline, ICU, lzma
   Additional capabilities:   PNG, JPEG, TIFF, NLS, cairo
   Options enabled:   shared BLAS, R profiling, Java
 
   Recommended packages:  yes
 
  configure: WARNING: inconsolata.sty not found: PDF vignettes and
 package manuals will not be rendered optimally
 
 However,
 jaymax-#492:# make install
 
 installing doc ...
 install: NEWS.rds: No such file or directory
 *** Error code 71
 
 Stop in /usr/local/src/R-2.15.1/doc.
 *** Error code 1
 
 Stop in /usr/local/src/R-2.15.1.
 
 And
 
 jaymax-#493:# make check
 
 ../../bin/R: not found
 *** Error code 127
 
 Stop in /usr/local/src/R-2.15.1/tests/Examples.
 *** Error code 1
 
 Stop in /usr/local/src/R-2.15.1/tests.
 *** Error code 1
 
 Stop in /usr/local/src/R-2.15.1/tests.
 *** Error code 1
 
 Stop in /usr/local/src/R-2.15.1.
 
 jaymax-#494:#
 
 I am at a bit of a loss figuring out the problem here, the log file does
 not seem to give any info
 Need some direction/help
 
 Thanks in advance.

__
R-help@r-project.org mailing list
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] How to read XML in UTF-8 format?

2012-10-15 Thread Rainer Hurling
On 15.10.2012 14:49 (UTC+2), Manish Gupta wrote:
 How to read xml in UTF-8 format.  I have one XML file but i want to read it
 in UTF-8 format. How this is possible? 
 
 barplot 
 cd 
 name表/name 
 value13/value1 
 value22.9/value2 
 /cd   
 cd 
 name笔/name 
 value13.3/value1 
 value23/value2 
 /cd 
 cd 
 name铅笔/name 
 value12.3/value1 
 value22.9/value2 
 /cd 
 cd 
 name书/name 
 value13.4/value1 
 value22.6/value2 
 /cd 
 cd 
 name玻璃/name 
 value13.1/value1 
 value22.4/value2 
 /cd 
 /barplot 
 
 Regards

Given, that the above lines are stored in an UTF-8 encoded file named
'xml-unicode', the following works for me:

library(XML)
xmlParseDoc(xml-unicode, encoding=UTF-8)

I think, there a smarter solutions.

Hope this helps,
Rainer


 View this message in context: 
 http://r.789695.n4.nabble.com/How-to-read-XML-in-UTF-8-format-tp4646232.html
 Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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] XML_3.95-0.1.tar.gz does not build on FreeBSD

2012-10-13 Thread Rainer Hurling
I tried to build (and install) XML_3.95-0.1.tar.gz on FreeBSD
10.0-CURRENT amd64, but it stopped during the check of
R_HAS_REMOVE_FINALIZERS (full log appended):

--
R CMD INSTALL XML_3.95-0.1.tar.gz
[..snip..]
Checking for 1.8:  -DR_HAS_REMOVE_FINALIZERS=1
-I/usr/local/include/libxml2 -I/usr/local/include
Using libxml2.*
checking for gzopen in -lz... gcc46 -std=gnu99
-I/usr/local/lib/R/include -DNDEBUG  -I/usr/local/include-fpic  -O2
-pipe -O2 -fno-strict-aliasing -pipe -msse3
-Wl,-rpath=/usr/local/lib/gcc46  -c testRemoveFinalizers.c -o
testRemoveFinalizers.o
testRemoveFinalizers.c: In function 'foo':
testRemoveFinalizers.c:7:2: warning: implicit declaration of function
'R_RemoveExtPtrWeakRef_direct' [-Wimplicit-function-declaration]
gcc46 -std=gnu99 -fpic -shared -L/usr/local/lib
-Wl,-rpath=/usr/local/lib/gcc46 -o testRemoveFinalizers.so
testRemoveFinalizers.o -L/usr/local/lib/R/lib -lR
yes
checking for xmlParseFile in -lxml2... yes
Error in dyn.load(sprintf(testRemoveFinalizers%s,
.Platform$dynlib.ext)) :
  unable to load shared object
'/tmp/RtmpnVvFNJ/R.INSTALLbb644ca43d46/XML/testRemoveFinalizers.so':
  /tmp/RtmpnVvFNJ/R.INSTALLbb644ca43d46/XML/testRemoveFinalizers.so:
Undefined symbol R_RemoveExtPtrWeakRef_direct

[..snip..]

installing to /usr/local/lib/R/library/XML/libs
** R
** inst
** preparing package for lazy loading
Creating a generic function for ‘source’ from package ‘base’ in package
‘XML’
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error : .onLoad failed in loadNamespace() for 'XML', details:
   call: dyn.load(file, DLLpath = DLLpath, ...)
   error: kann shared object '/usr/local/lib/R/library/XML/libs/XML.so'
nicht laden:
   /usr/local/lib/R/library/XML/libs/XML.so: Undefined symbol
R_RemoveExtPtrWeakRef_direct
Fehler: Laden fehlgeschlagen
Ausführung angehalten
ERROR: loading failed
* removing ‘/usr/local/lib/R/library/XML’
* restoring previous ‘/usr/local/lib/R/library/XML’
--

I am using R-devel (2012-10-07 r60893), compiled with gcc-4.6.4
20120928. Previous package XML_3.9-4.tar.gz from 2012/01/30 built and
installed without any problem.

Do you have an idea whats going on here?

Any help is really appreciated. Please let me know, if you need more
information or if I can do some testing.

Thanks in advance,
Rainer Hurling

* installing to library '/usr/local/lib/R/library'
* installing *source* package 'XML' ...
** Paket 'XML' erfolgreich entpackt und MD5 Summen �berpr�ft
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
Have R_RemoveExtPtrWeakRef
checking for sed... /usr/bin/sed
checking for pkg-config... /usr/local/bin/pkg-config
checking for xml2-config... /usr/local/bin/xml2-config
USE_XML2 = yes
SED_EXTENDED_ARG: -E
Minor 7, Patch 8 for 2.7.8
Located parser file -I/usr/local/include/libxml2 -I/usr/local/include/parser.h
Checking for 1.8:  -DR_HAS_REMOVE_FINALIZERS=1 -I/usr/local/include/libxml2 
-I/usr/local/include
Using libxml2.*
checking for gzopen in -lz... gcc46 -std=gnu99 -I/usr/local/lib/R/include 
-DNDEBUG  -I/usr/local/include-fpic  -O2 -pipe -O2 -fno-strict-aliasing 
-pipe -msse3 -Wl,-rpath=/usr/local/lib/gcc46  -c testRemoveFinalizers.c -o 
testRemoveFinalizers.o
testRemoveFinalizers.c: In function 'foo':
testRemoveFinalizers.c:7:2: warning: implicit declaration of function 
'R_RemoveExtPtrWeakRef_direct' [-Wimplicit-function-declaration]
gcc46 -std=gnu99 -fpic -shared -L/usr/local/lib -Wl,-rpath=/usr/local/lib/gcc46 
-o testRemoveFinalizers.so testRemoveFinalizers.o -L/usr/local/lib/R/lib -lR
yes
checking for xmlParseFile in -lxml2... yes
Error in dyn.load(sprintf(testRemoveFinalizers%s, .Platform$dynlib.ext)) : 
  unable to load shared object 
'/tmp/RtmpnVvFNJ/R.INSTALLbb644ca43d46/XML/testRemoveFinalizers.so':
  /tmp/RtmpnVvFNJ/R.INSTALLbb644ca43d46/XML/testRemoveFinalizers.so: Undefined 
symbol R_RemoveExtPtrWeakRef_direct
checking for xmlHashSize in -lxml2... yes
Using built-in xmlHashSize
Checking DTD parsing (presence of externalSubset)...
checking for xmlHashSize in -lxml2... yes
Found xmlHashSize
checking for xmlOutputBufferCreateBuffer in -lxml2... yes
have xmlOutputBufferCreateBuffer()
checking for xmlDocDumpFormatMemoryEnc in -lxml2... yes
checking libxml/xmlversion.h usability... yes
checking libxml/xmlversion.h presence... yes
checking for libxml/xmlversion.h... yes
Expat:  FALSE
Checking for return type of xmlHashScan element routine.
No return value for xmlHashScan
xmlNs has a context field
Checking for cetype_t

Re: [R] R 2.15.0 and 2.14.2 crash on the same code that runs on 2.14.1

2012-06-03 Thread Rainer Hurling

On 03.06.2012 09:17 (UTC+2), peter dalgaard wrote:


On Jun 3, 2012, at 07:40 , Ebrahim Jahanshiri wrote:


Dear list,

My code runs on 2.14.1 smoothly (with no error) but makes R crash on 2.14.2
and 2.15.0 with the usual windows message about R for windows GUI
front-end has stopped working... and as such I dont have any access to R
to get any error or warning message (if any). It crashes on random parts of
the code any time that I run it.
The code consists of EDA and spatial regression and various loops
and optimizations. The goal of the code is to perform a complete analysis
on various datasets.
Please take a look at the code here :
https://sites.google.com/site/geosciej/Home/STAR_ter1.R?attredirects=0d=1


You are not likely to find people willing to debug 15553 lines of code for you, and they 
are certainly not going to do it by eye, without the datasets!

One thing that jumps out is that you start off by loading five external 
packages, either of which might be the true owner of the problem. Even if the 
actual crash hits in the stats.dll, the underlying issue could well be memory 
corruption occurring some time earlier.

Things to try:

Run under Rterm in a command window instead of Rgui. That should at least tell 
you how far you got before the crash, maybe even a proper traceback.

Carefully try disabling parts of the code until the issue goes away. The last 
item removed might hold the clue. If you can cut it down to something 
small(-ish) and reproducible, people might be in a better position to help you.

Is it really a random crash, or does the crash point move every time you change 
the code slightly? If the former, you might have physical computer problems or 
you might be running close to your memory limit.


Just a guess:
One more thing you could try is to rebuild your packages under 2.15.0. 
One often forgets to update them after a version change of R:


update.packages(checkBuilt=TRUE, dependencies=TRUE, ask='graphics')

Rainer Hurling


-Peter D.



It seems that the results that comes out of 2.15.0 is more valid for my
work.

I cant think of anything that makes the code crash on the latest versions.

Here is the error message from windows:

  Problem Event Name: APPCRASH
  Application Name: Rgui.exe
  Application Version: 2.150.58871.0
  Application Timestamp: 4f75a0ca
  Fault Module Name: stats.dll
  Fault Module Version: 2.150.58871.0
  Fault Module Timestamp: 4f75a1c9
  Exception Code: c005
  Exception Offset: 000237c5
  OS Version: 6.1.7601.2.1.0.256.48
  Locale ID: 1033
  Additional Information 1: 0a9e
  Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
  Additional Information 3: 0a9e
  Additional Information 4: 0a9e372d3b4ad19135b953a78882e789



I appreciate your help,

Thank you
Ebrahim Jahanshiri


__
R-help@r-project.org mailing list
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] library(forecast): Error in SD.test(x, m) : Insufficient data

2012-02-08 Thread Rainer Hurling

On 08.02.2012 15:35 (UTC+1), Jean Jacques Dureau wrote:

I have these R code:

###
time.test.data-c(2.88645418326693, 2.91546949823027, 2.94130799329234,
   2.93313338038109, 2.89478957915832, 2.86029757243540, 2.78648486664669,
   2.80183167535133, 2.75435512226307, 2.78992352676563, 2.76028433151845,
   2.68741721854305, 2.70691974293828, 2.683833847881, 2.65041551246537,
   2.65169020111254, 2.58837541686517, 2.66549241844080, 2.58451314648945,
   2.60250871080139, 2.61253722876188, 2.59921041087878, 2.71727961060032,
   2.65440192667915, 2.74799149338374, 2.70649994101687, 2.80636027009366,
   2.81801086502298, 2.82555635319454, 2.87133347201997, 2.75746714456392,
   2.7660659236424, 2.71688375522241, 2.72655367231638, 2.72461997828447,
   2.78455790784558, 2.71160702495708, 2.65754456439869, 2.85673280918507,
   2.7053919591233, 2.7532637075718, 2.74272237196766, 2.75893306492199,
   2.62584686181772, 2.75230602278893, 2.82781018027572, 2.80220656652931,
   2.80242587601078, 2.84061953534849, 2.87123514783089, 2.76991605276683,
   2.77796934865900)

library(forecast)
auto.arima(ts(time.test.data, start=c(2011,1), frequency=52))
###


This looks good to me, I got no error:

auto.arima(ts(time.test.data, start=c(2011,1), frequency=52))
Series: ts(time.test.data, start = c(2011, 1), frequency = 52)
ARIMA(2,0,2) with non-zero mean

Coefficients:
 ar1  ar2  ma1 ma2  intercept
  1.4540  -0.5762  -1.0235  0.5484 2.7569
s.e.  0.3351   0.3194   0.3240  0.1902 0.0328

sigma^2 estimated as 0.003059:  log likelihood=76.05
AIC=-140.09   AICc=-138.23   BIC=-128.38


So perhaps something is wrong with your data object or with your 
dependend packages?



I obtain the error message:
Error in SD.test(x, m) : Insufficient data

What is wrong?

jj


__
R-help@r-project.org mailing list
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] library(forecast): Error in SD.test(x, m) : Insufficient data

2012-02-08 Thread Rainer Hurling

On 08.02.2012 17:19 (UTC+1), Jean Jacques Dureau wrote:

Hi rainer,
how can I control  dependend packages?


You did not tell us very much about your installation and versions of 
packages you are using.


On my system sessionInfo() gives me the following after loading your 
example:


sessionInfo()
R Under development (unstable) (2012-02-07 r58290)
Platform: amd64-portbld-freebsd10.0 (64-bit)

locale:
[1] 
de_DE.ISO8859-15/de_DE.ISO8859-15/de_DE.ISO8859-15/C/de_DE.ISO8859-15/de_DE.ISO8859-15


attached base packages:
[1] parallel  stats graphics  grDevices utils datasets  methods 
  base


other attached packages:
[1] forecast_3.17RcppArmadillo_0.2.34 Rcpp_0.9.9 fracdiff_1.4-0
[5] tseries_0.10-27  zoo_1.7-6quadprog_1.5-4

loaded via a namespace (and not attached):
[1] grid_2.15.0lattice_0.20-0


Here you can see, that package forecast uses other packages like 
RcppArmadillo, Rcpp, fracdiff and others. If your dataset 
'time.test.data' is ok, there is a (little) chance, that there are some 
not updated packages used by forecast.


But I am for sure not an expert on this. Perhaps someone else has an idea?

Rainer



thanks

jj

Il 08 febbraio 2012 17:10, Rainer Hurlingrhur...@gwdg.de  ha scritto:

On 08.02.2012 15:35 (UTC+1), Jean Jacques Dureau wrote:


I have these R code:


###
time.test.data-c(2.88645418326693, 2.91546949823027, 2.94130799329234,
   2.93313338038109, 2.89478957915832, 2.86029757243540, 2.78648486664669,
   2.80183167535133, 2.75435512226307, 2.78992352676563, 2.76028433151845,
   2.68741721854305, 2.70691974293828, 2.683833847881, 2.65041551246537,
   2.65169020111254, 2.58837541686517, 2.66549241844080, 2.58451314648945,
   2.60250871080139, 2.61253722876188, 2.59921041087878, 2.71727961060032,
   2.65440192667915, 2.74799149338374, 2.70649994101687, 2.80636027009366,
   2.81801086502298, 2.82555635319454, 2.87133347201997, 2.75746714456392,
   2.7660659236424, 2.71688375522241, 2.72655367231638, 2.72461997828447,
   2.78455790784558, 2.71160702495708, 2.65754456439869, 2.85673280918507,
   2.7053919591233, 2.7532637075718, 2.74272237196766, 2.75893306492199,
   2.62584686181772, 2.75230602278893, 2.82781018027572, 2.80220656652931,
   2.80242587601078, 2.84061953534849, 2.87123514783089, 2.76991605276683,
   2.77796934865900)

library(forecast)
auto.arima(ts(time.test.data, start=c(2011,1), frequency=52))

###



This looks good to me, I got no error:

auto.arima(ts(time.test.data, start=c(2011,1), frequency=52))
Series: ts(time.test.data, start = c(2011, 1), frequency = 52)
ARIMA(2,0,2) with non-zero mean

Coefficients:
 ar1  ar2  ma1 ma2  intercept
  1.4540  -0.5762  -1.0235  0.5484 2.7569
s.e.  0.3351   0.3194   0.3240  0.1902 0.0328

sigma^2 estimated as 0.003059:  log likelihood=76.05
AIC=-140.09   AICc=-138.23   BIC=-128.38


So perhaps something is wrong with your data object or with your dependend
packages?



I obtain the error message:
Error in SD.test(x, m) : Insufficient data

What is wrong?

jj


__
R-help@r-project.org mailing list
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] lattice panels with grouped extra data as text?

2012-01-27 Thread Rainer Hurling

On 26.01.2012 17:33 (UTC+1), Rainer Hurling wrote:

I have a problem with including extra data in a lattice graphic. I am
trying to put some calculated values in an extra column of a boxplot. A
minimal example should show what I am trying to do:


foo - data.frame(
Treatment=rnorm(1:12,2),
Variant=c(A,A,B,C,D,C,B,D,D,B,B,A),
Szenario=c(Dry,Wet,Dry,Dry,Wet,Dry,Wet,Wet,Dry,Wet,Dry,Dry),
Area=c(sample(100, 12)))

require(lattice)
require(latticeExtra)

bwplot(Treatment ~ Variant | Szenario, data=foo,

panel = function(...) {
# Marking the extra column yellow
panel.xblocks(c(4.5,5.0),
c(rgb(255,255,0, alpha=127, max=255),
rgb(255,255,0, alpha=127, max=255)))
# Put in the extra values (instead of a string)
panel.text(5, min(foo$Treatment), sum of foo$area per panel, srt=90,
adj=c(0,0.5), cex=2)

panel.bwplot(...) },

# Create extra space for a column
xlim=range(0.5,5.5),
scales = list(x = list(labels=c(NA,A,B,C,D,)))
)


I would like to put summarized area values (from Foo$Area) in the yellow
coloured columns of each panel. So afterwards there should be one sum in
the first panel and another sum in the next panel (and so on, if more
than two panels).

It tried a little bit with groups and group.number but without success.


Hope it is ok that I am answering myself. Instead of groups and 
group.number I found a solution with panel.number().


The script is able to produce sums (of areas in this case) for each 
panel and print that number in the panel. Because I would like to use 
two panel variables (Szenario and Age) I expanded the data.frame.



foo - data.frame(Treatment=rnorm(1:15,2),
  Variant=c(A,A,B,C,C,A,C,D,C,B,D,D,B,B,A),
  Szenario=c(Dry,Wet,Dry,Dry,Wet,Moist,Wet,Dry,
Wet,Moist,Wet,Dry,Wet,Dry,Dry),
  Age=c(Old,Young,Middle,Young,Old,Old,Middle,Old,
Middle,Young,Middle,Young,Old,Young,Middle),
  Area=c(sample(100, 15)))

require(lattice)
require(latticeExtra)

bwplot(Treatment ~ Variant | Szenario + Age, data=foo,
   layout=c(length(levels(foo$Szenario)),length(levels(foo$Age))),
   panel = function(...) {
 panel.xblocks(c(4.5,5.0),
   c(rgb(255,255,0, alpha=127, max=255),
 rgb(255,255,0, alpha=127, max=255)))
 panel.text(5, min(foo$Treatment),
sum(foo$Area[foo$Szenario == rep(levels(foo$Szenario),

length(levels(foo$Szenario)))[panel.number()] 
 foo$Age == rep(levels(foo$Age),

each=length(levels(foo$Age)))[panel.number()]]),
srt=90, adj=c(0,0.5), cex=2)
 panel.bwplot(...)
   },
   xlim=range(0.5,5.5),
   scales = list(x = list(labels=c(NA,A,B,C,D,)))
   )


At least this works for me. But I guess there a much more elegant 
solutions possible.




Is there any easy solution for this?

Any help is really appreciated.
Rainer Hurling


__
R-help@r-project.org mailing list
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] lattice panels with grouped extra data as text?

2012-01-26 Thread Rainer Hurling
I have a problem with including extra data in a lattice graphic. I am 
trying to put some calculated values in an extra column of a boxplot. A 
minimal example should show what I am trying to do:



foo - data.frame(
  Treatment=rnorm(1:12,2),
  Variant=c(A,A,B,C,D,C,B,D,D,B,B,A),

Szenario=c(Dry,Wet,Dry,Dry,Wet,Dry,Wet,Wet,Dry,Wet,Dry,Dry),
  Area=c(sample(100, 12))
  )

require(lattice)
require(latticeExtra)

bwplot(Treatment ~ Variant | Szenario,
   data=foo,

   panel = function(...) {
 # Marking the extra column yellow
 panel.xblocks(c(4.5,5.0),
   c(rgb(255,255,0, alpha=127, max=255),
 rgb(255,255,0, alpha=127, max=255)))
 # Put in the extra values (instead of a string)
 panel.text(5, min(foo$Treatment), sum of foo$area per panel, 
srt=90, adj=c(0,0.5), cex=2)


 panel.bwplot(...)
   },

   # Create extra space for a column
   xlim=range(0.5,5.5),
   scales = list(x = list(labels=c(NA,A,B,C,D,)))
   )


I would like to put summarized area values (from Foo$Area) in the yellow 
coloured columns of each panel. So afterwards there should be one sum in 
the first panel and another sum in the next panel (and so on, if more 
than two panels).


It tried a little bit with groups and group.number but without success.

Is there any easy solution for this?

Any help is really appreciated.
Rainer Hurling

__
R-help@r-project.org mailing list
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] rjava on FreeBSD

2012-01-11 Thread Rainer Hurling

On 11.01.2012 22:51 (UTC+1), Hasan Diwan wrote:

Trying to install Rjava on FreeBSD 9 and am getting the following error:

install.packages('rJava')

trying URL 'http://cran.cnr.Berkeley.edu/src/contrib/rJava_0.9-3.tar.gz'
Content type 'application/x-gzip' length 537153 bytes (524 Kb)
opened URL
==
downloaded 524 Kb

* installing *source* package 'rJava' ...
** package 'rJava' successfully unpacked and MD5 sums checked
checking for gcc... gcc46 -std=gnu99
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc46 -std=gnu99 accepts -g... yes
checking for gcc46 -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc46 -std=gnu99 -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking whether time.h and sys/time.h may both be included... yes
configure: checking whether gcc46 -std=gnu99 supports static inline...
yes
checking whether setjmp.h is POSIX.1 compatible... yes
checking whether sigsetjmp is declared... yes
checking whether siglongjmp is declared... yes
checking Java support in R... present:
interpreter : '/usr/local/bin/java'
archiver: '/usr/local/bin/jar'
compiler: '/usr/local/bin/javac'
header prep.: '/usr/local/bin/javah'
cpp flags   : '-I/usr/local/jdk1.6.0/jre/../include
-I/usr/local/jdk1.6.0/jre/../include/freebsd'
java libs   : '-L/usr/local/jdk1.6.0/jre/lib/i386/server
-L/usr/local/jdk1.6.0/jre/lib/i386
-L/usr/local/jdk1.6.0/jre/../lib/i386 -L -L/usr/java/packages/lib/i386
-L/lib -L/usr/lib -L/usr/local/lib -ljvm'
checking whether JNI programs can be compiled... yes
checking JNI data types... configure: error: One or more JNI types
differ from the corresponding native type. You may need to use
non-standard compiler flags or a different compiler in order to fix
this.
ERROR: configuration failed for package 'rJava'
* removing '/usr/local/lib/R/library/rJava'
* removing '/usr/local/lib/R/library/rJava'

The downloaded packages are in
 '/tmp/RtmpWtRfKe/downloaded_packages'
Updating HTML index of packages in '.Library'
Warning messages:
1: In install.packages(rJava) :
   installation of package 'rJava' had non-zero exit status
2: In file.create(f.tg) :
   cannot create file '/usr/local/share/doc/R/html/packages.html',
reason 'Permission denied'
3: In make.packages.html(.Library) : cannot update HTML package index




Ok, so I tried doing so as root, because it would solve the
'Permissions denied' issue and was rewarded with:

install.packages('rJava')

trying URL 'http://cran.cnr.Berkeley.edu/src/contrib/rJava_0.9-3.tar.gz'
Content type 'application/x-gzip' length 537153 bytes (524 Kb)
opened URL
==
downloaded 524 Kb

* installing *source* package 'rJava' ...
** package 'rJava' successfully unpacked and MD5 sums checked
checking for gcc... gcc46 -std=gnu99
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc46 -std=gnu99 accepts -g... yes
checking for gcc46 -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc46 -std=gnu99 -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking whether time.h and sys/time.h may both be 

Re: [R] Lattice graph help

2011-11-21 Thread Rainer Hurling
I just tried a litte bit with your dataset and hope to get a solution as 
wanted ;-)


On 21.11.2011 21:55 (UTC+1), Andrew McFadden wrote:

Hi all
I hope you might help me with some aspects of producing a graph in lattice. There are three things 
I have struggling with and that is: 1. to separate the horizontal box rows from each other; 2. to 
change the colour of the horizontal and vertical strips to white; and 3. to place the axes labels 
on the left y axes and on the bottom x axes. I would really appreciate some help. I have put the 
following example together. I tried between=list(y=c(1)) to try and separate the 
horizontal box rows but perhaps I have not used this correctly. I tried to use the following to 
place the labels on the left y axes scales=list(y=list(alternating=c(1)) but again 
perhaps I didn't use this correctly.



library(lattice)
library(latticeExtra)
n=as.factor(c(1:5,1:5))
Breed=as.factor(c(rep(Cow,3),rep(Sheep,3),rep(Goat,2),rep(Yak,2)))
Test=as.factor(c(rep(Bovine viral diarrhoea,5),rep(Border Disease,5)))
Titer=as.numeric(c(10,20,30,40, 50,15, 25, 35, 45, 55))
heif=data.frame(n,Breed, Test, Titer)
x=barchart( heif[,4]~ heif[,1]| heif[,3]+ heif[,2] ,ylab=titer,
layout = c(2,2), scales=list(x=list(at=c(seq(0, 60, by = 15)),tick.number=c(5),
labels=c(seq(0, 60, by = 15
)


# you can use 'heif' more directly like in models
x=barchart( Titer ~ n | Test+Breed, data=heif,
  layout = c(2,4),

  # distance between rows
  between = list(y = c(0.5)),

  # x- and y-lables only onesided, ticks also onesided
  scales = list(x = list(alternating = 1, tck = c(1,0)),
y = list(alternating = 1, tck = c(1,0))),

  xlab = count (n),
  ylab = titer
  )


useOuterStrips(x)


# the best way I found for colouring was in useOuterStrips
useOuterStrips(x,
   strip = strip.custom(bg = white),
   strip.left = strip.custom(bg = white)
   )

Hope this helps,
Rainer Hurling



Kind regards
Andrew McFadden MVS BVSc | Veterinary Epidemiologist,
Investigation and Diagnostic Centre | Biosecurity New Zealand
Ministry of Agriculture and Forestry | 66 Ward St,  Wallaceville | PO Box 40 
742 | Upper Hutt | New Zealand
Telephone: 64-4-894 5611 | Facsimile: 64-4-894 4973| Mobile: 027-733-1791 | 
Web: www.maf.govt.nz


__
R-help@r-project.org mailing list
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] Colour filling in panel.bwplot from lattice

2010-11-03 Thread Rainer Hurling

Am 03.11.2010 10:23 (UTC+1) schrieb Deepayan Sarkar:

On Wed, Nov 3, 2010 at 4:11 AM, Dennis Murphydjmu...@gmail.com  wrote:

Hi:

I don't know why, but it seems that in

bwplot(voice.part ~ height, data = singer,
main = NOT THE RIGHT ORDER OF COLOURS\n'yellow' 'blue' 'green' 'red'
'pink' 'violet' 'brown' 'gold',
fill=c(yellow,blue,green,red,pink,violet,brown,gold))

the assignment of colors is offset by 3:

Levels: Bass 2 Bass 1 Tenor 2 Tenor 1 Alto 2 Alto 1 Soprano 2 Soprano 1
fillcol- c(yellow,blue,green,red,pink,violet,brown,gold)

In the above plot,

yellow -  Bass 2  (1)
blue -  Tenor 1 (4)
green -  Soprano 2  (7)
red -  Bass 1 (10 mod 8 = 2)
pink -  Alto 2 (13 mod 8 = 5)
etc.

It's certainly curious.


Curious indeed. It turns out that because of the way this was
implemented, every 11th color was used, so you end up with the order


sel.cols- c(yellow,blue,green,red,pink,violet,brown,gold)
rep(sel.cols, 100) [ seq(1, by = 11, length.out = 8) ]

[1] yellow redbrown  blue   pink   gold   green  violet

It's easy to fix this so that we get the expected order, and I will do
so for the next release.


Thank you for this proposal. We are looking forward for the next release :-)

We frequently have to colour selected boxes to be able to compare 
special cases over different panels.



Having said that, it should be noted that any vectorization behaviour
in lattice panel functions is a consequence of implementation and not
guaranteed by design (although certainly useful in many situations).
In particular, it is risky to depend on vectorization in multipanel
plots, because the vectorization starts afresh in each panel for
whatever data subset happens to be in that panel, and there may be no
relation between the colors and the original data.


Thank you for the warning.


One alternative is to use panel.superpose with panel.groups=panel.bwplot:

bwplot(voice.part ~ height, data = singer, groups = voice.part, panel
= panel.superpose, panel.groups = panel.bwplot, fill = sel.cols)


This indeed works nice 'as a workaround'.


-Deepayan


Thanks again for this wonderful package,
Rainer

__
R-help@r-project.org mailing list
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] Colour filling in panel.bwplot from lattice

2010-11-03 Thread Rainer Hurling

Am 03.11.2010 12:52 (UTC+1) schrieb Deepayan Sarkar:

On Wed, Nov 3, 2010 at 4:25 PM, Rainer Hurlingrhur...@gwdg.de  wrote:

Am 03.11.2010 10:23 (UTC+1) schrieb Deepayan Sarkar:


On Wed, Nov 3, 2010 at 4:11 AM, Dennis Murphydjmu...@gmail.comwrote:


Hi:

I don't know why, but it seems that in

bwplot(voice.part ~ height, data = singer,
main = NOT THE RIGHT ORDER OF COLOURS\n'yellow' 'blue' 'green' 'red'
'pink' 'violet' 'brown' 'gold',
fill=c(yellow,blue,green,red,pink,violet,brown,gold))

the assignment of colors is offset by 3:

Levels: Bass 2 Bass 1 Tenor 2 Tenor 1 Alto 2 Alto 1 Soprano 2 Soprano 1
fillcol- c(yellow,blue,green,red,pink,violet,brown,gold)

In the above plot,

yellow -Bass 2  (1)
blue -Tenor 1 (4)
green -Soprano 2  (7)
red -Bass 1 (10 mod 8 = 2)
pink -Alto 2 (13 mod 8 = 5)
etc.

It's certainly curious.


Curious indeed. It turns out that because of the way this was
implemented, every 11th color was used, so you end up with the order


sel.cols-
c(yellow,blue,green,red,pink,violet,brown,gold)
rep(sel.cols, 100) [ seq(1, by = 11, length.out = 8) ]


[1] yellow redbrown  blue   pink   gold   green
  violet

It's easy to fix this so that we get the expected order, and I will do
so for the next release.


Thank you for this proposal. We are looking forward for the next release :-)

We frequently have to colour selected boxes to be able to compare special
cases over different panels.


Having said that, it should be noted that any vectorization behaviour
in lattice panel functions is a consequence of implementation and not
guaranteed by design (although certainly useful in many situations).
In particular, it is risky to depend on vectorization in multipanel
plots, because the vectorization starts afresh in each panel for
whatever data subset happens to be in that panel, and there may be no
relation between the colors and the original data.


Thank you for the warning.


One alternative is to use panel.superpose with panel.groups=panel.bwplot:

bwplot(voice.part ~ height, data = singer, groups = voice.part, panel
= panel.superpose, panel.groups = panel.bwplot, fill = sel.cols)


This indeed works nice 'as a workaround'.


Actually, I would reiterate that this is the right solution and the
it's other fix that qualifies as a quick workaround (especially if you
are considering comparing things across multiple panels).


Yes, this comparing across multiple panels was our intention.
Rainer


-Deepayan


__
R-help@r-project.org mailing list
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] Colour filling in panel.bwplot from lattice

2010-11-02 Thread Rainer Hurling
Inspired by colouring the dots of box-whisker plots I am trying to also 
fill the boxes (rectangles) with different colours. This seems not to 
work as I expected.


Looking at the help page of panel.bwplot it says: 'fill - color to fill 
the boxplot'. Obviously it is only intended to fill all boxes with only 
one colour?


Nevertheless the following example shows, that 'fill' from panel.bwplot 
is able to work with more than one colour. But this only works with one 
colour or multiples of 5 colours:



-
bp1 - bwplot(voice.part ~ height, data = singer, main=1 color works,
  panel = function(...) {
panel.bwplot(col=c(yellow),
 fill=c(yellow), ...)
  })

bp2 - bwplot(voice.part ~ height, data = singer, main = 3 colors do 
NOT work,

  panel = function(...) {
panel.grid(v = -1, h = 0)
panel.bwplot(col=c(yellow,blue,green),
 fill=c(yellow,blue,green), ...)
  })

bp3 - bwplot(voice.part ~ height, data = singer, main = 5 colors do work,
  panel = function(...) {
panel.grid(v = -1, h = 0)
panel.bwplot(col=c(yellow,blue,green,pink,red),

fill=c(yellow,blue,green,pink,red), ...)
   })

plot(bp1, split=c(1,1,1,3))
plot(bp2, split=c(1,2,1,3), newpage=FALSE)
plot(bp3, split=c(1,3,1,3), newpage=FALSE)
-


Is there any chance to use more than one filling colour correctly?

Thanks in advance,
Rainer Hurling

__
R-help@r-project.org mailing list
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] Colour filling in panel.bwplot from lattice

2010-11-02 Thread Rainer Hurling

On 02.11.2010 19:08 (UTC+1), David Winsemius wrote:

On Nov 2, 2010, at 1:19 PM, Rainer Hurling wrote:


Inspired by colouring the dots of box-whisker plots I am trying to
also fill the boxes (rectangles) with different colours. This seems
not to work as I expected.

Looking at the help page of panel.bwplot it says: 'fill - color to
fill the boxplot'. Obviously it is only intended to fill all boxes
with only one colour?

Nevertheless the following example shows, that 'fill' from
panel.bwplot is able to work with more than one colour. But this only
works with one colour or multiples of 5 colours:


-
bp1 - bwplot(voice.part ~ height, data = singer, main=1 color works,
panel = function(...) {
panel.bwplot(col=c(yellow),
fill=c(yellow), ...)
})

bp2 - bwplot(voice.part ~ height, data = singer, main = 3 colors do
NOT work,
panel = function(...) {
panel.bwplot(col=c(yellow,blue,green),
fill=c(yellow,blue,green), ...)
})

bp3 - bwplot(voice.part ~ height, data = singer, main = 5 colors do
work,
panel = function(...) {
panel.bwplot(col=c(yellow,blue,green,pink,red),
fill=c(yellow,blue,green,pink,red), ...)
})

plot(bp1, split=c(1,1,1,3))
plot(bp2, split=c(1,2,1,3), newpage=FALSE)
plot(bp3, split=c(1,3,1,3), newpage=FALSE)
-

Is there any chance to use more than one filling colour correctly?




Thanks for answering.


You have eight boxes to fill and 8 dots to color. You can either supply
8 distinct colors or you can supply some lesser number and they will be
recycled across the entire 8 boxes and dots. What you cannot do ( and
expect to see the dots against the fill background) is plot the dots as
the same colors as the fill.


It was not my intention to get the dots coloured in the same colour as 
the boxes. Instead I am looking for a method to fill the boxes with a 
predefined set of different colours (from a color vector). As far as I 
can see this is only possible for one colour and multitudes of five colours.


The dots should remain uncoloured ...


This will let you see all colors of dots and fill with only 4 colors
because I set it up so there was no two identical colors in teh sequence
of dots and fill during hte reculing:

bp4 - bwplot(voice.part ~ height, data = singer, main = 5 colors do
work,
panel = function(...) {
panel.bwplot(col=rev(c(yellow,blue,green,pink)),
fill=c(yellow,blue,green,pink), ...)
})


In your example you can see that the dots colors are painted in the 
right (reversed) order, the boxes are painted as sequence 
c(yellow,pink,green,blue) instead of 
c(yellow,blue,green,pink).


I do not understand how to turn over a given order and with a given 
count of colours to the boxes.




Thanks in advance,
Rainer Hurling


David Winsemius, MD
West Hartford, CT


__
R-help@r-project.org mailing list
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] Colour filling in panel.bwplot from lattice

2010-11-02 Thread Rainer Hurling

On 02.11.2010 20:08 (UTC+1), David Winsemius wrote:


On Nov 2, 2010, at 2:32 PM, Rainer Hurling wrote:


On 02.11.2010 19:08 (UTC+1), David Winsemius wrote:

On Nov 2, 2010, at 1:19 PM, Rainer Hurling wrote:


Inspired by colouring the dots of box-whisker plots I am trying to
also fill the boxes (rectangles) with different colours. This seems
not to work as I expected.

Looking at the help page of panel.bwplot it says: 'fill - color to
fill the boxplot'. Obviously it is only intended to fill all boxes
with only one colour?

Nevertheless the following example shows, that 'fill' from
panel.bwplot is able to work with more than one colour. But this only
works with one colour or multiples of 5 colours:


-
bp1 - bwplot(voice.part ~ height, data = singer, main=1 color works,
panel = function(...) {
panel.bwplot(col=c(yellow),
fill=c(yellow), ...)
})

bp2 - bwplot(voice.part ~ height, data = singer, main = 3 colors do
NOT work,
panel = function(...) {
panel.bwplot(col=c(yellow,blue,green),
fill=c(yellow,blue,green), ...)
})

bp3 - bwplot(voice.part ~ height, data = singer, main = 5 colors do
work,
panel = function(...) {
panel.bwplot(col=c(yellow,blue,green,pink,red),
fill=c(yellow,blue,green,pink,red), ...)
})

plot(bp1, split=c(1,1,1,3))
plot(bp2, split=c(1,2,1,3), newpage=FALSE)
plot(bp3, split=c(1,3,1,3), newpage=FALSE)
-

Is there any chance to use more than one filling colour correctly?




Thanks for answering.


You have eight boxes to fill and 8 dots to color. You can either supply
8 distinct colors or you can supply some lesser number and they will be
recycled across the entire 8 boxes and dots. What you cannot do ( and
expect to see the dots against the fill background) is plot the dots as
the same colors as the fill.


It was not my intention to get the dots coloured in the same colour as
the boxes. Instead I am looking for a method to fill the boxes with a
predefined set of different colours (from a color vector). As far as I
can see this is only possible for one colour and multitudes of five
colours.


I think first I have to apologise for my bad english. Sorry for any 
misunderstandig.



Huh? My example used 4 colors. It should have worked with eight colors
as well. There are eight groups and


Yes, all is ok with your example. My only problem is, the these four 
colours are not ordered as given by the vector (see below).



The dots should remain uncoloured ...


Then leave out the col= argument (assuming uncolored means black.)


I used these coloured dots to explain, that ordered colours (from given 
vector) work with dots, but not with the boxes.



This will let you see all colors of dots and fill with only 4 colors
because I set it up so there was no two identical colors in teh sequence
of dots and fill during hte reculing:

bp4 - bwplot(voice.part ~ height, data = singer, main = 5 colors do
work,
panel = function(...) {
panel.bwplot(col=rev(c(yellow,blue,green,pink)),
fill=c(yellow,blue,green,pink), ...)
})


In your example you can see that the dots colors are painted in the
right (reversed) order, the boxes are painted as sequence
c(yellow,pink,green,blue) instead of
c(yellow,blue,green,pink).

I do not understand how to turn over a given order and with a given
count of colours to the boxes.


See if this example using selected colors() works to make it clearer:

  colors()[(2:9)*10]
[1] bisque1 blue4 burlywood3 chartreuse3 coral3
[6] cyan2 darkgray darkorange


bp5 - bwplot(voice.part ~ height, data = singer, main = 5 colors do
work,
panel = function(...) {
panel.grid(v = -1, h = 0)
panel.bwplot(fill=colors()[(2:9)*10], ...)
})

bp5

(Needed to avoid the first colors() because they were mostly variants of
white.
  colors()[1:8]
[1] white aliceblue antiquewhite antiquewhite1
[5] antiquewhite2 antiquewhite3 antiquewhite4 aquamarine


Of course your example with eight colours works, too. But as you can see 
in the plot, the colours have different order then in the vector 
'colors()[(2:9)*10]' itself. I expected the first box (bass2) coloured 
bisque1, the second box (bass1) blue4 and so on.


I hope, this explaination is a bit clearer than my preceding ones.


Thanks in advance,
Rainer Hurling


__
R-help@r-project.org mailing list
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] Colour filling in panel.bwplot from lattice

2010-11-02 Thread Rainer Hurling

On 02.11.2010 21:43 (UTC+1), David Winsemius wrote:


On Nov 2, 2010, at 4:07 PM, Rainer Hurling wrote:

snipped quite a bit of talking past each otther


Of course your example with eight colours works, too. But as you can
see in the plot, the colours have different order then in the vector
'colors()[(2:9)*10]' itself. I expected the first box (bass2) coloured
bisque1, the second box (bass1) blue4 and so on.


Oh. Try putting the fill argument outside the panel and see if the panel
handles it in the manner you expect:

bp3 - bwplot(voice.part ~ height, data = singer, main = fill arg
outside bwplot\n1] 'bisque1' 'blue4' 'burlywood3' 'chartreuse3' 'coral3'
'cyan2' 'darkgray' 'darkorange, fill=colors()[(2:11)*10],
panel = function(...) {
panel.grid(v = -1, h = 0)
panel.bwplot( ...)
})
bp3



I hope, this explaination is a bit clearer than my preceding ones.


And I hope my suggestion now works.


Thank you for the hint, that it works also outside of the panel. It 
looks like I missed the wood for trees here ;-)


In your latest, special case the colours work. After having a nearer 
look at it I found that your colour vector has length 10 (2:11), and 
only the first eight colours are filled in the boxes.


This seems to be reproducable:

### NOT WORKING: 8 colours in the not in order of given vector
bwplot(voice.part ~ height, data = singer,
  main = NOT THE RIGHT ORDER OF COLOURS\n'yellow' 'blue' 'green' 'red' 
'pink' 'violet' 'brown' 'gold',

  fill=c(yellow,blue,green,red,pink,violet,brown,gold))

### WORKING: 10 (8+2*NA) colours in order of given vector
bwplot(voice.part ~ height, data = singer,
  main = RIGHT ORDER OF COLOURS\n'yellow' 'blue' 'green' 'red' 'pink' 
'violet' 'brown' 'gold',
  fill=c(yellow,blue,green,red,pink,violet,brown,gold, 
NA, NA))


I really do not understand what is going on here,
Rainer


David Winsemius, MD
West Hartford, CT


__
R-help@r-project.org mailing list
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] Colour filling in panel.bwplot from lattice

2010-11-02 Thread Rainer Hurling

On 02.11.2010 22:37 (UTC+1), David Winsemius wrote:


On Nov 2, 2010, at 5:08 PM, Rainer Hurling wrote:


On 02.11.2010 21:43 (UTC+1), David Winsemius wrote:


On Nov 2, 2010, at 4:07 PM, Rainer Hurling wrote:

snipped quite a bit of talking past each otther


Of course your example with eight colours works, too. But as you can
see in the plot, the colours have different order then in the vector
'colors()[(2:9)*10]' itself. I expected the first box (bass2) coloured
bisque1, the second box (bass1) blue4 and so on.


Oh. Try putting the fill argument outside the panel and see if the panel
handles it in the manner you expect:

bp3 - bwplot(voice.part ~ height, data = singer, main = fill arg
outside bwplot\n1] 'bisque1' 'blue4' 'burlywood3' 'chartreuse3' 'coral3'
'cyan2' 'darkgray' 'darkorange, fill=colors()[(2:11)*10],
panel = function(...) {
panel.grid(v = -1, h = 0)
panel.bwplot( ...)
})
bp3



I hope, this explaination is a bit clearer than my preceding ones.


And I hope my suggestion now works.


Thank you for the hint, that it works also outside of the panel. It
looks like I missed the wood for trees here ;-)

In your latest, special case the colours work. After having a nearer
look at it I found that your colour vector has length 10 (2:11), and
only the first eight colours are filled in the boxes.


I don't know why the ordering only is irregularly preserved ...
apparently in situations where the number of colors is a multiple of 5.
Perhaps a question that Sarkar, Andrews or Ehlers can answer. I looked
at the code for bwplot and it uses panel.polygon for drawing the
rectangles. The colors and other graphical parameters are supposed to be
picked up from the box.rectangle settings in par.settings. (Trying to
set those alos failed.) I also looked at panel.polygon and do not see a
reason for the shuffling of colors.


I also hope that someone from 'inner circle' would have a look ;-)


Wrong order also:
  bp3 - bwplot(voice.part ~ height, data = singer, main = fill arg
outside bwplot\n1] 'bisque1' 'blue4' 'burlywood3' 'chartreuse3' 'coral3'
'cyan2' 'darkgray' 'darkorange, par.settings =
list(box.rectangle=list(fill=colors()[(2:9)*10])), horizontal=TRUE,
+ panel = function(...) {
+ panel.grid(v = -1, h = 0)
+ panel.bwplot( ...)
+ })
  bp3


Yes, I tried to manipulate box.rectangle myself with also no success. I 
think, the design of panel.bwplot originally allows only for using one 
fill color (just a guess).



This seems to be reproducable:

### NOT WORKING: 8 colours in the not in order of given vector
bwplot(voice.part ~ height, data = singer,
main = NOT THE RIGHT ORDER OF COLOURS\n'yellow' 'blue' 'green' 'red'
'pink' 'violet' 'brown' 'gold',
fill=c(yellow,blue,green,red,pink,violet,brown,gold))

### WORKING: 10 (8+2*NA) colours in order of given vector
bwplot(voice.part ~ height, data = singer,
main = RIGHT ORDER OF COLOURS\n'yellow' 'blue' 'green' 'red' 'pink'
'violet' 'brown' 'gold',
fill=c(yellow,blue,green,red,pink,violet,brown,gold,
NA, NA))

I really do not understand what is going on here,


Me either.


Thank you so far. I am afraid I have to go to bed. In just a few hours I 
have to work for my employer again ...



Rainer


David Winsemius, MD
West Hartford, CT



__
R-help@r-project.org mailing list
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] How to control in order of groups in xyplot

2010-10-31 Thread Rainer Hurling

A working minimal example would have been better, see FAQ.

But I think you are looking for the following:

X2 - factor(c(m=2, m=5, m=10), levels=c(m=2, m=5, m=10))

Here levels are ordered in your way. There might be other solutions for 
this ordering problem.


Hope it helps,
Rainer


On 31.10.2010 06:55 (UTC+1), Jie Liu wrote:

Hi guys,

I used the following R code to generate one plot

library(lattice)
xyplot(Y~X1|as.factor(X2)*as.factor(X3), groups = as.factor(X4),
data=mydata)

Both X2 and X3 have three values. X4 has two values. I got 3x3 grids and in
each grid there are two curves about y~x1 for the two X4 values. I am quite
happy with the plot except that I need a different layout of the 3x3 layout.
For example, X2={m=2, m=5, and m=10} and it plots with the order
m=10, m=2, and m=5. Is there any way I can control the order of the
groups in the whole plot? Thanks a lot,

--Jerry


__
R-help@r-project.org mailing list
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] transforming a dataset for association analysis

2010-10-30 Thread Rainer Hurling

On 30.10.2010 13:50 (UTC+1), Santosh Srinivas wrote:

A more usable problem input would definitely help ... use dput to send a
reproducible sample to the group

Think the below should solve your problem


read.csv(Book1.csv)

 Subject   Item Score
1 Subject 1 Item 1 1
2 Subject 1 Item 2 0
3 Subject 1 Item 3 1
4 Subject 2 Item 1 1
5 Subject 2 Item 2 1
6 Subject 2 Item 3 0


library(reshape2)
tDat.m- melt(tDat)



tDatCast- acast(tDat.m,Subject~Item)
tDatCast

   Item 1 Item 2 Item 3
Subject 1  1  0  1
Subject 2  1  1  0



# Or without using package reshape2, only function reshape from stats:

df - data.frame(Subject=
   c(Subject 1,Subject 1,Subject 1,Subject 1,
 Subject 2,Subject 2,Subject 2,Subject 2),
 Item   =
   c(Item 1,Item 2,Item 3,Item 4,
 Item 1,Item 2,Item 3,Item 4),
 Score  = c(1,0,1,1,1,1,0,0))

df.wide - reshape(df, idvar=Subject, timevar=Item, direction=wide)
names(df.wide) - c(Subject,unique(as.character(df$Item)))

df.wide
Subject Item 1 Item 2 Item 3 Item 4
1 Subject 1  1  0  1  1
5 Subject 2  1  1  0  0



-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Ajay Ohri
Sent: 30 October 2010 16:27
To: Rhelp
Subject: [R] transforming a dataset for association analysis

Hi

I would like to transform  a data frame like

SubjectItem   Score
Subject 1 Item 1 1
Subject 1 Item 2 0
Subject 1 Item 3 1
Subject 2 Item 1 1
Subject 2 Item 2 1
Subject 2 Item 3 0

*to *

Subject  Item1   Item2   Item3 .Item N
Subject1   1  0   1
Subject2   1  10

SubjectP..

Apologize for the simple nature of my query but I am stuck. How can I do
this transformation?

Regards

Ajay



Websites-
http://decisionstats.com
http://dudeofdata.com


Linkedin- www.linkedin.com/in/ajayohri




On Sat, Oct 30, 2010 at 2:39 PM, Alaiosala...@yahoo.com  wrote:


Hello everyone.
I have written quite a big function that at the end correctly returns the
values
I want. I found a rare exception that I want to cover also. The easier for
me
would be to write something like that


function(){

  if (rare exception happened)
  return that value

  # The comes the code for normal execution
  # ...
  # ...
  return value # Normal values to return

}


Would that be feasible with R or two returns statements are not accepted?

Regards
Alex


__
R-help@r-project.org mailing list
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] R-2.12.0 hangs while installing some packages on FreeBSD

2010-10-21 Thread Rainer Hurling
I am working with R-2.12.0 on FreeBSD 9.0-CURRENT for a while now. I 
successfully installed more than 300 packages (most as dependencies of 
others).


There are two packages I am not able to install: RGtk2 and rggobi.

For example rggobi builds fine and after that it wants to load:

--
# R CMD INSTALL rggobi_2.1.16.tar.gz
[..SNIP..]
gcc -std=gnu99 -shared -L/usr/local/lib -o rggobi.so RSEval.o brush.o 
colorSchemes.o conversion.o data.o dataset.o display.o displays.o 
edges.o ggobi.o identify.o init.o io.o keyHandlers.o longitudinal.o 
modes.o plot.o plots.o plugins.o print.o session.o smooth.o ui.o utils.o 
-pthread -L/usr/local/lib -lggobi -lgtk-x11-2.0 -lxml2 -lgdk-x11-2.0 
-latk-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lXext -lXrender -lXinerama 
-lXi -lXrandr -lXcursor -lXcomposite -lXdamage -lpangoft2-1.0 -lgio-2.0 
-lXfixes -lcairo -lX11 -lpango-1.0 -lm -lfreetype -lfontconfig 
-lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0

installiert nach /usr/local/lib/R/library/rggobi/libs
** R
** data
**  moving datasets to lazyload DB
** demo
** preparing package for lazy loading
--

At this point the install process is hanging, R utilises no more CPU 
time. Same with package RGtk2.


Is this a known error? Please let me know if I can give more information 
or try something different.


Thanks in advance,
Rainer Hurling

__
R-help@r-project.org mailing list
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-2.12.0 hangs while loading RGtk2 on FreeBSD

2010-10-21 Thread Rainer Hurling

Am 21.10.2010 16:12 (UTC+1) schrieb Prof Brian Ripley:

On Thu, 21 Oct 2010, Rainer Hurling wrote:


I am working with R-2.12.0 on FreeBSD 9.0-CURRENT for a while now. I
successfully installed more than 300 packages (most as dependencies of
others).

There are two packages I am not able to install: RGtk2 and rggobi.

For example rggobi builds fine and after that it wants to load:

--
# R CMD INSTALL rggobi_2.1.16.tar.gz
[..SNIP..]
gcc -std=gnu99 -shared -L/usr/local/lib -o rggobi.so RSEval.o brush.o
colorSchemes.o conversion.o data.o dataset.o display.o displays.o
edges.o ggobi.o identify.o init.o io.o keyHandlers.o longitudinal.o
modes.o plot.o plots.o plugins.o print.o session.o smooth.o ui.o
utils.o -pthread -L/usr/local/lib -lggobi -lgtk-x11-2.0 -lxml2
-lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lXext
-lXrender -lXinerama -lXi -lXrandr -lXcursor -lXcomposite -lXdamage
-lpangoft2-1.0 -lgio-2.0 -lXfixes -lcairo -lX11 -lpango-1.0 -lm
-lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0
-lglib-2.0
installiert nach /usr/local/lib/R/library/rggobi/libs
** R
** data
** moving datasets to lazyload DB
** demo
** preparing package for lazy loading
--

At this point the install process is hanging, R utilises no more CPU
time. Same with package RGtk2.

Is this a known error? Please let me know if I can give more
information or try something different.


Well, those are exactly the two packages using Gtk+.

There is no known general problem, and as you could have checked from
the CRAN check pages, those packages install without problems on several
platforms. (Not Solaris, where ggobi does not install and RGtk2 requires
gcc, and not x64 Windows where both need to be patched.)

So it does look very like there is a problem with loading against the
Gtk+ system libraries on your system.


I think you are right. With previous versions of R (until R-2.10.x) I 
did not have this hanging when loading RGtk2 ... And I am pretty sure 
that I have no problems with gtk2 outside of R on my FreeBSD system.


In the meantime I found out that the reported loading error of rggobi is 
a loading error of RGtk2, which fails (hangs). So there remains only a 
loading error with RGtk2. (Because of that I changed the subject.)


After building/installing RGtk2, there are the following messages:

--
[..SNIP..]
gcc -std=gnu99 -shared -L/usr/local/lib -o RGtk2.so RGtkDataFrame.o 
Rgtk.o atkAccessors.o atkClasses.o atkConversion.o atkFuncs.o 
atkManuals.o atkUserFuncs.o cairo-enums.o cairoAccessors.o 
cairoConversion.o cairoFuncs.o cairoManuals.o cairoUserFuncs.o classes.o 
conversion.o eventLoop.o gdkAccessors.o gdkClasses.o gdkConversion.o 
gdkFuncs.o gdkManuals.o gdkUserFuncs.o glib.o gobject.o gtkAccessors.o 
gtkClasses.o gtkConversion.o gtkFuncs.o gtkManuals.o gtkUserFuncs.o 
libgladeAccessors.o libgladeFuncs.o libgladeManuals.o 
libgladeUserFuncs.o pangoAccessors.o pangoClasses.o pangoConversion.o 
pangoFuncs.o pangoManuals.o pangoUserFuncs.o utils.o zcompat.o -pthread 
-L/usr/local/lib -lglade-2.0 -lgtk-x11-2.0 -lxml2 -lgdk-x11-2.0 
-latk-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lXext -lXrender -lXinerama 
-lXi -lXrandr -lXcursor -lXcomposite -lXdamage -lpangoft2-1.0 -lgio-2.0 
-lXfixes -lcairo -lX11 -lpango-1.0 -lm -lfreetype -lfontconfig 
-lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -pthread 
-L/usr/local/lib -lgthread-2.0 -lglib-2.0

installiert nach /usr/local/lib/R/library/RGtk2/libs
** R
** demo
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices ...
** testing if installed package can be loaded  [..hanging from here..]
--

Is there a chance to find out what is wrong with loading RGtk2 on my 
system? Unfortunately I have almost no experience with real debugging 
methods on R. But of course I am willing to help and try out ...


__
R-help@r-project.org mailing list
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] Trouble compiling igraph. . .

2010-06-23 Thread Rainer Hurling

On 23.06.2010 13:29 (UTC+1), jim smith wrote:

Been and R-user for about 5 years now in an industrial setting, and
always find the mailing list most helpful.  I have run into problem
compiling igraph on R.  I have contacted the maintainer of igraph, and
he has determined that it is not an igraph problem.

System is FreeBSD 7.2, R-2.10.1 [also have a sandbox machine running
FreeBSD 7.3, R-2.11].  Both machines fail the installation of igraph.
Here is the error:


I am working with R-2.11.1 on FreeBSD 9.0-CURRENT (amd64). On several 
systems there had been no problems with installing igraph (0.5.3).



Error in dyn.load(file, DLLpath = DLLpath, ...) :
   unable to load shared library
'/usr/local/lib/R/library/igraph/libs/igraph.so': /usr/lib/libstdc+
+.so.6: version GLIBCXX_3.4.11 required
by /usr/local/lib/R/library/igraph/libs/igraph.so not found
Error : .onLoad failed in 'loadNamespace' for 'igraph'

I built the package, then ran the linker ldd to determine if libstdc+
+.so.6 were in the correct place [and found by igraph]:


libxml2.so.5 =  /usr/local/lib/libxml2.so.5 (0x340e)
libz.so.4 =  /lib/libz.so.4 (0x33d89000)
libiconv.so.3 =  /usr/local/lib/libiconv.so.3 (0x3420a000)
libR.so =  /usr/local/lib/libR.so (0x3430)
libstdc++.so.6 =  /usr/lib/libstdc++.so.6 (0x3455c000)
libm.so.5 =  /lib/libm.so.5 (0x33d9b000)
libgcc_s.so.1 =  /lib/libgcc_s.so.1 (0x33db)
libc.so.7 =  /lib/libc.so.7 (0x33c83000)
libblas.so.2 =  /usr/local/lib/libblas.so.2 (0x33dbb000)
libgfortran.so.3 =  /usr/local/lib/gcc44/libgfortran.so.3(0x34651000)
libintl.so.8 =  /usr/local/lib/libintl.so.8 (0x34709000)
libreadline.so.7 =  /lib/libreadline.so.7 (0x34712000)
libpcre.so.0 =  /usr/local/lib/libpcre.so.0 (0x34744000)
liblzma.so.0 =  /usr/local/lib/liblzma.so.0 (0x34778000)
libbz2.so.3 =  /usr/lib/libbz2.so.3 (0x347a1000)
libicuuc.so.38 =  /usr/local/lib/libicuuc.so.38 (0x347b2000)
libicui18n.so.38 =  /usr/local/lib/libicui18n.so.38 (0x348d)
libncurses.so.7 =  /lib/libncurses.so.7 (0x34a27000)
libthr.so.3 =  /lib/libthr.so.3 (0x34a66000)
libicudata.so.38 =  /usr/local/lib/libicudata.so.38 (0x34a7b000)


This is what I get from my igraph.so library:

#ldd /usr/local/lib/R/library/igraph/libs/igraph.so
/usr/local/lib/R/library/igraph/libs/igraph.so:
libxml2.so.5 = /usr/local/lib/libxml2.so.5 (0x4100)
libz.so.6 = /lib/libz.so.6 (0x4124b000)
libiconv.so.3 = /usr/local/lib/libiconv.so.3 (0x41361000)
libstdc++.so.6 = /usr/lib/libstdc++.so.6 (0x4155b000)
libm.so.5 = /lib/libm.so.5 (0x4176b000)
libgcc_s.so.1 = /lib/libgcc_s.so.1 (0x4188b000)
libc.so.7 = /lib/libc.so.7 (0x40648000)


So it appears to be there, but still I get this error.  Any guidance?


The only idea I have is that there could be a problem with the compiler 
version you used to compile igraph. Perhaps R himself an igraph are 
build with different compilers?



Thanks.


Hope this help a little bit,
Rainer

__
R-help@r-project.org mailing list
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] No graphics capability on fresh install of R2.11.0 on FreeBSD 8.0

2010-06-18 Thread Rainer Hurling

On 17.06.2010 04:45 (UTC+1), Ben Madin wrote:

G'day all,


Hi Ben,


I am working on a new FreeBSD 8.0 Server (remotely located), and have installed 
(now several times) R 2.11.0 but I cannot get any graphic outputs (everything 
else seems to be happening fine...)


i'm also working with FreeBSD (9.0-CURRENT, not remotely) and R 2.11.1 
(not from ports system, but direct installation).



During install I have noticed and checked that png, jpeg, cairo etc libraries 
are available - here is the build output :

R is now configured for amd64-portbld-freebsd8.0

  Source directory:  .
  Installation directory:/usr/local

  C compiler:gcc44 -std=gnu99  -O2 -pipe 
-Wl,-rpath=/usr/local/lib/gcc44 -fno-strict-aliasing
  Fortran 77 compiler:   gfortran44  -O

  C++ compiler:  g++44  -O2 -pipe -Wl,-rpath=/usr/local/lib/gcc44 
-fno-strict-aliasing
  Fortran 90/95 compiler:gfortran44 -O
  Obj-C compiler:gcc -g -O2

  Interfaces supported:  X11, tcltk
  External libraries:readline, BLAS(generic), LAPACK(generic), ICU, lzma
  Additional capabilities:   PNG, JPEG, TIFF, NLS, cairo
  Options enabled:   shared R library, R profiling

  Recommended packages:  yes

===   Building for R-2.11.0_1

and thus


sessionInfo()

R version 2.11.0 (2010-04-22)
amd64-portbld-freebsd8.0

locale:
[1] C

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

other attached packages:
[1] Cairo_1.4-6


yet when I start it up, I get this :


library(graphics)
png('this.file.png')

Error in X11(paste(png::, filename, sep = ), width, height, pointsize,  :
   unable to start device PNG
In addition: Warning message:
In png(this.file.png) : unable to open connection to X11 display ''


For me it looks like your X11 installation is not complete. You wrote 
about a server installation with remote access. Please take care to get 
installed all relevant ports. Easiest way is to install /usr/ports/x11/xorg.



and after installing Cairo


install.packages('Cairo',,'http://www.rforge.net/')

   trying URL 'http://www.rforge.net/src/contrib/Cairo_1.4-6.tar.gz'

I get :


library(Cairo)
Cairo(file='thisfile.png', type='png', height=480, width=640)

Error in Cairo(file = thisfile.png, type = png, height = 480, width = 640) :
   No font found in Rcairo_set_font

Thus stumped, I checked :


capabilities()

 jpeg  png tifftcltk  X11 aqua http/ftp  sockets
FALSEFALSEFALSE TRUEFALSEFALSE TRUE TRUE
   libxml fifo   clediticonv  NLS  profmemcairo
 TRUE TRUE TRUE TRUE TRUEFALSEFALSE


All graphical capabilities are disabled. See my comment above.


If this is not the appropriate place for this to be sorted, I am happy to try 
elsewhere.

cheers

Ben


Hope I could help,
Rainer

__
R-help@r-project.org mailing list
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] any quick way to write this label

2010-03-28 Thread Rainer Hurling

On 28.03.2010 13:33 (UTC+1), Jim Lemon wrote:

On 03/28/2010 07:56 PM, Roslina Zakaria wrote:

Hi r-users,

Is there any quick way to write this label?

c(0,50,100,150,200,250,300,350,400,450,
500,550,600,650,700,750,800,850,900)


If it is not for graphics, perhaps this helps?

as.character(seq(0,900,50))

Rainer


Hi Rosalina,
I'm going to take a leap in the dark and guess that you want to use
these as axis labels and want them all to appear. Have a look at the
staxlab function in the plotrix package.

Jim


__
R-help@r-project.org mailing list
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] filehash does not install on FreeBSD

2010-01-21 Thread Rainer Hurling
Trying to install package 'filehash' I get the following error on 
FreeBSD 9.0-CURRENT (amd64) with R version 2.11.0 (2010-01-15 r50990):



---
R CMD INSTALL filehash_2.0-1.tar.gz
* installing to library '/usr/local/lib/R/library'
* installing *source* package 'filehash' ...
** libs
gcc -std=gnu99 -I/usr/local/lib/R/include  -I/usr/local/include -fpic 
-g -O2 -c hash.c -o hash.o
gcc -std=gnu99 -I/usr/local/lib/R/include  -I/usr/local/include -fpic 
-g -O2 -c lockfile.c -o lockfile.o
gcc -std=gnu99 -I/usr/local/lib/R/include  -I/usr/local/include -fpic 
-g -O2 -c readKeyMap.c -o readKeyMap.o
gcc -std=gnu99 -I/usr/local/lib/R/include  -I/usr/local/include -fpic 
-g -O2 -c sha1.c -o sha1.o
gcc -std=gnu99 -shared -L/usr/local/lib -o filehash.so hash.o lockfile.o 
readKeyMap.o sha1.o

** R
** inst
** preparing package for lazy loading
Restoring the implicit generic function for 'with' from package 'base' 
into package 'filehash'; the generic differs from the default conversion 
(Signatures differ:  (data, expr), (data)) Error in match.call(fmatch, 
fcall) :

  unbenutzte(s) Argument(e) (name = character)
Error : unable to load R code in package 'filehash'
ERROR: lazy loading failed for package 'filehash'
* removing '/usr/local/lib/R/library/filehash'
* restoring previous '/usr/local/lib/R/library/filehash'
---


The only hint I found is on

http://www.r-project.org/nosvn/R.check/r-devel-linux-x86_64-gcc/filehash-00install.html

Is there anything known what causes this error?

Please let me know if I can help.

Thanks in advance,
Rainer Hurling

__
R-help@r-project.org mailing list
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] RPgSQL installation problem

2009-10-24 Thread Rainer Hurling

On 20.10.2009 09:35 (UTC+2), christiaan pauw wrote:

Hi everybody
I am trying to install RPsSQL and get the following error message:


As far as I know package RPgSQL is outdated. The newer package 
RPostgreSQL works with R-2.9.0 and greater. So it seems to be a good 
time to update your R version. In a few days R-2.10.0 is coming out ...



When I do ./configure form the untarred source directory I get

loading cache ./config.cache
checking for crypt in -lcrypt... no
No crypt function found

When I use the Package installer in R I get

install.packages(/Users/christiaanpauw/tmp/RPgSQL/, , NULL, type =
source)
Warning in install.packages(/Users/christiaanpauw/tmp/RPgSQL/, , NULL,  :
  argument 'lib' is missing: using
'/Users/christiaanpauw/Library/R/2.8/library'
* Installing *source* package 'RPgSQL' ...
creating cache ./config.cache
checking for crypt in -lcrypt... no
No crypt function found

I have a threefold question

What is the crypt function, do I need it for the installation to work and if
so where do I get it?


The crypt function belongs to a system library 'libcrypt'. Depending on 
your system (linux?) it should be installed already. If not, you have to 
install it (outside of R, it is a system function).



Thanks in advance
Christiaan


Hope this helps,
Rainer

__
R-help@r-project.org mailing list
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] problem installing cairo on freebsd

2009-08-06 Thread Rainer Hurling

Late, but hopefully not too late ...


Ben,

I had same problem with Cairo-1.4-5 on FreeBSD CURRENT-8.0 (i386). On of 
the authors of Cairo (thanks to Simon Urbanek) reminded me to use gmake 
instead of make. So in my case I set the environment variable 
temporarily like this (in tcsh):


setenv MAKE gmake
R CMD INSTALL Cairo-1.4-5.tar.gz
unsetenv MAKE

That's all. Good luck,
Rainer


On 21.07.2009 09:53 (UTC+2), Ben Madin wrote:

G'day all,


I am trying to install the cairo package on FreeBSD and receiving an 
error to do with Makevars - (I'm not very good at this stuff) so here is 
my various bits of information. I guess this is a problem with a missing 
library, but I have just been through a lot of grief trying to get png 
and jpeg to work (they do now work!), so I'm not sure where to go for this.


R version 2.9.0 (2009-04-17)

on

FreeBSD server.ausvet.com.au 7.0-RELEASE FreeBSD 7.0-RELEASE #0: Sat 
Jun  7 13:33:54 EST 2008 
b...@server.au:/usr/obj/usr/src/sys/AUSVET_CUSTOM  i386


with :

cairo-1.8.8,1 and
p5-Cairo-1.061

using :

install.packages(Cairo)

and I get this:

trying URL 'http://cran.ms.unimelb.edu.au/src/contrib/Cairo_1.4-5.tar.gz'
Content type 'application/x-tar' length 75318 bytes (73 Kb)
opened URL
==
downloaded 73 Kb

* Installing *source* package 'Cairo' ...
checking for gcc... gcc43 -std=gnu99
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc43 -std=gnu99 accepts -g... yes
checking for gcc43 -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... cpp
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking for pkg-config... /usr/local/bin/pkg-config
checking whether pkg-config knows about cairo... yes
checking for configurable backends... gnome-config: not found
gnome-config: not found
cairo cairo-ft cairo-pdf cairo-png cairo-ps cairo-xlib cairo-xlib-xrender
configure: CAIRO_CFLAGS=-D_THREAD_SAFE -I/usr/local/include/cairo 
-I/usr/local/include/pixman-1 -I/usr/local/include/freetype2 
-I/usr/local/include

checking if R was compiled with the RConn patch... no
checking cairo.h usability... yes
checking cairo.h presence... yes
checking for cairo.h... yes
checking for PNG support in Cairo... yes
checking for ATS font support in Cairo... no
configure: CAIRO_LIBS=-pthread -L/usr/local/lib -lfreetype -lfontconfig 
-lpng -lm -lz -lXrender -lcairo -lX11

checking for library containing deflate... none required
checking whether Cairo programs can be compiled... yes
checking whether cairo_image_surface_get_format is declared... no
checking for FreeType support in cairo... yes
checking whether FreeType needs additional flags... no
checking wheter libjpeg works... yes
checking wheter libtiff works... yes
configure: creating ./config.status
config.status: creating src/Makevars
config.status: creating src/cconfig.h
** libs
Makevars, line 2: Need an operator
Makevars, line 4: Need an operator
make: fatal errors encountered -- cannot continue
ERROR: compilation failed for package 'Cairo'
* Removing '/usr/local/lib/R/library/Cairo'

The downloaded packages are in
'/tmp/RtmpcIvbUg/downloaded_packages'
Updating HTML index of packages in '.Library'
Warning message:
In install.packages(Cairo) :
  installation of package 'Cairo' had non-zero exit status

cheers

Ben





__
R-help@r-project.org mailing list
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] Lattice: regression lines within grouped xyplot panels

2008-08-09 Thread Rainer Hurling

On 09.08.2008 01:05 (UTC+1), Deepayan Sarkar wrote:

On Fri, Aug 8, 2008 at 2:38 PM, Rainer Hurling [EMAIL PROTECTED] wrote:

Dear community,

I am looking for a possibility to draw 'regression lines' instead of
'smooth' lines in grouped xyplots. The following code should give you a
small example of the data structure.


library(lattice)
data(Gcsemv, package = mlmRev)

# Creates artificial grouping variable ...
Gcsemv$Groups -
 ifelse(as.numeric(as.character(Gcsemv$school))65000,
Group1, Group2)

xyplot(written ~ course | gender, data = Gcsemv,
  type = c(g, p, smooth),
  groups = Groups,
  panel = function(x, y, ...) {
panel.xyplot(x, y, ...)
# Here I want to draw the regression lines
# panel.abline(x, y)
  },
  auto.key = list(space = 'right'))


Does this do what you want?:


Yes, exactly!


xyplot(written ~ course | gender, data = Gcsemv,
  type = c(g, p, r),
  groups = Groups)

The problem with your approach is that the panel function you define
doesn't deal with groups. An easy workaround is to use
panel.superpose:


I knew that I had to look for a panel function dealing with groups, but 
I had no clue how to declare.


xyplot(written ~ course | gender, data = Gcsemv,
  type = c(g, p),
  groups = Groups,
  panel = panel.superpose,
  panel.groups = function(x, y, ...) {
panel.xyplot(x, y, ...)
panel.lmline(x, y, ...)
  },
  auto.key = list(space = 'right'))


Both, type(r) and panel.groups() are fine for my problem. And with 
panel.groups() I am able to write my own group functions, very nice. Now 
I can start analyzing ...  :-)



-Deepayan


Many thanks, also for your valuable book,
Rainer

__
R-help@r-project.org mailing list
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] Lattice: regression lines within grouped xyplot panels

2008-08-08 Thread Rainer Hurling

Dear community,

I am looking for a possibility to draw 'regression lines' instead of 
'smooth' lines in grouped xyplots. The following code should give you a 
small example of the data structure.



library(lattice)
data(Gcsemv, package = mlmRev)

# Creates artificial grouping variable ...
Gcsemv$Groups -
  ifelse(as.numeric(as.character(Gcsemv$school))65000,
 Group1, Group2)

xyplot(written ~ course | gender, data = Gcsemv,
   type = c(g, p, smooth),
   groups = Groups,
   panel = function(x, y, ...) {
 panel.xyplot(x, y, ...)
# Here I want to draw the regression lines
# panel.abline(x, y)
   },
   auto.key = list(space = 'right'))


I tried some variations like 'lm(y~x)' inside panel.abline() but had no 
success. Also googling around and reading in Deepayan Sakars interesting 
new book gave me no hints.


Is there any chance of displaying regression lines (instead of smooth 
function) within grouped panels? Or am I entirely wrong with this?


Thanks in advance,
Rainer Hurling



 sessionInfo()
R version 2.7.1 Patched (2008-08-01 r46207)
i386-unknown-freebsd8.0

locale:
de_DE.ISO8859-15/de_DE.ISO8859-15/C/C/de_DE.ISO8859-15/de_DE.ISO8859-15

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

other attached packages:
[1] cclust_0.6-14   lattice_0.17-13 chron_2.3-24

loaded via a namespace (and not attached):
[1] grid_2.7.1  tools_2.7.1

__
R-help@r-project.org mailing list
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] maptools no such file

2008-01-29 Thread Rainer Hurling
--
X-USF-Spam-Status: hits=-2.5 tests=BAYES_00,FORGED_RCVD_HELO
X-USF-Spam-Flag: NO

Am 29.01.2008 00:04 (UTC+1) schrieb Roger Bivand:
 On Mon, 28 Jan 2008, Rainer Hurling wrote:
 
 Roger,

 I tried your suggestions and ran into same problems as Pieter did before.

 
 Rainer:
 
 I don't think that we know what platform Pieter was using, apart from the 
 working directory that looked like Windows, and where the problem could 
 not be reproduced. I note that yours is FreeBSD 8, and I agree, the .C() 
 interface to the small helper function should most likely be replaced by a 
 .Call() to make handling the file name more robust. Can I send a modified 
 version off-list tomorrow, since I have no access to your platform 
 otherwise? Is readOGR() in rgdal working, by the way?
 

Roger,

cities - readOGR(./R\ scripts, cities)

works well for me.

Rainer



 Roger
 
 On 28.01.2008 12:35 (UTC+1), Roger Bivand wrote:
   pieterprovoost at gmail.com writes:

  No, I get the same error message there...
  Please do not needlesly delete the thread content. Your original question
  was:

  I'm having problems reading a shapefile with read.shape (maptools). I'm
  absolutely sure my file is there, but I get no such file. The wd is ok,
  since read.table for example does find the file.

 For testing I copied /usr/local/lib/R/library/rgdal/vectors/cities.shp into 
 /usr/home/rhurlin/TEMP/Rscripts/

  getwd()
  [1] D:/somedirectory/R scripts
 [1] /usr/home/rhurlin/TEMP/Rscripts

  read.table(cities.shp)
  Error in read.table(cities.shp) : empty beginning of file
  In addition: Warning message:
  In read.table(cities.shp) :
incomplete final line found by readTableHeader on 'cities.shp'

  which is self-explanatory, because you were not using read.shape() anyway.

  You continued:

   read.shape(cities.shp)
  Error in getinfo.shape(filen) : No such file
 Fehler in getinfo.shape(filen) : No such file

  but did not respond to the suggestion from an R-helper with the output
  from:

  readShapePoly(cities.shp)
 Fehler in getinfo.shape(filen) : No such file

  Try list.files(pattern=shp$) to see whether your assumption that the
  files are
  where you think they are, is justified.
 [1] cities.shp

  Then get back with the output of

  getinfo.shape(cities.shp)
 Fehler in getinfo.shape(cities.shp) : No such file

  If you want to, you can use file.choose() to choose the file
  interactively.

  If you haven't solved this yourself by then (found the files youself), do
  remember to include the verbatim output of sessionInfo() too.
 R version 2.6.1 (2007-11-26)
 i386-unknown-freebsd8.0 # This is 8.0-CURRENT from yesterday

 locale:
 de_DE.ISO8859-15/de_DE.ISO8859-15/de_DE.ISO8859-15/C/de_DE.ISO8859-15/de_DE.ISO8859-15

 attached base packages:
 [1] stats graphics  grDevices utils datasets  grid  methods
 [8] base

 other attached packages:
 [1] maptools_0.7-4 sp_0.9-19  foreign_0.8-23 proto_0.3-8

 loaded via a namespace (and not attached):
 [1] ggplot2_0.5.7   lattice_0.17-4  rcompgen_0.1-17

  Roger Bivand

 It seems, that the C call of 'Rshapeinfo' makes trouble on my system. 
 Rshapeinfo.c tries to open the shapefile with the following code:

 hSHP = SHPOpen( shpnm[0], rb );

 If I did not misunderstood, this returns NULL on my system.

 I have almost no C programming skills, so I am not able to understand the 
 code enough.

 Could something be wrong in using 'gettext'? (GNU gettext-runtime 0.16.1)

 Hope this helps a bit,
 Rainer




__
R-help@r-project.org mailing list
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] maptools no such file

2008-01-28 Thread Rainer Hurling
Roger,

I tried your suggestions and ran into same problems as Pieter did before.

On 28.01.2008 12:35 (UTC+1), Roger Bivand wrote:
  pieterprovoost at gmail.com writes:
 
 No, I get the same error message there...
 
 Please do not needlesly delete the thread content. Your original question was:
 
 I'm having problems reading a shapefile with read.shape (maptools). I'm
 absolutely sure my file is there, but I get no such file. The wd is ok,
 since read.table for example does find the file.
 

For testing I copied /usr/local/lib/R/library/rgdal/vectors/cities.shp 
into /usr/home/rhurlin/TEMP/Rscripts/

 getwd()
 [1] D:/somedirectory/R scripts

[1] /usr/home/rhurlin/TEMP/Rscripts

 read.table(cities.shp)
 Error in read.table(cities.shp) : empty beginning of file
 In addition: Warning message:
 In read.table(cities.shp) :
   incomplete final line found by readTableHeader on 'cities.shp'
 
 which is self-explanatory, because you were not using read.shape() anyway.
 
 You continued:
 
  read.shape(cities.shp)
 Error in getinfo.shape(filen) : No such file

Fehler in getinfo.shape(filen) : No such file

 but did not respond to the suggestion from an R-helper with the output from:
 
 readShapePoly(cities.shp)

Fehler in getinfo.shape(filen) : No such file

 Try list.files(pattern=shp$) to see whether your assumption that the files 
 are
 where you think they are, is justified.

[1] cities.shp

 Then get back with the output of
 
 getinfo.shape(cities.shp)

Fehler in getinfo.shape(cities.shp) : No such file

 If you want to, you can use file.choose() to choose the file interactively.
 
 If you haven't solved this yourself by then (found the files youself), do
 remember to include the verbatim output of sessionInfo() too.

R version 2.6.1 (2007-11-26)
i386-unknown-freebsd8.0 # This is 8.0-CURRENT from yesterday

locale:
de_DE.ISO8859-15/de_DE.ISO8859-15/de_DE.ISO8859-15/C/de_DE.ISO8859-15/de_DE.ISO8859-15

attached base packages:
[1] stats graphics  grDevices utils datasets  grid  methods
[8] base

other attached packages:
[1] maptools_0.7-4 sp_0.9-19  foreign_0.8-23 proto_0.3-8

loaded via a namespace (and not attached):
[1] ggplot2_0.5.7   lattice_0.17-4  rcompgen_0.1-17

 Roger Bivand


It seems, that the C call of 'Rshapeinfo' makes trouble on my system. 
Rshapeinfo.c tries to open the shapefile with the following code:

hSHP = SHPOpen( shpnm[0], rb );

If I did not misunderstood, this returns NULL on my system.

I have almost no C programming skills, so I am not able to understand 
the code enough.

Could something be wrong in using 'gettext'? (GNU gettext-runtime 0.16.1)

Hope this helps a bit,
Rainer

__
R-help@r-project.org mailing list
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] Lattice on FreeBSD

2008-01-24 Thread Rainer Hurling
--
X-USF-Spam-Status: hits=-2.5 tests=BAYES_00,FORGED_RCVD_HELO
X-USF-Spam-Flag: NO

Armin Goralczyk,

I am working with FreeBSD 8.0-CURRENT, R-2.6.1 and lattice() installs fine.

I think you have to update your FreeBSD ports tree. Afterwards you can 
install R-2.6.0. The newest version R-2.6.1 is not yet available on 
ports, because the ports tree is semi frozen for months now (forthcoming 
of FreeBSD version 7.0). This could remain at least until february.

I personally prefer not to use the ports tree to install R. Even the 
actual version R-2.6.1 builds and installs fine on FreeBSD without any 
port. There are two steps you have to pay attention of:

1. On actual versions of FreeBSD you have to ensure, that gfortran is 
accessible. For that you must first install lang/gcc42.

2. Before installing the new R, you have to deinstall the old R-port. 
Take care of making a list of your installed and preferred R-packages. 
You have to install them again on the new version (other path, other 
fortran and other R version ...).

There should be no more difficulties ;-)

Hope this helps,
Rainer Hurling


Am 23.01.2008 20:14 (UTC+1) schrieb Armin Goralczyk:
 On Jan 23, 2008 1:59 PM, Gabor Csardi [EMAIL PROTECTED] wrote:
 Which R version do you use? You chose mirror #21, that is
 Germany (Muenchen) to me. The same to you?
 Btw. Muenchen works for me.

 Maybe you have an old version of R, survival works with =2.0.0,
 but lattice only with =2.5.0. (The current version is 2.6.1.)
 I've no other idea what could've gone wrong

 G.

 
 Thank you Gabor.
 Mirror München ist correct. The problem is indeed the version. I've
 installed 2.3.1 (just two weeks ago with pkg_add). I guess I have to
 update. Shouldn't this information be included in the error message?!
 This would make things a lot easier.

__
R-help@r-project.org mailing list
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] Problem of lmer under FreeBSD

2007-12-27 Thread Rainer Hurling
Hello Ronggui Huang,

I am working with FreeBSD 8.0-CURRENT (i386) and R-2.6.1 (not built from 
ports). After loading version 0.99875-9 of lme4 and then executing the 
example

   library(lme4)
   example(lmer)

all works fine for me.


On 27.12.2007 09:19 (UTC+1), Ronggui wrote:
 I encounter such problem with lmer under FreeBSD, but not under
 Windows. Anyone knows why? Thanks.

Assuming, that your R installation is correct (from math/R ?), you 
should consider to reinstall lme4 and its dependencies. It is possible 
that these package have been built on a prior version of R.

For installing the package 'Matrix' on FreeBSD you have to use
gmake instead of make. The following example will do it

setenv MAKE gmake
R CMD INSTALL Matrix_0.999375-3.tar.gz
unsetenv MAKE

If reinstalling packages not solves your problem, please try if 
reinstalling R does. (Under FreeBSD the R sources build and install 
fine, so there is no need to use the port at math/R ...)

Hope this helps,
Rainer


 example(lmer)
 
 lmer (fm1 - lmer(Reaction ~ Days + (Days|Subject), sleepstudy))
 Error in UseMethod(as.logical) : no applicable method for as.logical
 traceback()
 9: as.logical(EMverbose)
 8: as.logical(EMverbose)
 7: lmerControl()
 6: do.call(lmerControl, control)
 5: lmer(Reaction ~ Days + (Days | Subject), sleepstudy)
 4: eval.with.vis(expr, envir, enclos)
 3: eval.with.vis(ei, envir)
 2: source(zfile, local, echo = echo, prompt.echo = paste(prompt.prefix,
getOption(prompt), sep = ), continue.echo = paste(prompt.prefix,
getOption(continue), sep = ), verbose = verbose,
 max.deparse.length = Inf,
encoding = encoding, skip.echo = skips)
 1: example(lmer)
 
 sessionInfo()
 R version 2.6.0 (2007-10-03)
 i386-portbld-freebsd6.3
 
 locale:
 C
 
 attached base packages:
 [1] stats graphics  grDevices utils datasets  methods   base
 
 other attached packages:
 [1] lme4_0.99875-9Matrix_0.999375-2 lattice_0.16-5
 
 loaded via a namespace (and not attached):
 [1] grid_2.6.0  rcompgen_0.1-15 tools_2.6.0

__
R-help@r-project.org mailing list
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] ELF file OS ABI invalid yes?????

2007-09-28 Thread Rainer Hurling
Hello Vittorio,

I am running FreeBSD 7.0-CURRENT (i386) from yesterday and I am able to 
compile MCMCpack_0.9-1.tar.gz without any problem on R-2.6.0 RC 
(2007-09-27 r43002).

Native FreeBSD devel/pcre-7.3 and lang/gcc42 packages are installed. 
Please look if your library versions are ok.

Regards,
Rainer


vittorio schrieb:
 Compilation of MCMCpack under freebsd 6.2 i386 fails because of the following 
 cryptic error: 
 
 * Installing *source* package 'MCMCpack' ...
 checking for C++ compiler default output file name... a.out
 checking whether the C++ compiler works... yes
 checking whether we are cross compiling... no
 checking for suffix of executables...
 checking for suffix of object files... o
 checking whether we are using the GNU C++ compiler... grep: error while 
 loading shared libraries: /usr/local/lib/libpcre.so.0: ELF file OS ABI 
 invalid
 yes
 checking whether c++ accepts -g... grep: error while loading shared 
 libraries: /usr/local/lib/libpcre.so.0: ELF file OS ABI invalid
 yes
 
 What should I do?
 
 Ciao
 Vittorio

__
R-help@r-project.org mailing list
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.