Re: [R] problem with RGtk

2010-02-18 Thread Wincent
Have you tried install GTK2 manually first?
It can be downloaded from http://r.research.att.com/gtk2-runtime.dmg

HTH

Ronggui

On 19 February 2010 10:02, Anna Oganyan wrote:

> Dear List,
> I would like to ask about package RGtk2 with which I have a problem.
> I will very much appreciate if somebody could tell me what I need to do.
> I need to install a  package scdMicro and it depends on gWidgetsRGtk2.
> I am working on MAC, version 10.5.8.
> When I try to load gWidgetsRGtk2 (or RGtk2), it asks me:
> "Instal GTK+?"
>
> I installed Gtk+ from CRAN, and added a path:
>
> export PATH=$PATH:/Library/Frameworks/GTK+.framework/Resources/bin
>
> But next time I try to load gWidgetsRGtk2 (or RGtk2), I get the same
> message: "Instal GTK+?"
>
> Below I included the error message I got.
>
> __
> Loading required package: gWidgetsRGtk2
> Loading required package: gWidgets
> Error in dyn.load(file, DLLpath = DLLpath, ...) :
>  unable to load shared library
> '/Users/aoganyan/Library/R/2.10/library/RGtk2/libs/i386/RGtk2.so':
>  dlopen(/Users/aoganyan/Library/R/2.10/library/RGtk2/libs/i386/RGtk2.so,
> 6): Library not loaded:
> /Library/Frameworks/GTK+.framework/Resources/lib/libgtk-x11-2.0.0.dylib
>  Referenced from:
> /Users/aoganyan/Library/R/2.10/library/RGtk2/libs/i386/RGtk2.so
>  Reason: Incompatible library version: RGtk2.so requires version 1801.0.0
> or later, but libgtk-x11-2.0.0.dylib provides version 1401.0.0
> In addition: Warning message:
> In fun(...) : couldn't connect to display "/tmp/launch-WrMGBi/:0"
> Failed to load RGtk2 dynamic library, attempting to install it.
> Error in if (choice == 1) { : argument is of length zero
> Error : .onLoad failed in 'loadNamespace' for 'RGtk2'
> Error: package 'gWidgetsRGtk2' could not be loaded
> starting httpd help server ... done
> Error in dyn.load(file, DLLpath = DLLpath, ...) :
>  unable to load shared library
> '/Users/aoganyan/Library/R/2.10/library/RGtk2/libs/i386/RGtk2.so':
>  dlopen(/Users/aoganyan/Library/R/2.10/library/RGtk2/libs/i386/RGtk2.so,
> 6): Library not loaded:
> /Library/Frameworks/GTK+.framework/Resources/lib/libgtk-x11-2.0.0.dylib
>  Referenced from:
> /Users/aoganyan/Library/R/2.10/library/RGtk2/libs/i386/RGtk2.so
>  Reason: Incompatible library version: RGtk2.so requires version 1801.0.0
> or later, but libgtk-x11-2.0.0.dylib provides version 1401.0.0
> Failed to load RGtk2 dynamic library, attempting to install it.
> Error in if (choice == 1) { : argument is of length zero
> Error : .onLoad failed in 'loadNamespace' for 'RGtk2'
> Error: package/namespace load failed for 'gWidgetsRGtk2'
> Error in structure(.External("dotTcl", ..., PACKAGE = "tcltk"), class =
> "tclObj") :
>  [tcl] invalid command name "option".
>
> Error : .onLoad failed in 'loadNamespace' for 'gWidgetstcltk'
> Error: package/namespace load failed for 'gWidgetstcltk'
> Loading required package: proto
> Loading required package: filehash
> Error: package 'filehash' could not be loaded
> In addition: Warning message:
> In library(pkg, character.only = TRUE, logical.return = TRUE, lib.loc =
> lib.loc) :
>  there is no package called 'filehash'
> Loading required package: gWidgetsRGtk2
> Error in dyn.load(file, DLLpath = DLLpath, ...) :
>  unable to load shared library
> '/Users/aoganyan/Library/R/2.10/library/RGtk2/libs/i386/RGtk2.so':
>  dlopen(/Users/aoganyan/Library/R/2.10/library/RGtk2/libs/i386/RGtk2.so,
> 6): Library not loaded:
> /Library/Frameworks/GTK+.framework/Resources/lib/libgtk-x11-2.0.0.dylib
>  Referenced from:
> /Users/aoganyan/Library/R/2.10/library/RGtk2/libs/i386/RGtk2.so
>  Reason: Incompatible library version: RGtk2.so requires version 1801.0.0
> or later, but libgtk-x11-2.0.0.dylib provides version 1401.0.0
> Failed to load RGtk2 dynamic library, attempting to install it.
> Error in if (choice == 1) { : argument is of length zero
> Error : .onLoad failed in 'loadNamespace' for 'RGtk2'
> Error: package 'gWidgetsRGtk2' could not be loaded
>
> ___
>
>
> Thank you very much in advance. I will appreciate very much any
> suggestions.
>
> Anna Ogan
>
> __
> 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.
>



-- 
Wincent Ronggui HUANG
Doctoral Candidate
Dept of Public and Social Administration
City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html

[[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] [R-pkgs] RQDA 0.1-9 is on CRAN now

2010-03-01 Thread Wincent
Dear all,

RQDA is a R package for computer-aided qualitative data analysis
(CAQDA). It is an easy-to-use tool to assist in the analysis of
textual data.

RQDA 0.1-9 is a major upgrade with the following changes:
* widgets are enabled only if they are usable.
* Better code categories management system and various improvements of GUI.
* Click-handler for second half of code-mark.
* Better default color scheme for code mark.
* New function of and().
* New option "both" in "type of retrieval".
* New option of subset in GetAtrr().
* It can handle ' correctly now.
* Various bugfixes.

As always, feedbacks and suggestions are more than welcome.

Regars

-- 
Wincent Ronggui HUANG
Doctoral Candidate
Dept of Public and Social Administration
City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html

___
R-packages mailing list
r-packa...@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-packages

__
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] RGtk2:::gdkColorToString throws an error

2010-03-08 Thread Wincent
Dear Michael, thanks. I have installed gtk+ 2-12.9 revision 2 from
http://gladewin32.sourceforge.net/, it still doesn't work.
I tried gtk2-runtime-2.16.6-2010-02-24-ash.exe from
http://gtk-win.sourceforge.net/home/index.php/en/Downloads, it did not
solve the issue neither.

Could you please give me more hints?  My OS is windows vista.

Regards

Ronggui

On 26 October 2009 23:27, Michael Lawrence  wrote:
> Hi and sorry for the late reply. The Gdk library is part of the GTK+ bundle
> (GTK+, Gdk and GdkPixbuf are distributed together and have synchronized
> versions). So you'll just need GTK+ 2.12 or higher.
>
> Michael
>
> On Tue, Oct 20, 2009 at 8:16 AM, Ronggui Huang 
> wrote:
>>
>> Dear all,
>>
>> I try to use RGtk2:::gdkColorToString, but it throws an error:
>> Error in .RGtkCall("S_gdk_color_to_string", object, PACKAGE = "RGtk2") :
>>  gdk_color_to_string exists only in Gdk >= 2.12.0
>>
>> I know what it means, but don't know to solve this problem because I
>> don't know where I can download the referred gdk library. Any
>> information? Thank you.
>>
>> --
>> HUANG Ronggui, Wincent
>> Doctoral Candidate
>> Dept of Public and Social Administration
>> City University of Hong Kong
>> Home page: http://asrr.r-forge.r-project.org/rghuang.html
>
>



-- 
Wincent Ronggui HUANG
Doctoral Candidate
Dept of Public and Social Administration
City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html

__
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] RGtk2:::gdkColorToString throws an error

2010-03-15 Thread Wincent
Thanks, both of you.

Regards
Ronggui

2010/3/13 Uwe Ligges :
>
>
> On 13.03.2010 14:00, Michael Lawrence wrote:
>>
>> Actually, the problem is more likely that RGtk2 is not built against GTK+
>> 2.12 on Windows. I assume you're using an up-to-date version of R. I'll
>> ask
>> Uwe about getting a newer version of GTK+.
>
> This actually is GTK+ > 2.12.0.
> We can try to upgrade, but that tunred out to be not very easy in the past.
>
> Uwe
>
>
>>
>> On Mon, Mar 8, 2010 at 7:29 PM, Wincent  wrote:
>>
>>> Dear Michael, thanks. I have installed gtk+ 2-12.9 revision 2 from
>>> http://gladewin32.sourceforge.net/, it still doesn't work.
>>> I tried gtk2-runtime-2.16.6-2010-02-24-ash.exe from
>>> http://gtk-win.sourceforge.net/home/index.php/en/Downloads, it did not
>>> solve the issue neither.
>>>
>>> Could you please give me more hints?  My OS is windows vista.
>>>
>>> Regards
>>>
>>> Ronggui
>>>
>>> On 26 October 2009 23:27, Michael Lawrence  wrote:
>>>>
>>>> Hi and sorry for the late reply. The Gdk library is part of the GTK+
>>>
>>> bundle
>>>>
>>>> (GTK+, Gdk and GdkPixbuf are distributed together and have synchronized
>>>> versions). So you'll just need GTK+ 2.12 or higher.
>>>>
>>>> Michael
>>>>
>>>> On Tue, Oct 20, 2009 at 8:16 AM, Ronggui Huang
>>>> wrote:
>>>>>
>>>>> Dear all,
>>>>>
>>>>> I try to use RGtk2:::gdkColorToString, but it throws an error:
>>>>> Error in .RGtkCall("S_gdk_color_to_string", object, PACKAGE = "RGtk2")
>>>>> :
>>>>>  gdk_color_to_string exists only in Gdk>= 2.12.0
>>>>>
>>>>> I know what it means, but don't know to solve this problem because I
>>>>> don't know where I can download the referred gdk library. Any
>>>>> information? Thank you.
>>>>>
>>>>> --
>>>>> HUANG Ronggui, Wincent
>>>>> Doctoral Candidate
>>>>> Dept of Public and Social Administration
>>>>> City University of Hong Kong
>>>>> Home page: http://asrr.r-forge.r-project.org/rghuang.html
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Wincent Ronggui HUANG
>>> Doctoral Candidate
>>> Dept of Public and Social Administration
>>> City University of Hong Kong
>>> http://asrr.r-forge.r-project.org/rghuang.html
>>>
>>
>>        [[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.
>



-- 
Wincent Ronggui HUANG
Doctoral Candidate
Dept of Public and Social Administration
City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html

__
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] Loading workspaces from the command line

2010-03-16 Thread Wincent
It is a promising solution. Yet, there is room for improvement. I
revise the if condition so it won't throw an error during ordinary
startup.

.First <- function() {
  if (length(commandArgs(T))>0 && commandArgs(T)[1] == "ld"){
load(commandArgs(T)[-1], .GlobalEnv)
  }
}

For the Rload script, it should be:
gnome-terminal --command "R --args ld '$1'"

Note the single quotation of $1. Without it, it does not work if the
file name contains space.

HTH
Best
Ronggui

On 12 January 2009 23:45, Zhou Fang  wrote:
> Well, that isn't ideal for my purposes. (A little context - basically
> I have a script that I'm running for a lot of simulations, which is
> kinda buggy, and what I'm doing is I'm having the script periodically
> save whatever it has done so far to an automatically named file. Then
> if something odd happens in between two saves, I can run forward from
> a previously saved point to find the problem and figure out why it
> happened, and also I won't risk losing everything if something
> catastrophic happens.)
>
> Anyways, if anyone's interested, in .Rprofile
>
> .First <- function(){
>  if (rev(commandArgs())[2] == "ld"){
>    load(rev(commandArgs())[1], .GlobalEnv)
>  }
> }
>
> Then e.g.
>
> alias Rload='R --arg ld'
>
> or make a bash script with
>
> gnome-terminal --command "R --args ld $1"
>
> and set some Open With options, and you'll be about to open R
> workspaces from Nautilus etc by point and click.
>
> Zhou
>
>
> On Mon, Jan 12, 2009 at 3:14 PM, Gabor Grothendieck
>  wrote:
>> Another possibility is to have a separate directory
>> for each project and place an .RData file in each.
>> Now just cd to whatever directory corresponds to the
>> project you wish to work on and start R normally.
>> No code is needed.
>>
>> On Mon, Jan 12, 2009 at 10:04 AM, Zhou Fang  wrote:
>>> Ok, looks like I can do what I want with --args, commandArgs() and an
>>> appropiate .First.
>>>
>>> Thanks,
>>>
>>> Zhou
>>>
>>> On Mon, Jan 12, 2009 at 2:27 PM, David Winsemius  
>>> wrote:
>>>> See if this material is helpful:
>>>>
>>>> http://cran.r-project.org/doc/manuals/R-intro.html#Invoking-R-from-the-command-line
>>>>
>>>> -- David Winsemius
>>>>
>>>> On Jan 12, 2009, at 7:24 AM, Zhou Fang wrote:
>>>>
>>>>> That's not really what I meant by 'command line'. I meant, well,
>>>>> loading from e.g. a bash shell, not from within an interactive R
>>>>> session itself.
>>>>>
>>>>> Thanks anyways,
>>>>>
>>>>> Zhou
>>>>>
>>>>> (Possibly this email was sent twice. Apologies)
>>>>>
>>>>> On Mon, Jan 12, 2009 at 12:15 PM, Henrique Dallazuanna 
>>>>> wrote:
>>>>>>
>>>>>> See ?load
>>>>>>
>>>>>> On Mon, Jan 12, 2009 at 10:12 AM, Zhou Fang  wrote:
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> Is there any way to load workspaces (e.g. stuff from save.image) from
>>>>>>> the command line? I'm on Linux, and would find this very helpful.
>>>>>>>
>>>>>>> I'm guessing this functionality can be duplicated with a skillful bash
>>>>>>> script to rename the particular file to .RData (and then back once R
>>>>>>> terminates), but I'm wondering if there's a better way.
>>>>>>>
>>>>>>> Zhou Fang
>>>>>>>
>>>>>>> __
>>>>>>> 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.
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Henrique Dallazuanna
>>>>>> Curitiba-Paraná-Brasil
>>>>>> 25° 25' 40" S 49° 16' 22" O
>>>>>>
>>>>>
>>>>> __
>>>>> 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.
>>>
>>
>
> __
> 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.
>



-- 
Wincent Ronggui HUANG
Doctoral Candidate
Dept of Public and Social Administration
City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html

__
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] SEM PACKAGE

2010-03-22 Thread Wincent
You can have a look at OpenMx (http://openmx.psyc.virginia.edu/openmx-features).

2010/3/22 Isaac SAGAON TEYSSIER :
>
> Dear all,
>
>
>
> I would like to know if it is possible to estimate multi-group SEM by using 
> R...
>
>
>
> Thank you
>
>
>
>
>
> _
> ¿Cuánto espacio necesitas para guardar tus emails? Con Hotmail tienes 5GB y 
> puede ampliarse a más.
>
>        [[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.
>
>



-- 
Wincent Ronggui HUANG
Doctoral Candidate
Dept of Public and Social Administration
City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html

__
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 analyze repeated measures count data?

2010-03-22 Thread Wincent
Not glm, it should be glmer in lme4 package.

Ronggui

On 22 March 2010 22:31, René Mayer  wrote:
> Dear R community,
>
> I've data-set with reaction times and count data (answers - yes, no) of N
> subjects under conditions A, B.
> For the analysis reaction time I used aov.
>
> fit.rt = aov(rt ~ A * B + Error(subjects/(A*B)), data = m )
>
> But how do I analyze the frequencies correctly?
>
> example fable of frequencies from one subject:
>
> , , = A1
>
>        B1      B2      B3
>  yes   31     36    19
>  no    22     27    10
> , ,  = A2
>
>      B1       B2    B3
>  yes   22     27    10
>  no    31     36    19
>
> Is a generalized linear model the right method?
> How do I specify the same model for the count data (frequencies) in glm?
>
> is this right: glm(count~A*B*answer+(1|subject),family=poisson)?
>
> Regards, René
>
> __
> 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.
>



-- 
Wincent Ronggui HUANG
Doctoral Candidate
Dept of Public and Social Administration
City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html

__
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] Transform data set

2010-03-23 Thread Wincent
Looks like this way,

dat$lrplacepartyclose <- NA

dat$lrplacepartyclose[dat$Party_Close=="party1"] <-
dat$lrplaceParty1[dat$Party_Close=="party1"]

dat$lrplacepartyclose[dat$Party_Close=="party2"] <-
dat$lrplaceParty2[dat$Party_Close=="party2"]

and goes on and on.


On 23 March 2010 17:47, Thomas Jensen  wrote:
> Dear R Experts,
>
> I am having some trouble creating a variable in R. I have data on
> self-placement of voters, their placement of parties, and which party
> they feel closest to. The data is structured like this:
>
>  Party_Close    lrplaceself     lrplaceParty1   lrplaceParty2 ...
>   party1               2               4               5
>   party2               5               6               4
>   party1               6               2               1
>
> etc...
>
> I want to format the data set so it looks like this:
>
> Party_Close     lrplacepartyclose           lrplaceself
>  party1                4                       2
>  party2                4                       5
>  party1                2                       6
>
> Any help is greatly appreciated!
>
> With kind regards,
> Thomas
>
> __
> 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.
>



-- 
Wincent Ronggui HUANG
Doctoral Candidate
Dept of Public and Social Administration
City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html

__
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] how to put two mosaic plots together

2010-04-08 Thread Wincent
library(vcd)
data("Titanic")
mosaic(Titanic)
mosaic(~ Sex + Age + Survived, data = Titanic,main = "Survival on the
Titanic", shade = TRUE, legend = TRUE) ## mosaic one
data("HairEyeColor")

mosaic(HairEyeColor, shade = TRUE, expected = list(c(1,2), 3)) ## mosaic tow


I would like to put the two mosaic plots together, the first one at
the left and the second one at the right. How can I do this?
Thanks


-- 
Wincent Rong-gui HUANG
Doctoral Candidate
Dept of Public and Social Administration
City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html

[[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.


Re: [R] predict.lm with NAs

2010-04-14 Thread Wincent
see ?na.exclude

you can set na.action='na.exclude' when fit the model.


On 15 April 2010 09:06, Martin Batholdy  wrote:
> Hi,
>
> I wanted to use the predict.lm() function to compare the empirical data with 
> the predicted values.
> The problem is that I have NAs in my data.
>
> I wanted to cbind my data.frame with the empirical values with the vector I 
> get from predict.lm.
> But they don't have the same length because predict.lm just skip 
> NA-predictions.
>
> Is there a way to get a vector with predicted values of the same length as 
> the empirical values (with NAs)?
>
>
> thanks!
>
> __
> 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.
>



-- 
Wincent Rong-gui HUANG
Doctoral Candidate
Dept of Public and Social Administration
City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html

__
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] Serverless databases in R

2010-04-17 Thread Wincent
How about RSQLite?


On 18 April 2010 12:56, kMan  wrote:
> Dear list,
>
> What are the cross-platform, serverless databases in R?
>
> Sincerely,
> KeithC.
>
> __
> 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.
>



-- 
Wincent Rong-gui HUANG
Doctoral Candidate
Dept of Public and Social Administration
City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html

__
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] suggestion on method dispatch

2010-04-27 Thread Wincent
Dear all, I have define a function  and its methods as follows:

 beginning of code
fn <- function(x,...){
UseMethod("fn")
}

fn.foo1 <- function(x, commonA=1, ...){
print("fn.foo1 is called.")
}

fn.foo2 <- function(x, uniqueFoo2, common=1, ...){
## uniqueFoo2 is a unique argument in fn.foo2
x <- uniqueFoo2; class(x) <- "foo1"
## use uniqueFoo2 to generate a object of class foo1
dots <- list(...)
do.call(fn.foo1, c(list(x=x,common=common),dots)
## pass x, commonA and other arguments from ... to fn.foo1
}

y <-  "y"; class(y) <- "foo2"
fn(x=y, "unique argument")

 end of code

They works as expected. I call fn.foo1 because I don't want to
duplicate the same piece of code.
Yet, I wonder if here is any official way to do the same thing without
directly call fn.foo1 via do.call.
To directly call a method is not a good coding style, right?

Thanks very much for your suggestion in advance.

-- 
Wincent Rong-gui HUANG
Doctoral Candidate
Dept of Public and Social Administration
City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html

__
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] suggestion on method dispatch

2010-04-27 Thread Wincent
Thanks Gabor.

Still, there is one problem. If the common argument is
common=c("opt1","opt2") and I want to use match.arg(common) in side
fn.foo1, then an error is encountered.

fn <- function(x,...) UseMethod("fn")

fn.default <-

fn.foo1 <- function(x, common=c("opt1","opt2"), ...) {
   match.arg(common)
   print("fn.foo1 is called.")
}

fn.foo2 <- function(x, uniqueFoo2, common=c("opt1","opt2"), ...){

   NextMethod("fn", x = uniqueFoo2)

}

y <-  "y"; class(y) <- "foo2"
fn(x=y, "unique argument")
## Error in match.arg(common) : 'arg' should be one of “opt1”, “opt2”
fn(x=y, uni="unique argument")
## works only when the second argument is named.

It seems that I need to align every argument of fn.foo1 into
NextMethod, then uniqueFoo2 will become part of list(...) in fn.foo1.
Otherwise, the unamed argument of uniqueFoo2 will be messed up.
Right?

Best

On 27 April 2010 23:14, Gabor Grothendieck  wrote:
> Define fn.default as a synonym to fn.foo1 (or just rename fn.foo1 as
> fn.default) and then use NextMethod as shown:
>
> fn <- function(x,...) UseMethod("fn")
>
> fn.default <-
> fn.foo1 <- function(x, commonA=1, ...) {
>        print("fn.foo1 is called.")
> }
>
> fn.foo2 <- function(x, uniqueFoo2, common=1, ...){
>        NextMethod("fn", x = uniqueFoo2)
> }
>
> y <-  "y"; class(y) <- "foo2"
> fn(x=y, "unique argument")
>
> On Tue, Apr 27, 2010 at 10:40 AM, Wincent  wrote:
>> Dear all, I have define a function  and its methods as follows:
>>
>>  beginning of code
>> fn <- function(x,...){
>> UseMethod("fn")
>> }
>>
>> fn.foo1 <- function(x, commonA=1, ...){
>> print("fn.foo1 is called.")
>> }
>>
>> fn.foo2 <- function(x, uniqueFoo2, common=1, ...){
>> ## uniqueFoo2 is a unique argument in fn.foo2
>> x <- uniqueFoo2; class(x) <- "foo1"
>> ## use uniqueFoo2 to generate a object of class foo1
>> dots <- list(...)
>> do.call(fn.foo1, c(list(x=x,common=common),dots)
>> ## pass x, commonA and other arguments from ... to fn.foo1
>> }
>>
>> y <-  "y"; class(y) <- "foo2"
>> fn(x=y, "unique argument")
>>
>>  end of code
>>
>> They works as expected. I call fn.foo1 because I don't want to
>> duplicate the same piece of code.
>> Yet, I wonder if here is any official way to do the same thing without
>> directly call fn.foo1 via do.call.
>> To directly call a method is not a good coding style, right?
>>
>> Thanks very much for your suggestion in advance.
>>
>> --
>> Wincent Rong-gui HUANG
>> Doctoral Candidate
>> Dept of Public and Social Administration
>> City University of Hong Kong
>> http://asrr.r-forge.r-project.org/rghuang.html
>>
>> __
>> 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.
>>
>



-- 
Wincent Rong-gui HUANG
Doctoral Candidate
Dept of Public and Social Administration
City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html

__
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] some QCA questions

2010-04-27 Thread Wincent
I didn't see any response, so I pick it up.

I don't think there is exact method to calculate the RAM use. Given
that you have a data set, QCA and R, you can just try to run the model
and see if it can hanlde it.
My hunch is that if you don't use remainders in the boolean
minimization process, it might work. Otherwise, it is really hard to
say.
QCA has implemented mvQCA. Not sure about fsQCA, maybe soon.

Besides QCA, you can try QCA3 (http://asrr.r-forge.r-project.org/).
fs_tt can construct truthTable which can be passed to QCA::eqmcc. QCA3
offers functions for csQCA, mvQCA and fsQCA. The developed version
also can handle TQAC discussed in  Ragin, Charles C. and Sarah Ilene
Strand (2008). However, I have to admit that QCA3 is a bit slower than
QCA.

Regards
Ronggui

On 28 July 2009 23:38, Suzanne van der Post  wrote:
> Dear Adrian Dusa, others,
>
> I've recently started to learn R in order to use the QCA package because
> i think it might offer what other QCA packages don't: possibilities for
> quite a few conditions and large n. However, can someone tell me approx.
> how much RAM i need to run QCA on set of  +/- 400.000 cases and +/- 15
> conditions? (or differently: how much time will it take with RAM of a
> certain size?)
> Also I'm very keen on hearing any news on the fuzzy and multivalue
> options for R...How's that comming along?
>
> Thanks a lot for any information you can provide!
> And of course major thanks for all the information you've already
> provided for me in existing manuals, R-fora etc. Great work!
>
> Greetings,
> Suzan van der Post
>
>
>
>
>
>
>        [[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.
>



-- 
Wincent Rong-gui HUANG
Doctoral Candidate
Dept of Public and Social Administration
City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html

__
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] replace elements in a list

2010-04-29 Thread Wincent
Dear all, I have a list like this:  l <- list(list(a=1,b=NULL), list(a=2,b=2))
I want to find out the elements with value of NULL and replace them with NA.
The actual case has a very long list, so manually find out and replace
them is not an option.
I can use for loop to do this, but I want to know if there is
vectorized way (or other ways) to do it?

Thanks
-- 
Wincent Rong-gui HUANG
Doctoral Candidate
Dept of Public and Social Administration
City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html

__
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] replace elements in a list

2010-04-29 Thread Wincent
Thanks.

On 30 April 2010 12:14, Erik Iverson  wrote:
> Wincent wrote:
>>
>> Dear all, I have a list like this:  l <- list(list(a=1,b=NULL),
>> list(a=2,b=2))
>> I want to find out the elements with value of NULL and replace them with
>> NA.
>> The actual case has a very long list, so manually find out and replace
>> them is not an option.
>> I can use for loop to do this, but I want to know if there is
>> vectorized way (or other ways) to do it?
>>
> Note:
>
> You have provided a list *of lists*.  Is that what you actually have?  If
> so,
>
> Solution 1:
>
> Change whatever is generating the NULL values to NA in the first place

Yes, it is a list of lists. I realized the returned value might have
NULL after I have the data. I just need to deal with it.
You are right, when I knew that, I will generate NA in the first place.

> Solution 2:
>
> lapply(l, function(x) lapply(x, function(x) ifelse(is.null(x), NA, x)))

Cool. that is what I want.

Thanks gain.
>



-- 
Wincent Rong-gui HUANG
Doctoral Candidate
Dept of Public and Social Administration
City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html

__
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] Learning R - View datasets

2009-11-27 Thread Wincent
There are different ways to inspect the conent of a data frame. For example,

>View(CO2)


2009/11/27 Brock Tibert :
> Hi All,
>
> I am making a serious effort to try to learn R, but one hurdle I am facing is 
> that I need to "see" the data as I walk through the examples in the packages. 
>  For instance, many examples on the web start by a command like 
> data("wines").  How can I actually view what the dataset looks like prior to 
> transformations and analysis?  I have tried to use edit() , print, and head.
>
> In short, I know that data() lists all of the available datasets, 
> data("wines") will load the dataset wines, but how can I look at the raw data?
>
> I figure this is probably an easy question, but any help you can provide will 
> be greatly appreciated.
>
> Thanks,
>
> Brock
>
> __
> 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.
>



-- 
Wincent Ronggui HUANG
Doctoral Candidate
Dept of Public and Social Administration
City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html

__
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 R-2.10.0 released already

2009-12-01 Thread Wincent
Hi, R-2.10.0 was released and R-2.10.1 is to be released soon. I don't
think there is any problem with cran.

Best

2009/12/2 Hiroto Miyoshi :
>
> Dear R users, and Dr. Delagard
>
> I got an R-announce message which tells that
> R-2.10.0 will be released on December 4, 2009.
>
> Houever, it seems the R of that version was already
> released. At leased I made sure that the R of that version
> was in Cran and Univ. of Tsukuba, and also Univ. of Toronto.
>
> And that version is quite odd because each package is in
> a folder whih is named coffin. I am seriously worrying that
> Cran site is hacked and someone might have placed a mallicious
> version.
>
> Please do take a look at the version and make sure if it is
> really a valid version.
>
> Sincerely
>
> Hiroto
>
>
> --
> --
> Hiroto Miyoshi
> hiroto_miyo...@nexyzbb.ne.jp
>
> __
> 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.
>



-- 
Wincent Ronggui HUANG
Doctoral Candidate
Dept of Public and Social Administration
City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html

__
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 SEM package of R suitable for sem analysis

2009-12-26 Thread Wincent
Besides sem package, OpenMx (http://openmx.psyc.virginia.edu/) is
another option for R users.

Best

2009/12/27 Joe King :
> I am going to take SEM this next quarter in my doctoral program. My
> suggestion is to use the program your professor suggests and try to
> re-create your models in R using the SEM package. We are not going to use
> AMOS though we use EQS, and another prof on campus who teaches it in a
> different department uses LISREL, so since SEM hasn't been implemented in
> most commercial software and you need specialty software for it, it may be
> best to know several different software programs if you want to do SEM type
> work. I do have a feeling since R is growing so rapidly it wont take time
> for people in the community to create packages or develop existing packages
> equal to or greater than commercial software! LONG LIVE R :)
>
> Joe King
> 206-913-2912
> j...@joepking.com
> "Never throughout history has a man who lived a life of ease left a name
> worth remembering." --Theodore Roosevelt
>
>
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf Of Reeyarn_???_10928113
> Sent: Saturday, December 26, 2009 3:50 AM
> To: R-help@r-project.org
> Subject: [R] Is SEM package of R suitable for sem analysis
>
> Dears,
>
> I'm a college student and In doing my statistics homework.
>
> I use R with SEM package as my tool for sem analysis,
> but my teacher told me AMOS is more suitable for such analysis.
>
> Could someone help tell me whether it is true
> that some commercial software is better accepted in academic fields?
>
> Sorry if I should not post such topics here.
>
> --
> Best Regards,
> Reeyarn T. Lee
>
> Accounting Dept, Guanghua School of Management,
> Peking University, Beijing, P.R. China
>
> __
> 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.
>



-- 
Wincent Ronggui HUANG
Doctoral Candidate
Dept of Public and Social Administration
City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html

__
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 SEM package of R suitable for sem analysis

2009-12-27 Thread Wincent
I don't know the situation of psychology. In sociology, SEM is
regarded is advanced statistical technique, but I am not quite sure if
it is  golden model. Actually, SEM is not so common in journal papers.
It is not about R. Sorry for being off-topic.

Best

2009/12/28 Yihui Xie :
> Well, I guess it will be extremely difficult to persuade your teacher
> to use the sem package in R. AFAIK, AMOS and LISREL have become the
> golden standard for SEM in China, and SEM has become a golden model
> for analysis in social science and psychology. I have been a cynic to
> SEM for a long time, because I strongly believe this model has been
> completely abused, and perhaps the "easy-to-use" AMOS has been helping
> people abuse SEM. A common phenomenon I see is, people do not care
> about the model at all - all they care about is whether AMOS can
> successfully compute the coefficients; if AMOS failed, they will try
> to (randomly) set constraints to the model, i.e. add/remove this
> arrow, drag some variables into/out of the model, set this
> coefficient/variance to 1.
>
> Anyway, I encourage you to ask your teacher why AMOS is "more
> suitable". I have a couple of very ridiculous stories about the SEM
> software, in which I can only feel the blind faith in software.
> Sigh...
>
> The good thing is, R is open source, so is the sem package. You can
> see everything in it, and you can extend it as you wish (in case your
> teacher think it is less suitable).
>
> Regards,
> Yihui
> --
> Yihui Xie 
> Phone: 515-294-6609 Web: http://yihui.name
> Department of Statistics, Iowa State University
> 3211 Snedecor Hall, Ames, IA
>
>
>
> On Sat, Dec 26, 2009 at 8:26 PM, Reeyarn_李智洋_10928113  
> wrote:
>> Dear Bruno and Joe,
>>
>> Thanks for advising!
>>
>>
>> Reeyarn
>>
>> On Sat, Dec 26, 2009 at 9:32 PM, Bruno Falissard  
>> wrote:
>>
>>> A few years ago it could have been true, but now the package has improved
>>> (especially with the bootstrap procedure).
>>> At the moment there is no argument to recommend AMOS.
>>
>> On Sun, Dec 27, 2009 at 12:30 AM, Joe King  wrote:
>>
>>> I am going to take SEM this next quarter in my doctoral program. My
>>> suggestion is to use the program your professor suggests and try to
>>> re-create your models in R using the SEM package.
>>
>> __
>> 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.
>



-- 
Wincent Ronggui HUANG
Doctoral Candidate
Dept of Public and Social Administration
City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html

__
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] Visualization of coefficients

2010-07-01 Thread Wincent
Dear all,

I try to show a subset of coefficients in my presentation. It seems
that a "standard" table is not a good way to go. I found figure 9
(page 9) in this file (
http://www.destatis.de/jetspeed/portal/cms/Sites/destatis/Internet/DE/Content/Wissenschaftsforum/Kolloquien/VisualisierungModellierung__Beitrag,property=file.pdf
) looks pretty good. I wonder if there is any function for such plot?
Or any suggestion on how to present statistical models in a
presentation?

Thank you.

-- 
Wincent Rong-gui HUANG
Doctoral Candidate
Dept of Public and Social Administration
City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html

__
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] Composing Music - R Package

2010-09-20 Thread Wincent
I have been looking for R package for audio manipulation in order to
extend RQDA's (http://rqda.r-forge.r-project.org/) capacity of
handling audio files.

The functions I need includes play, pause, get position information
(where it is paused), and seek according to a position. However, such
a package seems not to be out there as far (maybe I miss some clue).

Best

On 21 September 2010 07:21, Carl Witthoft  wrote:
> Not sure exactly what capabilities you're looking for.
> Just thought I'd put in a plug for a pretty decent, and free open source,
> app for generating the sheet music pages themselves.
>
> http://lilypond.org/
>
> Carl
>
> __
> 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.
>



-- 
Wincent Rong-gui HUANG
Doctoral Candidate
Dept of Public and Social Administration
City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html

__
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] how to change strip text of effect plot

2011-01-11 Thread Wincent
Dear r heper,

How can I change the strip text, for example (16,23] in the following
example, to other more informative text such as "high level" on the
fly?

library(effects)
Cowles$ex2 <- cut(Cowles$extraversion,3)
mod.cowles <- glm(volunteer ~ sex+neuroticism*ex2,data=Cowles, family=binomial)
eff.cowles <- allEffects(mod.cowles)
plot(eff.cowles, 'neuroticism:ex2',factor.names=F)

Thank you.

Ronggui


-- 
Wincent Ronggui HUANG (Ph.D.)
City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html

__
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 change strip text of effect plot

2011-01-11 Thread Wincent
Sure that is one way to go.
Since it is possible to pass lattice arguments to that high level
function, and there should be ways to relabel/custom the strip text in
the lattice plotting system, I would think such an indirect method a
last resort.

Thank you.

Ronggui

On 12 January 2011 11:51, Joshua Wiley  wrote:
> Hi,
>
> I am guessing this is not what you meant by "on the fly", but I think
> it will be by far the easiest way.  Plotting an effects object is a
> high level plot with a lot of defaults and automation built in to make
> your life simple.  The cost is that it is less flexible---you work its
> way, not vice versa.  If you want the factor named high, just label it
> that way to begin with.  If you think it makes the graphs more
> interpretable/meaningful, then it will make model summaries, etc.
> better also.  Worst case, you fit the model twice (one with fancy
> names, one with numbers), which unless you have a massive dataset will
> not take long or be an onerous burden anyways.  Here's how you can
> include labels directly in cut():
>
> Cowles$ex2 <- cut(Cowles$extraversion, 3, c("low", "medium", "high"))
> mod.cowles <- glm(volunteer ~ sex+neuroticism*ex2,data=Cowles, 
> family=binomial)
> eff.cowles <- allEffects(mod.cowles)
> plot(eff.cowles, 'neuroticism:ex2',factor.names=F)
>
> Cheers,
>
> Josh
>
> On Tue, Jan 11, 2011 at 7:21 PM, Wincent  wrote:
>> Dear r heper,
>>
>> How can I change the strip text, for example (16,23] in the following
>> example, to other more informative text such as "high level" on the
>> fly?
>>
>> library(effects)
>> Cowles$ex2 <- cut(Cowles$extraversion,3)
>> mod.cowles <- glm(volunteer ~ sex+neuroticism*ex2,data=Cowles, 
>> family=binomial)
>> eff.cowles <- allEffects(mod.cowles)
>> plot(eff.cowles, 'neuroticism:ex2',factor.names=F)
>>
>> Thank you.
>>
>> Ronggui
>>
>>
>> --
>> Wincent Ronggui HUANG (Ph.D.)
>> City University of Hong Kong
>> http://asrr.r-forge.r-project.org/rghuang.html
>>
>> __
>> 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.
>>
>
>
>
> --
> Joshua Wiley
> Ph.D. Student, Health Psychology
> University of California, Los Angeles
> http://www.joshuawiley.com/
>



-- 
Wincent Ronggui HUANG (Ph.D.)
City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html

__
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] rJava question

2010-08-07 Thread Wincent
In a HTML file, a java applet can be launch by


What is the equivalent rJava command(s) to do the same? Thank you

Best

-- 
Wincent Rong-gui HUANG
Doctoral Candidate
Dept of Public and Social Administration
City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html

__
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] Vermunt's LEM in R

2011-05-05 Thread Wincent
I guess LEM is a software for latent class analysis. If so, you may
want to have a look at poLCA package.

Regards
Ronggui

On 5 May 2011 23:34, David Joubert  wrote:
>
> Hello-
>
> Does anyone know of packages that could emulate what J. Vermunt's LEM does ? 
> What is the closest relative in R ?
> I use both R and LEM but have trouble transforming my multiway tables in R 
> into a .dat file compatible with LEM.
>
> Thanks,
>
> David Joubert
>
>        [[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.
>



-- 
Wincent Ronggui HUANG
Sociology Department of Fudan University
PhD of City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html

__
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] Vermunt's LEM in R

2011-05-09 Thread Wincent
What is L_square? Is it Likelihood ratio/deviance statistic which is
reported by poLCA?
The predcell component contains observed and expected, isn't it easy
to get the residuals?

If you want the logit/logistic model, glm or lrm (rms) can do the job.

It is unrealistic to expect different software report the exact
result, though most of them report the most important and basic
statistics.

On 10 May 2011 00:12, David Joubert  wrote:
>
>
> Basically I do LCA, followed by some kind of analysis intended to validate 
> the solutions. For example, I would create latent class solutions for each 
> gender based on four dichotomic indicators of psychosis. Next, I would look 
> at the interaction of current psychiatric status (the classes) and past 
> psychiatric diagnosis to predict institutional treatment use (logit or 
> logistic models). poLCA is a little limited for this purpose; I would have to 
> use it in combination with some other package. For example, it doesn't 
> provide residuals for the indicators, or the Cressie-Read statistic.
>
> David Joubert
>
>
> Date: Fri, 6 May 2011 09:56:05 +0200
> Subject: Re: [R] Vermunt's LEM in R
> From: i.vis...@uva.nl
> To: ronggui.hu...@gmail.com
> CC: jo...@hotmail.com; r-help@r-project.org
>
> poLCA is an option, as is randomLCA, flexmix, and depmixS4, and there are 
> likely to be more
> What specific models are you interested in?
> Best, Ingmar
>
> On Fri, May 6, 2011 at 6:13 AM, Wincent  wrote:
>
> I guess LEM is a software for latent class analysis. If so, you may
>
> want to have a look at poLCA package.
>
>
>
> Regards
>
> Ronggui
>
>
>
> On 5 May 2011 23:34, David Joubert  wrote:
>
>>
>
>> Hello-
>
>>
>
>> Does anyone know of packages that could emulate what J. Vermunt's LEM does ? 
>> What is the closest relative in R ?
>
>> I use both R and LEM but have trouble transforming my multiway tables in R 
>> into a .dat file compatible with LEM.
>
>>
>
>> Thanks,
>
>>
>
>> David Joubert
>
>>
>
>>        [[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.
>
>>
>
>
>
>
>
>
>
> --
>
> Wincent Ronggui HUANG
>
> Sociology Department of Fudan University
>
> PhD of City University of Hong Kong
>
> http://asrr.r-forge.r-project.org/rghuang.html
>
>
>
> __
>
> 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.
>
>
>
>        [[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.
>



-- 
Wincent Ronggui HUANG
Sociology Department of Fudan University
PhD of City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html

__
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] network package in R

2011-05-28 Thread Wincent
Can you be more specific about what a network builder is? and what do you
want exactly?

Your question seems a bit vague.

Best
Ronggui

On 28 May 2011 05:32, Weiwei Shi  wrote:

> Hi there,
>
> I need a network builder and it can change the node size and color; I am
> not
> sure if network package in R can do this or not. The other functions I
> wanted have been found in that package.
>
> BTW, if there is another package in R relating to this, please suggest too.
>
> Thanks,
>
> Weiwei
>
> --
> Weiwei Shi, Ph.D
> Research Scientist
>
>
> "Did you always know?"
> "No, I did not. But I believed..."
> ---Matrix III
>
>[[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.
>



-- 
Wincent Ronggui HUANG
Sociology Department of Fudan University
PhD of City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html

[[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 with restart

2010-05-05 Thread Wincent
Dear all, I want to download webpage from a large number of webpage.
For example,


link <- c("http://gzbbs.soufun.com/board/2811006802/";,
"http://gzbbs.soufun.com/board/2811328226/";,
"http://gzbbs.soufun.com/board/2811720258/";,
"http://gzbbs.soufun.com/board/2811495702/";,
"http://gzbbs.soufun.com/board/2811176022/";,
"http://gzbbs.soufun.com/board/2811866676/";
)
#  the actual vector will be much longer.

ans <- vector("list",length(link))

for (i in seq_along(link)){
  ans[[i]] <- readLines(url(link[i]))
  Sys.sleep(8)
}
###

The problem is, the sever will not response if the retrieval happens
too often and I don't know what the optimal time span between two
retrieval.
When the sever does not response to readLines, it will return an error
and stop. What I want to do is: when an error occurs, I put R to sleep
for say 60 seconds, and redo the readLines on the same link.

I did some search and guess withCallingHandlers and withRestarts will
do the trick. Yet, I didn't find much example on the usage of them.
Can you give me some suggestions? Thanks.

-- 
Wincent Rong-gui HUANG
Doctoral Candidate
Dept of Public and Social Administration
City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html

__
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 Statistical Package Installation

2011-03-05 Thread Wincent
I guess your OS is windows. In that case, you need to download the R
binaries for windows (e.g.
http://ftp.ctex.org/mirrors/CRAN/bin/windows/) rather than the source
tar ball.

Regards,
Ronggui

On 5 March 2011 19:56, Nasir Afsar  wrote:
> Dear R-project team,
> I have tried but could not install the R statistical package 
> (http://cran.ms.unimelb.edu.au/ ) even after the help of my institute's IT 
> personnel. The setup file could not be downloaded. The latest file 
> R-2.12.2.tar.gz<http://cran.ms.unimelb.edu.au/src/base/R-2/R-2.12.2.tar.gz> 
> does not start installation wizard. Kindly extend the technical support.
>
> Best regards.
>
> Dr. Nasir Ali Afsar  MBBS, M.Phil.
> Senior Lecturer in Pharmacology,
> College of Medicine,
> Alfaisal University,
> Al-Takhassusi Road,
> P.O. Box 50927,
> Riyadh-11533, Saudi Arabia.
> Tel: +966-1-2157679.
> naf...@alfaisal.edu<mailto:naf...@alfaisal.edu>
> drnasi...@yahoo.com<mailto:drnasi...@yahoo.com>
> www.alfaisal.edu<http://www.alfaisal.edu/>
>
>
>
> 
> DISCLAIMER: This electronic mail transmission contains c...{{dropped:16}}
>
> __
> 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.
>



-- 
Wincent Ronggui HUANG
Sociology Department of Fudan University
PhD of City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html

__
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] Trojan in R 2.13.0?

2011-04-14 Thread Wincent
Also fine with Kaspersky.

Ronggui

On 15 April 2011 05:37, David Freedman  wrote:
> 2.13.0 looks fine with VIPRE
>
> david freedman
> atlanta
>
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/Trojan-in-R-2-13-0-tp3450084p3450784.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.
>



-- 
Wincent Ronggui HUANG
Sociology Department of Fudan University
PhD of City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html

__
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] odfWeave \ odfTable and encoding

2011-04-20 Thread Wincent
This has been a long-lasting issue without good solution for windows
because windows does not support UTF-8 encoding.

If you are using Linux, you can set UTF-8 locale through Sys.setlocale.

Regards

On 20 April 2011 16:51, kristell.desseaux
 wrote:
> Dear All,
>
> I usually use the package Sweave and Latex, but I want to explore the
> opportunities available with odfWeave. So I started exploring this "new"
> package.
>
> I find myself hang while attempting to insert tables in the document
> odt. I built a data.frame to present the results of statistical
> analysis, more complex than a conventional contingency table.
>
> Now when I run the command odfWeave, I get the following error that
> appears.
>
> Post-processing the contents
>
> Input is not proper UTF-8, indicate encoding !
>
> Bytes: 0xE9 0x6D 0x69 0x6E
>
> Erreur : 1: Input is not proper UTF-8, indicate encoding !
>
> Bytes: 0xE9 0x6D 0x69 0x6E
>
> It seems to be an encoding problem since I managed to turn the function
> odfWeave with another type of table less "complex" no accent, no "%" ...
>
> Here is my current configuration, on Windows 7, SessionInfo ()
>
> R version 2.10.1 (2009-12-14)
>
> i386-pc-mingw32
>
> locale:
>
> [1]
> LC_COLLATE=French_France.1252LC_CTYPE=French_France.1252LC_MONETARY=French_France.1252
> LC_NUMERIC=CLC_TIME=French_France.1252
>
> attached base packages:
>
> [1] gridsplinesstatsgraphicsgrDevices utilsdatasetsmethodsbase
>
> other attached packages:
>
> [1] MASS_7.3-4survival_2.35-7
> chron_2.3-38xtable_1.5-6gdata_2.8.0odfWeave_0.7.11 XML_3.2-0lattice_0.17-26
>
> loaded via a namespace (and not attached):
>
> [1] gtools_2.6.2 tools_2.10.1
>
> I also found this function that allows me to know the encoding in place
> l10n_info R ().
>
> $MBCS
>
> [1] FALSE
>
> $`UTF-8`
>
> [1] FALSE
>
> $`Latin-1`
>
> [1] TRUE
>
> $codepage
>
> [1] 1252
>
> I wanted to know if you knew how to change the encoding of reference in R?
>
> Thank you very much.
>
> Kristell
>
> --
> Kristell DESSEAUX
>
> Biostatisticienne
>
> Département de Biostatistique et Informatique Médicale
> Hôpital Saint Louis, 1 avenue Claude Vellefaux
> 75475 PARIS Cedex 10
>
> Tel : +33 (0)1 42 49 97 48
> Sec : +33 (0)1 42 49 97 42
> Fax : +33 (0)1 42 49 97 45
>
>
>        [[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.
>
>



-- 
Wincent Ronggui HUANG
Sociology Department of Fudan University
PhD of City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html

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

2011-04-25 Thread Wincent
I believe this posting is placed, and I take the liberty to re-direct
to the r-help mailing list.

Regards,
Ronggui

On 26 April 2011 12:33,   wrote:
>  I am trying to create a web user interface using RApache. I need to install 
> rJava packge but I am getting the following error message
>
> RApache Warning/Error!!!
>
> Error : .onLoad failed in loadNamespace() for 'rJava', details: call: 
> dyn.load(file, DLLpath = DLLpath, ...) error: unable to load shared library 
> '/usr/lib/R/site-library/rJava/libs/rJava.so': libjvm.so: cannot open shared 
> object file: No such file or directory
>
>
> I would really appreciate if you could help me out in this regard.
>
>



-- 
Wincent Ronggui HUANG
Sociology Department of Fudan University
PhD of City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html

__
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-pkgs] RQDA 0.2-2 has been released

2011-12-27 Thread Wincent
Dear all,

RQDA is a package for computer-aided qualitative data analysis, currently
supporting plain text as qualitative data.
It supports various operations in the grounded theory tradition such as
coding, retrieval of codings, categorisation, attributes etc. It can also
be used for content analysis and similar analysis, the result of which can
be exported to be analysed in quantitative or qualitative comparative
analysis.

The change in the new version includes:
* easier to uncode a coding (major change in GUI behaviour)
* rename of GetAttr to getAttr
* support MySQL preliminarily
* export attribute items in pop-up menu
* new function of codingBySearch, for auto-coding
* new function of exportCodedFile
* enhancement related to encoding
* various bugfixes
More can be found in the changelog.

As always, comments, suggestions and contributions are highly welcome.

Best

-- 
Wincent Ronggui HUANG
Sociology Department of Fudan University
PhD of City University of Hong Kong
http://homepage.fudan.edu.cn/rghuang/cv/

[[alternative HTML version deleted]]

___
R-packages mailing list
r-packa...@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-packages

__
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] Long command in Sweave

2012-04-13 Thread Wincent
Dear useRs,

I am writing a vignette for a package, which contains long command like this,
>reduce(Lipset_cs,"SURVIVAL",c("GNPCAP", "URBANIZA", "LITERACY", "INDLAB", 
>"GOVSTAB"),explain="positive",remainder="exclude",case="CASEID")
It is longer than the width a page and part of it will become "missing".
Currently, I have to manually break the command into multiple lines.
Is there a better way to handle such issue?
It seems that others have raised similar question which seems to
remain unsolved in a satisfactory fashion.

Thanks for your kind attention in advance.

-- 
Wincent Ronggui HUANG
Sociology Department of Fudan University
PhD of City University of Hong Kong
http://homepage.fudan.edu.cn/rghuang/cv/

__
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] Long command in Sweave

2012-04-13 Thread Wincent
Thanks, Gavin and Duncan.

In that case, what I need is a suitable editor which can break the
command properly.

All the best

On 13 April 2012 19:33, Gavin Simpson  wrote:
> On Fri, 2012-04-13 at 17:46 +0800, Wincent wrote:
>> Dear useRs,
>>
>> I am writing a vignette for a package, which contains long command like this,
>> >reduce(Lipset_cs,"SURVIVAL",c("GNPCAP", "URBANIZA", "LITERACY", "INDLAB", 
>> >"GOVSTAB"),explain="positive",remainder="exclude",case="CASEID")
>> It is longer than the width a page and part of it will become "missing".
>> Currently, I have to manually break the command into multiple lines.
>> Is there a better way to handle such issue?
>
> Not that I am aware of.
>
>> It seems that others have raised similar question which seems to
>> remain unsolved in a satisfactory fashion.
>>
>> Thanks for your kind attention in advance.
>>
>
> 1) use some spacing and format the code over multiple lines
>
> reduce(Lipset_cs, "SURVIVAL",
>       c("GNPCAP", "URBANIZA", "LITERACY", "INDLAB", "GOVSTAB"),
>       explain="positive", remainder="exclude", case="CASEID")
>
> Isn't that more readable?! Any good R-aware editor should be able to
> handle appropriate formatting of the code. I *never* write long lines in
> my editor; I always break the code down to fit roughly into a 72 column
> editor window.
>
> 2) if you want to force Sweave to respect your new formatting, use
> argument `keep.source=TRUE` for the code chunk. Or set it document wide
> using \SweaveOpts{option1=value1, option2=value2} etc in the preamble
> (where optionX is one of the arguments and valueX what you want to set
> that argument too.
>
> Thought IIRC, `keep.source=TRUE` is the default now and as such Sweave
> will respect your formatting by default now - before it broke lines
> where it could.
>
> In short get out of the habit of writing long lines of R code; you'll be
> better in the long run laying your code out logically.
>
> HTH
>
> G
>
> --
> %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
>  Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
>  ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
>  Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
>  Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
>  UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
> %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
>
>
>



-- 
Wincent Ronggui HUANG
Sociology Department of Fudan University
PhD of City University of Hong Kong
http://homepage.fudan.edu.cn/rghuang/cv/

__
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] file path

2012-05-09 Thread Wincent
Dear all, is there any function to assert whether a file path is
legitimate, and to convert any potential file path to a legitimate
file path?

I automate a batch of files and write them to plain text files with
cat(). The file argument of cat() is generated automatically which may
contain characters such as ? < >, unacceptable in Windows OS. What I
do at this moment is to strip such characters off with gsub(). Is
there any direct way to make legitimate file path without detailed
knowledge about the naming rule specific to a OS?

Best

-- 
Wincent Ronggui HUANG
Sociology Department of Fudan University
PhD of City University of Hong Kong
http://homepage.fudan.edu.cn/rghuang/cv/

__
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] file path

2012-05-09 Thread Wincent
Hmm, I don't think it gives what I want.

For example, I assign a file name to f,
> f <- "a?b.txt"
> file.path("e:",f)
[1] "e:/a?b.txt"

The resultant character is not accepted as a file name by Windows OS.

On 9 May 2012 20:32, Tal Galili  wrote:
> Hi Wincent,
> Have a look at:
> ?file.path
>
>
>
> Contact
> Details:---
> Contact me: tal.gal...@gmail.com |  972-52-7275845
> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
> www.r-statistics.com (English)
> ------
>
>
>
>
> On Wed, May 9, 2012 at 11:03 AM, Wincent  wrote:
>>
>> Dear all, is there any function to assert whether a file path is
>> legitimate, and to convert any potential file path to a legitimate
>> file path?
>>
>> I automate a batch of files and write them to plain text files with
>> cat(). The file argument of cat() is generated automatically which may
>> contain characters such as ? < >, unacceptable in Windows OS. What I
>> do at this moment is to strip such characters off with gsub(). Is
>> there any direct way to make legitimate file path without detailed
>> knowledge about the naming rule specific to a OS?
>>
>> Best
>>
>> --
>> Wincent Ronggui HUANG
>> Sociology Department of Fudan University
>> PhD of City University of Hong Kong
>> http://homepage.fudan.edu.cn/rghuang/cv/
>>
>> __
>> 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.
>
>



-- 
Wincent Ronggui HUANG
Sociology Department of Fudan University
PhD of City University of Hong Kong
http://homepage.fudan.edu.cn/rghuang/cv/

__
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] file path

2012-05-10 Thread Wincent
As I said, the file name is derived automatically from text processing.
Thanks all the same.

On 10 May 2012 20:35, Upton, Stephen (Steve) (CIV)  wrote:
> Why not just construct a valid file name and use that in cat? You can then use
> file.path to join paths together if you want to write to a specific location,
> as in your example.
>
> steve
>
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf Of Wincent
> Sent: Wednesday, May 09, 2012 11:15 AM
> To: Tal Galili
> Cc: r help
> Subject: Re: [R] file path
>
> Hmm, I don't think it gives what I want.
>
> For example, I assign a file name to f,
>> f <- "a?b.txt"
>> file.path("e:",f)
> [1] "e:/a?b.txt"
>
> The resultant character is not accepted as a file name by Windows OS.
>
> On 9 May 2012 20:32, Tal Galili  wrote:
>> Hi Wincent,
>> Have a look at:
>> ?file.path
>>
>>
>>
>> Contact
>> Details:---
>> Contact me: tal.gal...@gmail.com |  972-52-7275845 Read me:
>> www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
>> www.r-statistics.com (English)
>> --
>> 
>>
>>
>>
>>
>> On Wed, May 9, 2012 at 11:03 AM, Wincent  wrote:
>>>
>>> Dear all, is there any function to assert whether a file path is
>>> legitimate, and to convert any potential file path to a legitimate
>>> file path?
>>>
>>> I automate a batch of files and write them to plain text files with
>>> cat(). The file argument of cat() is generated automatically which
>>> may contain characters such as ? < >, unacceptable in Windows OS.
>>> What I do at this moment is to strip such characters off with gsub().
>>> Is there any direct way to make legitimate file path without detailed
>>> knowledge about the naming rule specific to a OS?
>>>
>>> Best
>>>
>>> --
>>> Wincent Ronggui HUANG
>>> Sociology Department of Fudan University PhD of City University of
>>> Hong Kong http://homepage.fudan.edu.cn/rghuang/cv/
>>>
>>> __
>>> 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.
>>
>>
>
>
>
> --
> Wincent Ronggui HUANG
> Sociology Department of Fudan University PhD of City University of Hong Kong
> http://homepage.fudan.edu.cn/rghuang/cv/
>
> __
> 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.



-- 
Wincent Ronggui HUANG
Sociology Department of Fudan University
PhD of City University of Hong Kong
http://homepage.fudan.edu.cn/rghuang/cv/

__
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] file path

2012-05-14 Thread Wincent
Thanks for the suggestion. The file name in my case is Chinese, which
makes the regular expression less useful.

Anyway, I would like to pose a followup question.
I have a character string of "ABC\D", and want to strip away the "\"
and want a returned character of "ABCD". How can I do it with gsub() ?

Thanks again.

On 9 May 2012 22:40, Duncan Murdoch  wrote:
> On 09/05/2012 4:03 AM, Wincent wrote:
>>
>> Dear all, is there any function to assert whether a file path is
>> legitimate, and to convert any potential file path to a legitimate
>> file path?
>>
>> I automate a batch of files and write them to plain text files with
>> cat(). The file argument of cat() is generated automatically which may
>> contain characters such as ?<  >, unacceptable in Windows OS. What I
>> do at this moment is to strip such characters off with gsub(). Is
>> there any direct way to make legitimate file path without detailed
>> knowledge about the naming rule specific to a OS?
>
>
> I would just try to create the file, and if you fail, it's not legitimate.
>  Alternatively, you could look at the tests that R uses when it checks a
> package:  we try to keep filenames portable to all operating systems.  The
> rules seem to be strictest for vignettes:
>
>        ## we specify ASCII filenames starting with a letter in R-exts
>        ## do this in a locale-independent way.
>        OK <-
> grep("^[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz][ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-]+$",
> vignettes)
>
> Duncan Murdoch
>
>



-- 
Wincent Ronggui HUANG
Sociology Department of Fudan University
PhD of City University of Hong Kong
http://homepage.fudan.edu.cn/rghuang/cv/

__
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] file path

2012-05-14 Thread Wincent
No, but make.names only makes syntactically valid names of R object.

I think I have mentioned what I did in the first email, although no
concrete example was provided. Let me explain a bit. I have a text
file like this,

Title:AA?
Content: 1xx1

Title:BA
Content: 2xx2

I want to read the file in, process it and export it into two separate
files. 1. d:/output/AA.txt with content of 1xx1, and 2.
d:/output/BA with content of 2xx2.

The first file name is AA because I know "AA?" is not a valid file
name in Windows and ? is removed. However, there are lots of files and
it will be convenient if I can convert any invalid file name (like
"AA?") into a valid file name (like "AA") automatically.

>From the answers provided by this mailing list, it seems not easy to
write a function to construct valid file names because what is a valid
file name depends on the OS and prior knowledge is needed.

Best

On 10 May 2012 20:53, jim holtman  wrote:
> Has any mentioned
>
> ?make.names
>
> On Thu, May 10, 2012 at 8:39 AM, Wincent  wrote:
>> As I said, the file name is derived automatically from text processing.
>> Thanks all the same.
>>
>> On 10 May 2012 20:35, Upton, Stephen (Steve) (CIV)  wrote:
>>> Why not just construct a valid file name and use that in cat? You can then 
>>> use
>>> file.path to join paths together if you want to write to a specific 
>>> location,
>>> as in your example.
>>>
>>> steve
>>>
>>> -Original Message-
>>> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
>>> Behalf Of Wincent
>>> Sent: Wednesday, May 09, 2012 11:15 AM
>>> To: Tal Galili
>>> Cc: r help
>>> Subject: Re: [R] file path
>>>
>>> Hmm, I don't think it gives what I want.
>>>
>>> For example, I assign a file name to f,
>>>> f <- "a?b.txt"
>>>> file.path("e:",f)
>>> [1] "e:/a?b.txt"
>>>
>>> The resultant character is not accepted as a file name by Windows OS.
>>>
>>> On 9 May 2012 20:32, Tal Galili  wrote:
>>>> Hi Wincent,
>>>> Have a look at:
>>>> ?file.path
>>>>
>>>>
>>>>
>>>> Contact
>>>> Details:---
>>>> Contact me: tal.gal...@gmail.com |  972-52-7275845 Read me:
>>>> www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
>>>> www.r-statistics.com (English)
>>>> --
>>>> 
>>>>
>>>>
>>>>
>>>>
>>>> On Wed, May 9, 2012 at 11:03 AM, Wincent  wrote:
>>>>>
>>>>> Dear all, is there any function to assert whether a file path is
>>>>> legitimate, and to convert any potential file path to a legitimate
>>>>> file path?
>>>>>
>>>>> I automate a batch of files and write them to plain text files with
>>>>> cat(). The file argument of cat() is generated automatically which
>>>>> may contain characters such as ? < >, unacceptable in Windows OS.
>>>>> What I do at this moment is to strip such characters off with gsub().
>>>>> Is there any direct way to make legitimate file path without detailed
>>>>> knowledge about the naming rule specific to a OS?
>>>>>
>>>>> Best
>>>>>
>>>>> --
>>>>> Wincent Ronggui HUANG
>>>>> Sociology Department of Fudan University PhD of City University of
>>>>> Hong Kong http://homepage.fudan.edu.cn/rghuang/cv/
>>>>>
>>>>> __
>>>>> 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.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Wincent Ronggui HUANG
>>> Sociology Department of Fudan University PhD of City University of Hong Kong
>>> http://homepage.fudan.edu.cn/rghuang/cv/
>>>
>>> __
>>> R-help@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>

Re: [R] file path

2012-05-14 Thread Wincent
Emm, my bad.
I meant str <- "abc\d".
Any ideas?

On 14 May 2012 18:02, Baoqiang  wrote:
> This works on Mac:
>
> str <- "abc/d"
> gsub("/", "", str)
>
> Return:
> "abcd"
>
>
> Sent from my iPhone
>
> On May 14, 2012, at 4:28 AM, Wincent  wrote:
>
>> Thanks for the suggestion. The file name in my case is Chinese, which
>> makes the regular expression less useful.
>>
>> Anyway, I would like to pose a followup question.
>> I have a character string of "ABC\D", and want to strip away the "\"
>> and want a returned character of "ABCD". How can I do it with gsub() ?
>>
>> Thanks again.
>>
>> On 9 May 2012 22:40, Duncan Murdoch  wrote:
>>> On 09/05/2012 4:03 AM, Wincent wrote:
>>>>
>>>> Dear all, is there any function to assert whether a file path is
>>>> legitimate, and to convert any potential file path to a legitimate
>>>> file path?
>>>>
>>>> I automate a batch of files and write them to plain text files with
>>>> cat(). The file argument of cat() is generated automatically which may
>>>> contain characters such as ?<  >, unacceptable in Windows OS. What I
>>>> do at this moment is to strip such characters off with gsub(). Is
>>>> there any direct way to make legitimate file path without detailed
>>>> knowledge about the naming rule specific to a OS?
>>>
>>>
>>> I would just try to create the file, and if you fail, it's not legitimate.
>>>  Alternatively, you could look at the tests that R uses when it checks a
>>> package:  we try to keep filenames portable to all operating systems.  The
>>> rules seem to be strictest for vignettes:
>>>
>>>        ## we specify ASCII filenames starting with a letter in R-exts
>>>        ## do this in a locale-independent way.
>>>        OK <-
>>> grep("^[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz][ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-]+$",
>>> vignettes)
>>>
>>> Duncan Murdoch
>>>
>>>
>>
>>
>>
>> --
>> Wincent Ronggui HUANG
>> Sociology Department of Fudan University
>> PhD of City University of Hong Kong
>> http://homepage.fudan.edu.cn/rghuang/cv/
>>
>> __
>> 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.



-- 
Wincent Ronggui HUANG
Sociology Department of Fudan University
PhD of City University of Hong Kong
http://homepage.fudan.edu.cn/rghuang/cv/

__
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 Memory Issues

2012-05-20 Thread Wincent
Try memory.limit(92000)

sent from my HTC
On May 21, 2012 1:27 AM, "Emiliano Zapata"  wrote:

> -- Forwarded message --
> From: Emiliano Zapata 
> Date: Sun, May 20, 2012 at 12:09 PM
> Subject:
> To: R-help@r-project.org
>
>
> Hi,
>
> I have a 64 bits machine (Windows) with a total of 192GB of physical memory
> (RAM), and total of 8 CPU. I wanted to ask how can I make R make use of all
> the memory. I recently ran a script requiring approximately 92 GB of memory
> to run, and got the massage:
>
>  cannot allocate memory block of size 2.1 Gb
>
>
>
> I read on the web that if you increase the memory you have to reinstall R;
> would that be enough. Could I just increase the memory manually.
>
>
> Take you for any comments, or links on the web.
>
>
> EZ
>
>[[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.
>

[[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.