Re: [R] OT: did the wildfires affect tolstoy.newcastle.edu.au?

2009-02-10 Thread Jim Lemon

Carl Witthoft wrote:

Just jumping to conclusions since the site is down as I type (7PM EST).

What's the news from that part of Australia -- thus showing my 
complete ignorance of DownUnder geography.



Hi Carl,
The big fires are hundreds of kilometers from Newcastle, although there 
was a bushfire about 60 km west of there yesterday, I think. It's 
currently raining in Newcastle, so tolstoy may be flooded...


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.


Re: [R] summary statistics

2009-02-10 Thread Jim Lemon

William Revelle wrote:

At 6:41 PM -0500 2/9/09, David Winsemius wrote:

describe() in Hmisc provides much of the rest of what you asked for:


 describe(pref900$TCHDL)

pref900$TCHDL
  n missing  uniqueMean .05 .10 .25 .50 
.75 .90 .95
 9061904469   16051   4.123   2.320   2.557   3.061   3.841   
4.886   6.054   6.867


lowest :  0.9342  1.0200  1.0522  1.1008  1.1061, highest: 19.8696 
20.1667 20.7619 21.6364 21.7200




As does describe in the psych package

describe(sat.act)

 describe(sat.act)
  var   n   mean sd median trimmedmad min max range 
skew kurtosis   se
gender  1 700   1.65   0.48  21.68   0.00   1   2 1 
-0.61-1.62 0.02
education   2 700   3.16   1.43  33.31   1.48   0   5 5 
-0.68-0.07 0.05
age 3 700  25.59   9.50 22   23.86   5.93  13  6552 
1.64 2.42 0.36
ACT 4 700  28.55   4.82 29   28.84   4.45   3  3633 
-0.66 0.53 0.18
SATV5 700 612.23 112.90620  619.45 118.61 200 800   600 
-0.64 0.33 4.27
SATQ6 687 610.22 115.64620  617.25 118.61 200 800   600 
-0.59-0.02 4.41


see also describe.by to break this down by some grouping variable.

Bill





On Feb 9, 2009, at 6:04 PM, phoebe kong wrote:


Hi all,

I'm wondering if there is a function that can return summary 
statistics:

N=total number of observation, # missing, mean, median, range, standard
deviation.

As I know, summary() returns some of info I've mentioned above.

Thanks,
SY



and if you want to roll your own descriptive stats, the describe 
function in the prettyR package (confusing, isn't it?)


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.


Re: [R] Help on BarPlot

2009-02-10 Thread Thomas Roth (geb. Kaliwe)

Hi,

#There are a lot of examples for barplot if you just type

example(barplot)

# i altered one slightly to put the values on top of each bar

mp - barplot(VADeaths) # default
#tot - colMeans(VADeaths)   #changed this line
tot = colSums(VADeaths)#wether you need max, min, mean , colSums 
will depend on your data

text(mp, tot + 4, format(tot), xpd = TRUE, col = blue)


#you should be able to get it from here


Thomas




Steve Sidney schrieb:

Dear all

As a new user of R, can someone please help me with the following

I have created a programme to analyse laboratory data and one of the graphs is 
a bar plot of 'Z' scores.

On the bar plot I am using the following line to plot some results

 barplot (zb[,c(ZBW)], ylim = c(-6,6), names.arg=zb[,c(LabNo)],xlab=Lab Code 
Number, cex.names = .5 , axis.lty=1 , main =  Total Coliform )

What I would like to do is move the xlab parameter to sit on top or on each bar 
and not on the x-axis at y=0.

Any help would be appreciated.

Thanks

Steve
[[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] twitter useRs?

2009-02-10 Thread Tobias Verbeke

Hi José,


I wonder if there are any useRs sharing day-to-day realizations/tricks
on twitter...
Seems like a good place for those things that are good findings, but
one is too lazy to blog about them...


I don't twitter, but I wrote an R package
to read and write tweets from the R command
line for twitter and laconi.ca.

I will submit it soon, but if anyone is interested
contact me off-list.

Best,
Tobias

__
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] Replacing dot with empty space

2009-02-10 Thread Sergey Goriatchev
Hello, everyone

How do I replace dot with empty space in ED4.Comdty?
I need to get ED4 Comdty
tried sub() in many different ways, like sub({.},  , ED4.Comdty)
etc but could not do it.

Thanks in advance,
Sergey

__
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] Replacing dot with empty space

2009-02-10 Thread Sergey Goriatchev
OK, got it now:
sub([.],  , ED4.Comdty)


On Tue, Feb 10, 2009 at 10:01, Sergey Goriatchev serg...@gmail.com wrote:
 Hello, everyone

 How do I replace dot with empty space in ED4.Comdty?
 I need to get ED4 Comdty
 tried sub() in many different ways, like sub({.},  , ED4.Comdty)
 etc but could not do it.

 Thanks in advance,
 Sergey




-- 
I'm not young enough to know everything. /Oscar Wilde
Experience is one thing you can't get for nothing. /Oscar Wilde
When you are finished changing, you're finished. /Benjamin Franklin
Tell me and I forget, teach me and I remember, involve me and I learn.
/Benjamin Franklin
Luck is where preparation meets opportunity. /George Patten

__
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] Problem installing MASS-Package

2009-02-10 Thread Kim Vanselow
Dear R-Help-Team,

I tried to use isoMDS-Function of the MASS-Package:

Message:
Fehler: konnte Funktion isoMDS nicht finden
(error: could not find function isoMDS)

so I tried to install the package MASS:

 utils:::menuInstallPkgs()
versuche URL 'http://cran.rakanu.com/bin/windows/contrib/2.8/VR_7.2-45.zip'
Content type 'application/zip' length 1598763 bytes (1.5 Mb)
URL geöffnet
downloaded 1.5 Mb

Bundel 'VR' erfolgreich ausgepackt und MD5 Summen abgeglichen
Warnung: kann alte Installation von Paket 'MASS' nicht entfernen

Die heruntergeladenen Pakete sind in 
C:\Dokumente und Einstellungen\kvanselow\Lokale 
Einstellungen\Temp\RtmpeIMdIP\downloaded_packages
aktualisiere HTML Paketbeschreibungen
 

ok, MASS seems to be already installed. But I cannot run its functions and I 
cannot find the path:

 .libPaths(MASS)
Fehler in path.expand(new) : objekt MASS nicht gefunden

What can I do?
Thanks in advance

Kim



___
Jetzt 1 Monat kostenlos! WEB.DE FreeDSL - Telefonanschluss + DSL
für nur 17,95 EURO/mtl.!* http://dsl.web.de/?ac=OM.AD.AD008K13805B7069a

__
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] Choosing a random number between x and y

2009-02-10 Thread Bernardo Rangel Tura
On Mon, 2009-02-09 at 06:40 -0800, Vie wrote:
 Hi,
 
 Ive been trying to find a function that will allow me to pull out a number
 between a minimum and maximum threshold.
 
 I want a random decimal number between, for example, 0 and 0.5 or 0 and 0.7.
 I've been searching everywhere for a function that will allow me to do this
 in R, but I have yet to be successful. Any help would be much appreciated.
 
 Thanks in advance

Hi Vie 

I don't understand if you need a only random generation or mixture
random generation, so i will make the 3 examples Using runif

1- Random 10 number Retween 0 and 0.5 runif(10,0,0.5)

2 -Random 20 number Retween 0 and 0.7 runif(20,0,0.7)

3- Random 40 number of mixture two random uniforme random 1 and 2 with
p(random1)= 0.3 and p(random=2) = 0.7

ifelse(runif(40).3,runif(40,0,0.7),runif(40,0,0.5))

-- 
Bernardo Rangel Tura, M.D,MPH,Ph.D
National Institute of Cardiology
Brazil

__
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] twitter useRs?

2009-02-10 Thread Gesmann, Markus
Hi all,

A colleague of mine wrote a little function to send messages to twitter:

update - function(status){
method - http://twitter.com/statuses/update.xml?status=;
encoded_status - URLencode(status)
request - paste(method,encoded_status,sep = )
postForm(request,.opts = opts)
}

See also:
http://twitter.com/sebastiansuncle?page=2, http://pastie.org/367741


Regards

Markus




-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Tobias Verbeke
Sent: 10 February 2009 08:54
To: Jose Quesada
Cc: r-help@r-project.org
Subject: Re: [R] twitter useRs?


Hi José,

 I wonder if there are any useRs sharing day-to-day realizations/tricks
 on twitter...
 Seems like a good place for those things that are good findings, but
 one is too lazy to blog about them...

I don't twitter, but I wrote an R package
to read and write tweets from the R command
line for twitter and laconi.ca.

I will submit it soon, but if anyone is interested
contact me off-list.

Best,
Tobias

__
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.
**
The information in this E-Mail and in any attachments is...{{dropped:27}}

__
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] Odp: Problem installing MASS-Package

2009-02-10 Thread Petr PIKAL
Hi

Did you try to issue

library(MASS)

before calling isoMDS?

Regards
Petr

r-help-boun...@r-project.org napsal dne 10.02.2009 10:22:57:

 Dear R-Help-Team,
 
 I tried to use isoMDS-Function of the MASS-Package:
 
 Message:
 Fehler: konnte Funktion isoMDS nicht finden
 (error: could not find function isoMDS)
 
 so I tried to install the package MASS:
 
  utils:::menuInstallPkgs()
 versuche URL 
'http://cran.rakanu.com/bin/windows/contrib/2.8/VR_7.2-45.zip'
 Content type 'application/zip' length 1598763 bytes (1.5 Mb)
 URL geöffnet
 downloaded 1.5 Mb
 
 Bundel 'VR' erfolgreich ausgepackt und MD5 Summen abgeglichen
 Warnung: kann alte Installation von Paket 'MASS' nicht entfernen
 
 Die heruntergeladenen Pakete sind in 
 C:\Dokumente und Einstellungen\kvanselow\Lokale 
Einstellungen\Temp
 \RtmpeIMdIP\downloaded_packages
 aktualisiere HTML Paketbeschreibungen
  
 
 ok, MASS seems to be already installed. But I cannot run its functions 
and I 
 cannot find the path:
 
  .libPaths(MASS)
 Fehler in path.expand(new) : objekt MASS nicht gefunden
 
 What can I do?
 Thanks in advance
 
 Kim
 
 
 
 ___
 Jetzt 1 Monat kostenlos! WEB.DE FreeDSL - Telefonanschluss + DSL
 für nur 17,95 EURO/mtl.!* http://dsl.web.de/?ac=OM.AD.AD008K13805B7069a
 
 __
 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] Fast fourier transformation

2009-02-10 Thread botto
Hi,

 

here is a practical problem we would like to solve. In a pneumatic post the
acceleration of the capsule is measured and plotted over time. From the
graph achieved we would like to derive some kind of statistic value that
describes the stress the capsule, or what is in it, is exhibited to.

 

The amount of stress introduced to the capsule will probably depend on two
things, the maximum amplitudes observed AND the frequency of these
amplitudes. A quick note at this point: Not the acceleration by itself but
the quick acceleration changes are the components which make up the special
stress we want to quantify.

 

So what I would like to do is: 

1)  Apply a  fourier transformation to the acceleration profile to 

2)   get a number of harmonic waves describing my graph 

3)  and use the amplitudes of my waves in a weighted fashion to
calculate some statistical value.

 

What I tried to do is:

A) construct an artificial profile fg for testing purpose like 

a.   f1 - function(x) 0.5*sin(3*x + pi)

b.  f2 - function(x) sin(x + 0.75*pi)

c.   f3 - function(x) 1.5*sin(0.45*x + 0*pi)

d.  fg - function(x) f1(x) + f2(x) + f3(x)

B)  try to reconstruct the components of fg with  fft or fda.

 

What I don't understand yet is how:

X)  in my test example I can define the amount of harmonic components,
because here I know that number. Of course afterwards in my natural profiles
I won't know.

Y)  I have to transform the values I get out of the fft and fourier
functions to estimate the frequency,  amplitude and phase of my harmonics.

 

 

Is there a good function in these packages I can use for that?

 

Best regards,

 

Benjamin



-- 
Pflichtangaben gemäß Gesetz über elektronische Handelsregister und 
Genossenschaftsregister sowie das Unternehmensregister (EHUG):

Universitätsklinikum Hamburg-Eppendorf
Körperschaft des öffentlichen Rechts
Gerichtsstand: Hamburg

Vorstandsmitglieder:
Prof. Dr. Jörg F. Debatin (Vorsitzender)
Dr. Alexander Kirstein
Ricarda Klein
Prof. Dr. Dr. Uwe Koch-Gromus

[[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] Problem with retrieving updated variables after attach()

2009-02-10 Thread David Croll
Hello,

suppose I have a data frame:

 mat
 id age
1 NA  NA
2 NA  NA
3 NA  NA
4 NA  NA
5 NA  NA

Then I attach the data frame:

 attach(mat)

I assign some new values...

 id - sample(100,5)
 age - rnorm(5,mean=30)

Then I want to create a new data frame from the variables id and age which 
still are attached to position 2 of the R environment...

 new_mat - data.frame(ls(pos=2)) # I want to rescue ALL variables that were 
 created by attach(mat)

 new_mat
 ls.pos...2.
1 age
2  id

But this leads to a bogus object... how can I rescue the updated id and age 
values into new_mat?


Regards,

David

-- 
Jetzt 1 Monat kostenlos! GMX FreeDSL - Telefonanschluss + DSL 
für nur 17,95 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a

__
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] need help with installRExcel()

2009-02-10 Thread Shitao Xu
Struggled a whole day, but still could not get DCOM working on my machine. 

What I did is:

1. Installed R 2.8.1 under folder ../R/R-2.8.1
2. Installed R_Scilab_DCOM3.0-1B5 under folder .. \R\(D)COM Server
3. Installed packages: rscproxy_1.0-12, RExcelInstaller_3.0-10, 
rcom_2.0-4...
4. run the following commands: 
library(rscproxy)
library(rcom)
comRegisterRegistry()
library(RExcelInstaller)
installRExcel()

Problems: 
1) Got error message when I run installRExcel(), which was 
The download site http://rcom.univie.ac.at seems to be currently 
unreachable. 
However, I can visit that website from IE-explorer directly. 

2) If I run the basic test from (D)Com Sever, I got Runtime Error which 
read Program: ..\R\(D)COM~1\bin\STATCO~1.EXE abornal program 
termination,  and Run-time error 462, the remote server machine does not 
exist or is unavailable. Also, the DebugView generated the following 
report:

0.  [2416] ::Init() 
00010.00032801  [2416] connector:  R 
00020.00036630  [2416] DLL:rscproxy.dll 
00030.00040314  [2416] environment:R_HOME 
00040.00043921  [2416] registry key:   Software\R-core\R 
00050.00047554  [2416] registry value: InstallPath 
00060.00051146  [2416] version key: 
00070.00054723  [2416] version value: 
00080.00058359  [2416] binary dir: bin 
00090.00062370  [2416] connector:  Rold 
00100.00066010  [2416] DLL:rproxy.dll 
00110.00069640  [2416] environment:R_HOME 
00120.00073309  [2416] registry key:   Software\R-core\R 
00130.00076879  [2416] registry value: InstallPath 
00140.00080503  [2416] version key: 
00150.00084128  [2416] version value: 
00160.00087704  [2416] binary dir: bin 
00170.00091685  [2416] connector:  SciLab 
00180.00095268  [2416] DLL:sciproxy.dll 
00190.00098887  [2416] environment:SCILAB_HOME 
00200.00102560  [2416] registry key:   Software\Scilab\%s 
00210.00106183  [2416] registry value: SCIPATH 
00220.00109763  [2416] version key:Software\Scilab 
00230.00113390  [2416] version value:  LASTINSTALL 
00240.00116993  [2416] binary dir: bin 
00250.00124627  [2416] sc_proxy_find_connector: 00860FD0/R 
(current R) 
00260.00128378  [2416] sc_proxy_find_connector: found R 
00270.00133204  [2416] looking up registry key at 
HKCU\Software\R-core\R\InstallPath 
00280.00139897  [2416] looking up registry key at 
HKLM\Software\R-core\R\InstallPath 
00290.00154388  [2416] 
SetEnvironmentVariable(R_HOME,C:\Documents and 
Settings\xushita\R\R-2.8.1) 
00300.00161946  [2416] 
SetEnvironmentVariable(PATH,C:\progra~1\oracle\product\10.2.0\bin;C:\Program 
Files\blp\API\dde\;C:\Program Files\blp\API\;C:\Program 
Files\TimeScape\Program;C:\Program 
Files\Reuters\Common\Login;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program
 
Files\sybase\OLEDB\;C:\Program Files\sybase\odbc;C:\Program 
Files\sybase\ocs-12_5\dll;C:\Program 
Files\sybase\OCS-12_5\lib3p;C:\Program 
Files\sybase\ocs-12_5\bin;C:\Program 
Files\oracle\product\9.2.0.1\bin;C:\Program 
Files\oracle\product\9.2.0.1\jre\1.1.8\bin;C:\Program 
Files\oracle\product\9.2.0.1\jre\1.1.8\bin;C:\Program 
Files\GED_Technology\Excel\RiskServer;C:\Program 
Files\sybase\ado.net\dll;C:\Program Files\sybase\oledb;C:\Program 
Files\sybase\odbc;C:\Program Files\sybase\ocs-12_5\dll;C:\Program 
Files\sybase\ocs-12_5\bin;C:\Program Files\Xenomorph\Xenomorph 
System\Utilities\;C:\Program Files\Xenomorph\Xenomorph 
System\Program\;C:\Program Files\notes;C:\Program 
Files\oracle\product\9.2.0.1\jre\1.1.8\bin;c:\Documents and Settings\All 
Users\GED_Technology\Excel\RiskServer;C:\program files\notes\;C:\Program 
Files\blp\API\dde;C:\Program 
Files\blp\API;C:\PROGRA~1\Sybase\ADO.NET\dll;C:\PROGRA~1\Sybase\DataAccess\ODBC\dll;C:\PROGRA~1\Sybase\OCS-12_5\bin;C:\PROGRA~1\Sybase\OCS-12_5\lib3p;C:\PROGRA~1\Sybase\OCS-12_5\dll;C:\PROGRA~1\Sybase\DataAccess\OLEDB\dll;C:\PROGRA~1\Sybase\OLEDB;C:\PROGRA~1\Sybase\ODBC;C:\Program
 
Files\MATLAB\R2008a\bin;H:\matlab\bin;H:\matlab\bin\win32;C:\Program 
Files\MATLAB\R2008a\bin\win32;C:\Program 
Files\oracle\product\9.2.0.1\jre\1.1.8\bin;C:\Documents and 
Settings\xushita\R\R-2.8.1\bin) 

I appreciate any help!




---



Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional 
EU corporate and regulatory disclosures.
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list

Re: [R] installing R on Ubuntu

2009-02-10 Thread Neil Shephard



znmeb wrote:
 
 On Mon, Feb 9, 2009 at 4:51 AM, Neil Shephard nsheph...@gmail.com wrote:

 There are pro's and con's to each of the GNU/Linux flavours and its
 really a
 matter of deciding which you like/have invested time in learning.

 Irrespective its still simple to install R from source under GNU/Linux...

 1) Download source tar-ball
 2) Extract and cd to the directory
 3) ./configure --prefix=/where/you/want/R/to/go (optionally setting the
 install path at this stage)
 4) ./make
 5) ./make install

 ...all documented in the FAQ at
 http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-can-R-be-installed-_0028Unix_0029
 
 Many Linux distros do *not* install the development tools by default,
 and which ones live in which packages varies by distro. Fedora in
 particular is extremely stripped when you install from the LiveCD. You
 have to install gcc, make and a couple of other things just to install
 VMware Tools, for example, when running Fedora as a VMware guest. For
 building R from source and installing R packages, you'll also need to
 install gfortran. And many libraries with external dependencies, like
 Rgraphviz, will require not only the package itself (graphviz) but
 also the C headers, which may have the name graphviz-devel on some
 distros and some other name on other distros.
 

What, a Linux distro that *doesn't* come with gcc!!  I have to say I'm quite
amazed at that!!

gfortran is usually a component of gcc, no?

I agree that ensuring libraries are available for all of the packages can be
tricky, but its not insurmountable (although its one of the reasons I left
Slackware in favour of Gentoo), but its no different to learning the
vagaries of M$-windows.  Its a common misconception I see frequently that
computers/software should just work, and thats really not the case.  They
do what they are told to, and the person using them often needs to
understand them in a bit of detail, and this detail is often occluded under
Windows so when people try to make the transition from to GNU/Linux they are
initially over-whelmed.

Anyway, all OT.

Neil


-- 
View this message in context: 
http://www.nabble.com/installing-R-on-Ubuntu-tp10025949p21931845.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] Odp: Problem with retrieving updated variables after attach()

2009-02-10 Thread Petr PIKAL
Hi


r-help-boun...@r-project.org napsal dne 10.02.2009 12:02:53:

 Hello,
 
 suppose I have a data frame:
 
  mat
  id age
 1 NA  NA
 2 NA  NA
 3 NA  NA
 4 NA  NA
 5 NA  NA
 
 Then I attach the data frame:
 
  attach(mat)

Look into docs what attach does. If you do not understand environments use 
attach with great care

The database is not actually attached. Rather, a new environment is 
created on the search path and the elements of a list (including columns 
of a data frame) or objects in a save file or an environment are copied 
into the new environment. If you use - or assign to assign to an 
attached database, you only alter the attached copy, not the original 
object. (Normal assignment will place a modified version in the user's 
workspace: see the examples.) For this reason attach can lead to 
confusion. 


 
 I assign some new values...
 
  id - sample(100,5)
  age - rnorm(5,mean=30)
 
 Then I want to create a new data frame from the variables id and age 
which 
 still are attached to position 2 of the R environment...
 
  new_mat - data.frame(ls(pos=2)) # I want to rescue ALL variables that 
were 
 created by attach(mat)
 
  new_mat
  ls.pos...2.
 1 age
 2  id
 
 But this leads to a bogus object... how can I rescue the updated id and 
age 
 values into new_mat?

What about not using attach and transform mat directly

 mat$age - rnorm(5,mean=30)
 mat$id - sample(100,5)
 mat
  id  age
1 24 29.17842
2 88 31.22606
3 32 30.81540
4  5 29.31528
5 11 29.32775

Regards
Petr


 
 
 Regards,
 
 David
 
 -- 
 Jetzt 1 Monat kostenlos! GMX FreeDSL - Telefonanschluss + DSL 
 für nur 17,95 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a
 
 __
 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] Replacing dot with empty space

2009-02-10 Thread Gabor Grothendieck
Also, try these alternatives:

sub(.,  , x, fixed = TRUE)
chartr(.,  , x)


On Tue, Feb 10, 2009 at 4:02 AM, Sergey Goriatchev serg...@gmail.com wrote:
 OK, got it now:
 sub([.],  , ED4.Comdty)


 On Tue, Feb 10, 2009 at 10:01, Sergey Goriatchev serg...@gmail.com wrote:
 Hello, everyone

 How do I replace dot with empty space in ED4.Comdty?
 I need to get ED4 Comdty
 tried sub() in many different ways, like sub({.},  , ED4.Comdty)
 etc but could not do it.

 Thanks in advance,
 Sergey




 --
 I'm not young enough to know everything. /Oscar Wilde
 Experience is one thing you can't get for nothing. /Oscar Wilde
 When you are finished changing, you're finished. /Benjamin Franklin
 Tell me and I forget, teach me and I remember, involve me and I learn.
 /Benjamin Franklin
 Luck is where preparation meets opportunity. /George Patten

 __
 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] Calculating variables

2009-02-10 Thread Uwe Ligges



Jesús Guillermo Andrade wrote:
Dear fellows: This is the problem: I have 5 variables A, B, C, D and E  
with a range from 1 to 100 with 0.1 steps. Depending on the different  
values these have, the results of the formula change:


alitemp  - ((Abase/llmcc$Clase)*PClase)+(((1/llmcc 
$Categoria)*Abase)*PCategoria)+((Abase*llmcc$Phi)*PPhi)+((Abase*llmcc 
$Rf)*PRf)





There is no instance of A...E in that formula, is it?


So, alitemp (a 283 element series) changes if any of the P** values  
changes. I need to find a combinations of those 5 variables that  
approximates the desired results. Although I can make use of a 'for'  
loop, Im not sure of how to combine the whole 5 variables changing at  
once. I understand there are many possible combinations (factorial of  
5000!, 422 with some 500 digits) but I surmise there must be a better  
way to do it.
So far, I have been changing them manually, but this task make the  
whole thing terribly slow and inneficient.

Any ideas are appreciated.
Thanks.



What do you really want to know? Some prediction for anything? Or just 
the time t when 5 variables are changing between t-1 and t?
If the latter, calculate first order differences and check for t where 
all 5 first order differences are not equal to zero.


Uwe Ligges







Cuanto mas grande son, mas daño hacen. Postulado de Perkin.
--
Jesús Guillermo Andrade (Abg.)
Gerente de Litigios y Corporativo. EDM. AC. API.
Andrade  Moreno S.C. (http://amlegal.wordpress.com/)


[[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] error using R Commander for text file import

2009-02-10 Thread Uwe Ligges



Krehbiel, Dwight wrote:

I am getting the following error on  iMac running Mac OS 10.5.6; this occurs 
whenever I try to import a text file into R Commander:

Error in splitCmd(command) : unbalanced quotes


So can you tell us exactly what you did and what the resulting code in 
the code windows was and how the data file looks like? Does it contain 
unbalanced quotes, for example?


Uwe Ligges


Thus, I am unable to import data into R Commander. Any suggestions as to how I 
might fix this error? I have gotten it many times with more than one 
installation of R 2.8.1 on this computer.

Dwight Krehbiel
Bethel College
North Newton, KS 67117
USA

__
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] need help with installRExcel()

2009-02-10 Thread patricia garcía gonzález

Hi , 

What I did was similar, install R, R(D)COM server an RExcelInstaller package. 
Then just write  installRExcel() in the console. And it works. 
Something you should know is that there is a specific mailing list for RCOM 
topic in here:

http://mailman.csd.univie.ac.at/mailman/listinfo/rcom-l

Regards

patricia.


 To: r-help@r-project.org
 From: shitao...@db.com
 Date: Tue, 10 Feb 2009 11:03:05 +
 Subject: [R] need help with installRExcel()
 
 Struggled a whole day, but still could not get DCOM working on my machine. 
 
 What I did is:
 
 1. Installed R 2.8.1 under folder ../R/R-2.8.1
 2. Installed R_Scilab_DCOM3.0-1B5 under folder .. \R\(D)COM Server
 3. Installed packages: rscproxy_1.0-12, RExcelInstaller_3.0-10, 
 rcom_2.0-4...
 4. run the following commands: 
 library(rscproxy)
 library(rcom)
 comRegisterRegistry()
 library(RExcelInstaller)
 installRExcel()
 
 Problems: 
 1) Got error message when I run installRExcel(), which was 
 The download site http://rcom.univie.ac.at seems to be currently 
 unreachable. 
 However, I can visit that website from IE-explorer directly. 
 
 2) If I run the basic test from (D)Com Sever, I got Runtime Error which 
 read Program: ..\R\(D)COM~1\bin\STATCO~1.EXE abornal program 
 termination,  and Run-time error 462, the remote server machine does not 
 exist or is unavailable. Also, the DebugView generated the following 
 report:
 
 0.  [2416] ::Init() 
 00010.00032801  [2416] connector:  R 
 00020.00036630  [2416] DLL:rscproxy.dll 
 00030.00040314  [2416] environment:R_HOME 
 00040.00043921  [2416] registry key:   Software\R-core\R 
 00050.00047554  [2416] registry value: InstallPath 
 00060.00051146  [2416] version key: 
 00070.00054723  [2416] version value: 
 00080.00058359  [2416] binary dir: bin 
 00090.00062370  [2416] connector:  Rold 
 00100.00066010  [2416] DLL:rproxy.dll 
 00110.00069640  [2416] environment:R_HOME 
 00120.00073309  [2416] registry key:   Software\R-core\R 
 00130.00076879  [2416] registry value: InstallPath 
 00140.00080503  [2416] version key: 
 00150.00084128  [2416] version value: 
 00160.00087704  [2416] binary dir: bin 
 00170.00091685  [2416] connector:  SciLab 
 00180.00095268  [2416] DLL:sciproxy.dll 
 00190.00098887  [2416] environment:SCILAB_HOME 
 00200.00102560  [2416] registry key:   Software\Scilab\%s 
 00210.00106183  [2416] registry value: SCIPATH 
 00220.00109763  [2416] version key:Software\Scilab 
 00230.00113390  [2416] version value:  LASTINSTALL 
 00240.00116993  [2416] binary dir: bin 
 00250.00124627  [2416] sc_proxy_find_connector: 00860FD0/R 
 (current R) 
 00260.00128378  [2416] sc_proxy_find_connector: found R 
 00270.00133204  [2416] looking up registry key at 
 HKCU\Software\R-core\R\InstallPath 
 00280.00139897  [2416] looking up registry key at 
 HKLM\Software\R-core\R\InstallPath 
 00290.00154388  [2416] 
 SetEnvironmentVariable(R_HOME,C:\Documents and 
 Settings\xushita\R\R-2.8.1) 
 00300.00161946  [2416] 
 SetEnvironmentVariable(PATH,C:\progra~1\oracle\product\10.2.0\bin;C:\Program
  
 Files\blp\API\dde\;C:\Program Files\blp\API\;C:\Program 
 Files\TimeScape\Program;C:\Program 
 Files\Reuters\Common\Login;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program
  
 Files\sybase\OLEDB\;C:\Program Files\sybase\odbc;C:\Program 
 Files\sybase\ocs-12_5\dll;C:\Program 
 Files\sybase\OCS-12_5\lib3p;C:\Program 
 Files\sybase\ocs-12_5\bin;C:\Program 
 Files\oracle\product\9.2.0.1\bin;C:\Program 
 Files\oracle\product\9.2.0.1\jre\1.1.8\bin;C:\Program 
 Files\oracle\product\9.2.0.1\jre\1.1.8\bin;C:\Program 
 Files\GED_Technology\Excel\RiskServer;C:\Program 
 Files\sybase\ado.net\dll;C:\Program Files\sybase\oledb;C:\Program 
 Files\sybase\odbc;C:\Program Files\sybase\ocs-12_5\dll;C:\Program 
 Files\sybase\ocs-12_5\bin;C:\Program Files\Xenomorph\Xenomorph 
 System\Utilities\;C:\Program Files\Xenomorph\Xenomorph 
 System\Program\;C:\Program Files\notes;C:\Program 
 Files\oracle\product\9.2.0.1\jre\1.1.8\bin;c:\Documents and Settings\All 
 Users\GED_Technology\Excel\RiskServer;C:\program files\notes\;C:\Program 
 Files\blp\API\dde;C:\Program 
 

Re: [R] Problem with retrieving updated variables after attach()

2009-02-10 Thread Wacek Kusnierczyk

attach provides a copy of rather than aliases to the variables within a
data frame.

d = data.frame(x=0)
attach(d)

x
# 0, from the attached copy of d

x = 1
x
# 1, from the global anvironment
d$x
# 0, from d

x - 2
x
# 1, from the global environment
d$x
# 0, from d
get('x', pos=2)
# 2, from the attached copy of d

rm(x)
x
# 2, from the attached copy of d

vQ  



David Croll wrote:
 Hello,

 suppose I have a data frame:

   
 mat
 
  id age
 1 NA  NA
 2 NA  NA
 3 NA  NA
 4 NA  NA
 5 NA  NA

 Then I attach the data frame:

   
 attach(mat)
 

 I assign some new values...

   
 id - sample(100,5)
 age - rnorm(5,mean=30)
 

 Then I want to create a new data frame from the variables id and age which 
 still are attached to position 2 of the R environment...

   
 new_mat - data.frame(ls(pos=2)) # I want to rescue ALL variables that were 
 created by attach(mat)
 

   
 new_mat
 
  ls.pos...2.
 1 age
 2  id

 But this leads to a bogus object... how can I rescue the updated id and age 
 values into new_mat?


__
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] harmonic function fiting? how to do

2009-02-10 Thread Yogesh Tiwari
Dear R Users,
I have a CO2 time series. I want to fit this series seasonal cycle and trend
with fourth harmonic function,
and then compute residuals.

I am doing something like:

file-read.csv(co2data.csv)
names(file)
attach(file)
fit-lm(co2~1+time+I(time^2)+sin(2*pi*time)+cos(2*pi*time)+sin(4*pi*time)+cos(4*pi*time)+
sin(6*pi*time)+cos(6*pi*time)+sin(8*pi*time)+cos(8*pi*time),data=file)

fit$residuals

# variable 'co2' is in ppmv and variable 'time' is in the form of decimal
time.

The problem is: when I plot above residuals vs. time, it still shows some
seasonal cycle with time.
SO, I doubt that I am doing something wrong.

Kindly help, how to fit correctly, a fourth harmonic function on CO2 which
is varying with variable 'time'.

Great thanks,

Regards,
Yogesh

-- 
Yogesh K. Tiwari (Dr.rer.nat),
Scientist,
Indian Institute of Tropical Meteorology,
Homi Bhabha Road,
Pashan,
Pune-411008
INDIA

Phone: 0091-99 2273 9513 (Cell)
: 0091-20-258 93 600 (O) (Ext.250)
Fax: 0091-20-258 93 825

[[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] Choosing a random number between x and y

2009-02-10 Thread Vie

Thanks a lot everyone. You've been a great help!
-- 
View this message in context: 
http://www.nabble.com/Choosing-a-random-number-between-x-and-y-tp21914106p21930844.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.


Re: [R] Odp: Problem with retrieving updated variables after attach()

2009-02-10 Thread David Croll
Well, I knew that attach() only creates a copy of the variables in the 
search path.


What I wanted to ask was how to *retrieve* that copy...

 mat
id age
1 NA  NA
2 NA  NA
3 NA  NA
4 NA  NA
5 NA  NA  


 attach(mat)

 id - sample(100,5)
 age - rnorm(5,mean=30)

How can I make a new data frame out of the id and age that were changed 
above?





Hi


r-help-boun...@r-project.org napsal dne 10.02.2009 12:02:53:

  

Hello,

suppose I have a data frame:



mat
  

 id age
1 NA  NA
2 NA  NA
3 NA  NA
4 NA  NA
5 NA  NA

Then I attach the data frame:



attach(mat)
  


Look into docs what attach does. If you do not understand environments use 
attach with great care


The database is not actually attached. Rather, a new environment is 
created on the search path and the elements of a list (including columns 
of a data frame) or objects in a save file or an environment are copied 
into the new environment. If you use - or assign to assign to an 
attached database, you only alter the attached copy, not the original 
object. (Normal assignment will place a modified version in the user's 
workspace: see the examples.) For this reason attach can lead to 
confusion. 



  

I assign some new values...



id - sample(100,5)
age - rnorm(5,mean=30)
  
Then I want to create a new data frame from the variables id and age 

which 
  

still are attached to position 2 of the R environment...


new_mat - data.frame(ls(pos=2)) # I want to rescue ALL variables that 
  
were 
  

created by attach(mat)



new_mat
  

 ls.pos...2.
1 age
2  id

But this leads to a bogus object... how can I rescue the updated id and 

age 
  

values into new_mat?



What about not using attach and transform mat directly

  

mat$age - rnorm(5,mean=30)
mat$id - sample(100,5)
mat


  id  age
1 24 29.17842
2 88 31.22606
3 32 30.81540
4  5 29.31528
5 11 29.32775

Regards
Petr


  

Regards,

David

--
Jetzt 1 Monat kostenlos! GMX FreeDSL - Telefonanschluss + DSL 
für nur 17,95 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a


__
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] need help with installRExcel()

2009-02-10 Thread Shitao Xu
Thank you, Patricia, 
So basically, both of us did the same thing, but installRExcel() just 
worked in your case.  Because I was installing (D)COM on my company's 
computer ( I have temporary admin right), do you think it may be due to 
that Excel won't allow the change caused by calling installRExcel()?




patricia garcía gonzález kurtney...@hotmail.com 
10/02/2009 11:58

To
Shitao Xu/db/db...@dbemea, r-help@r-project.org
cc

Subject
RE: [R] need help with installRExcel()






Hi , 

What I did was similar, install R, R(D)COM server an RExcelInstaller 
package. Then just write  installRExcel() in the console. And it works. 
Something you should know is that there is a specific mailing list for 
RCOM topic in here:

http://mailman.csd.univie.ac.at/mailman/listinfo/rcom-l

Regards

patricia.


 To: r-help@r-project.org
 From: shitao...@db.com
 Date: Tue, 10 Feb 2009 11:03:05 +
 Subject: [R] need help with installRExcel()
 
 Struggled a whole day, but still could not get DCOM working on my 
machine. 
 
 What I did is:
 
 1. Installed R 2.8.1 under folder ../R/R-2.8.1
 2. Installed R_Scilab_DCOM3.0-1B5 under folder .. \R\(D)COM Server
 3. Installed packages: rscproxy_1.0-12, RExcelInstaller_3.0-10, 
 rcom_2.0-4...
 4. run the following commands: 
 library(rscproxy)
 library(rcom)
 comRegisterRegistry()
 library(RExcelInstaller)
 installRExcel()
 
 Problems: 
 1) Got error message when I run installRExcel(), which was 
 The download site http://rcom.univie.ac.at seems to be currently 
 unreachable. 
 However, I can visit that website from IE-explorer directly. 
 
 2) If I run the basic test from (D)Com Sever, I got Runtime Error which 
 read Program: ..\R\(D)COM~1\bin\STATCO~1.EXE abornal program 
 termination, and Run-time error 462, the remote server machine does 
not 
 exist or is unavailable. Also, the DebugView generated the following 
 report:
 
  0. [2416] ::Init() 
 0001 0.00032801 [2416] connector: R 
 0002 0.00036630 [2416] DLL: rscproxy.dll 
 0003 0.00040314 [2416] environment: R_HOME 
 0004 0.00043921 [2416] registry key: Software\R-core\R 
 0005 0.00047554 [2416] registry value: InstallPath 
 0006 0.00051146 [2416] version key: 
 0007 0.00054723 [2416] version value: 
 0008 0.00058359 [2416] binary dir: bin 
 0009 0.00062370 [2416] connector: Rold 
 0010 0.00066010 [2416] DLL: rproxy.dll 
 0011 0.00069640 [2416] environment: R_HOME 
 0012 0.00073309 [2416] registry key: Software\R-core\R 
 0013 0.00076879 [2416] registry value: InstallPath 
 0014 0.00080503 [2416] version key: 
 0015 0.00084128 [2416] version value: 
 0016 0.00087704 [2416] binary dir: bin 
 0017 0.00091685 [2416] connector: SciLab 
 0018 0.00095268 [2416] DLL: sciproxy.dll 
 0019 0.00098887 [2416] environment: SCILAB_HOME 
 0020 0.00102560 [2416] registry key: Software\Scilab\%s 
 0021 0.00106183 [2416] registry value: SCIPATH 
 0022 0.00109763 [2416] version key: Software\Scilab 
 0023 0.00113390 [2416] version value: LASTINSTALL 
 0024 0.00116993 [2416] binary dir: bin 
 0025 0.00124627 [2416] sc_proxy_find_connector: 00860FD0/R 
 (current R) 
 0026 0.00128378 [2416] sc_proxy_find_connector: found R 
 0027 0.00133204 [2416] looking up registry key at 
 HKCU\Software\R-core\R\InstallPath 
 0028 0.00139897 [2416] looking up registry key at 
 HKLM\Software\R-core\R\InstallPath 
 0029 0.00154388 [2416] 
 SetEnvironmentVariable(R_HOME,C:\Documents and 
 Settings\xushita\R\R-2.8.1) 
 0030 0.00161946 [2416] 
 
SetEnvironmentVariable(PATH,C:\progra~1\oracle\product\10.2.0\bin;C:\Program 

 Files\blp\API\dde\;C:\Program Files\blp\API\;C:\Program 
 Files\TimeScape\Program;C:\Program 
 
Files\Reuters\Common\Login;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program
 

 Files\sybase\OLEDB\;C:\Program Files\sybase\odbc;C:\Program 
 Files\sybase\ocs-12_5\dll;C:\Program 
 Files\sybase\OCS-12_5\lib3p;C:\Program 
 Files\sybase\ocs-12_5\bin;C:\Program 
 Files\oracle\product\9.2.0.1\bin;C:\Program 
 Files\oracle\product\9.2.0.1\jre\1.1.8\bin;C:\Program 
 Files\oracle\product\9.2.0.1\jre\1.1.8\bin;C:\Program 
 Files\GED_Technology\Excel\RiskServer;C:\Program 
 Files\sybase\ado.net\dll;C:\Program Files\sybase\oledb;C:\Program 
 Files\sybase\odbc;C:\Program Files\sybase\ocs-12_5\dll;C:\Program 
 Files\sybase\ocs-12_5\bin;C:\Program Files\Xenomorph\Xenomorph 
 System\Utilities\;C:\Program Files\Xenomorph\Xenomorph 
 System\Program\;C:\Program Files\notes;C:\Program 
 Files\oracle\product\9.2.0.1\jre\1.1.8\bin;c:\Documents and Settings\All 

 Users\GED_Technology\Excel\RiskServer;C:\program files\notes\;C:\Program 

 Files\blp\API\dde;C:\Program 
 

Re: [R] harmonic function fiting? how to do

2009-02-10 Thread vito muggeo

dear Yogesh
It appears that your model based on parametric terms is too inflexible..

A better alternative to parametric harmonic terms is a spline-based 
approach, may be cyclic splines.. Have a look to the mgcv package..


vito



Yogesh Tiwari ha scritto:

Dear R Users,
I have a CO2 time series. I want to fit this series seasonal cycle and trend
with fourth harmonic function,
and then compute residuals.

I am doing something like:

file-read.csv(co2data.csv)
names(file)
attach(file)
fit-lm(co2~1+time+I(time^2)+sin(2*pi*time)+cos(2*pi*time)+sin(4*pi*time)+cos(4*pi*time)+
sin(6*pi*time)+cos(6*pi*time)+sin(8*pi*time)+cos(8*pi*time),data=file)

fit$residuals

# variable 'co2' is in ppmv and variable 'time' is in the form of decimal
time.

The problem is: when I plot above residuals vs. time, it still shows some
seasonal cycle with time.
SO, I doubt that I am doing something wrong.

Kindly help, how to fit correctly, a fourth harmonic function on CO2 which
is varying with variable 'time'.

Great thanks,

Regards,
Yogesh



--

Vito M.R. Muggeo
Dip.to Sc Statist e Matem `Vianelli'
Università di Palermo
viale delle Scienze, edificio 13
90128 Palermo - ITALY
tel: 091 6626240
fax: 091 485726/485612
http://dssm.unipa.it/vmuggeo

__
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] Replacing dot with empty space

2009-02-10 Thread Sergey Goriatchev
Thanks, Gabor.
You are always very helpful.

On Tue, Feb 10, 2009 at 12:42, Gabor Grothendieck
ggrothendi...@gmail.com wrote:
 Also, try these alternatives:

 sub(.,  , x, fixed = TRUE)
 chartr(.,  , x)


 On Tue, Feb 10, 2009 at 4:02 AM, Sergey Goriatchev serg...@gmail.com wrote:
 OK, got it now:
 sub([.],  , ED4.Comdty)


 On Tue, Feb 10, 2009 at 10:01, Sergey Goriatchev serg...@gmail.com wrote:
 Hello, everyone

 How do I replace dot with empty space in ED4.Comdty?
 I need to get ED4 Comdty
 tried sub() in many different ways, like sub({.},  , ED4.Comdty)
 etc but could not do it.

 Thanks in advance,
 Sergey




 --
 I'm not young enough to know everything. /Oscar Wilde
 Experience is one thing you can't get for nothing. /Oscar Wilde
 When you are finished changing, you're finished. /Benjamin Franklin
 Tell me and I forget, teach me and I remember, involve me and I learn.
 /Benjamin Franklin
 Luck is where preparation meets opportunity. /George Patten

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





-- 
I'm not young enough to know everything. /Oscar Wilde
Experience is one thing you can't get for nothing. /Oscar Wilde
When you are finished changing, you're finished. /Benjamin Franklin
Tell me and I forget, teach me and I remember, involve me and I learn.
/Benjamin Franklin
Luck is where preparation meets opportunity. /George Patten

__
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] Odp: Problem with retrieving updated variables after attach()

2009-02-10 Thread Wacek Kusnierczyk
David Croll wrote:
 Well, I knew that attach() only creates a copy of the variables in the
 search path.

 What I wanted to ask was how to *retrieve* that copy...

  mat
 id age
 1 NA  NA
 2 NA  NA
 3 NA  NA
 4 NA  NA
 5 NA  NA 
  attach(mat)

  id - sample(100,5)
  age - rnorm(5,mean=30)

 How can I make a new data frame out of the id and age that were
 changed above?


data.frame(id, age) # from the copy
data.frame(mat$id, mat$age) # from the originals

why do you need to overwrite the copy?

vQ

__
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] general inverse solver?

2009-02-10 Thread Gabor Grothendieck
Yacas was completely rewritten in java (Ryacas interfaces to the
C version) since the Ryacas project started so I would not exactly
characterize yacas as dead.   The work that is going on in yacas
may not have high visibility but that does not mean there is none.

Also while Maxima is more sophisticated in terms of algorithms,
yacas is actually more sophisticated from the viewpoint of its
language  which borrows ideas from both imperative and prolog programming
and its interfaces are more sophisticated (it is one of the few CAS systems
that developed an OpenMath interface) and its socket server is
used by the Ryacas interface.  yacas can also translate math expressions
to TeX and do exact arithmetic.

Also to put this in the correct context, yacas does seem capable of
answering the majority of questions that are posed on r-help that need
a CAS in the answer. From a practical viewpoint it does seem to have
the facilities that are most often needed.   The Ryacas vignette has
a survey of some of its algebra capabilities.

That being said, without taking away from yacas there is work going on to
interface R to a second CAS.

On Tue, Feb 10, 2009 at 2:33 AM, Hans W. Borchers
hwborch...@googlemail.com wrote:

 I know that Ryacas is promoted here whenever requests about symbolic algebra
 or calculus appear on the R-help list. But to say the truth, Yacas itself is
 a very very limited Computer Algebra System and looking onto its home page
 it appears the development will stop or has stopped anyway.

 It would be fair to clearly state that there is no R package to solve
 somewhat more involved symbolic mathematical problems. One could then point
 the requestor to one of the open source Computer Algebra Systems  (CAS) such
 as Maxima or Axiom.

 Interestingly, the free Math Toolbox Euler by Grossmann has integrated
 Maxima into its numerical environment in a way that is really useful for
 numerical and symbolic computations. I could imagine that in a similar way
 Maxima can be integrated into R bringing the full power of computer algebra
 to the R community.

 Hans W. Borchers
 ABB Corporate Research

 
 Postscript

 The Euler Mathematical Toolbox is a powerful, versatile, and open source
 software for numerical and symbolic computations ... Euler supports symbolic
 mathematics using the open algebra system Maxima.

 http://mathsrv.ku-eichstaett.de/MGF/homes/grothmann/euler/



 Gabor Grothendieck wrote:

 The forms of equations are limited but its not limited to just one:

 library(Ryacas)
 Loading required package: XML
 x - Sym(x)
 y - Sym(y)
 Solve(List(x+y == 2, x-y == 0), List(x, y))
 [1] Starting Yacas!
 expression(list(list(x == 2 - y, y == 1)))


 On Mon, Feb 9, 2009 at 7:45 PM, Carl Witthoft c...@witthoft.com wrote:
 Gabor G a ecrit:
 Check out the Ryacas package.   There is a vignette with some
 examples.

 
 Which led me to the manuals for yacas itself.  I'm guessing there may be
 a
 way to use yacas'  AND construct to combine a few equations and then
 hope
 the Newton Solver can work with that, but it's not clear that will work.

 TK!Solver is nice because you aren't limited to linear equations, nor to
 equations which fit into a matrix structure, and because it's legal to
 have more than one unknown to be back-solved (assuming the problem is not
 under- or over-defined, of course).

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



 --
 View this message in context: 
 http://www.nabble.com/general-inverse-solver--tp21902788p21928972.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-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] Odp: Problem with retrieving updated variables after attach()

2009-02-10 Thread Berwin A Turlach
G'day David,

On Tue, 10 Feb 2009 13:23:50 +0100
David Croll david.cr...@gmx.ch wrote:

 Well, I knew that attach() only creates a copy of the variables in
 the search path.
 
 What I wanted to ask was how to *retrieve* that copy...
 
   mat
  id age
 1 NA  NA
 2 NA  NA
 3 NA  NA
 4 NA  NA
 5 NA  NA  
 
   attach(mat)
 
   id - sample(100,5)
   age - rnorm(5,mean=30)
 
 How can I make a new data frame out of the id and age that were
 changed above?

R new.df - data.frame(id,age)

Or, perhaps more automatic:

R new.df - do.call(data.frame, sapply(ls(pos=2), as.name))

Is this what you are after?

Cheers,

Berwin

=== Full address =
Berwin A TurlachTel.: +65 6516 4416 (secr)
Dept of Statistics and Applied Probability+65 6516 6650 (self)
Faculty of Science  FAX : +65 6872 3919   
National University of Singapore 
6 Science Drive 2, Blk S16, Level 7  e-mail: sta...@nus.edu.sg
Singapore 117546http://www.stat.nus.edu.sg/~statba

__
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] A recommender system package?

2009-02-10 Thread Guozhu.Wen
Hi all,

Recommendation technique is popular in recent web application. I was
wondering is there any R package used for recommender system?

Thanks in advance.

[[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] Odp: Problem with retrieving updated variables after attach()

2009-02-10 Thread Peter Dalgaard
Berwin A Turlach wrote:
 G'day David,
 
 On Tue, 10 Feb 2009 13:23:50 +0100
 David Croll david.cr...@gmx.ch wrote:
 
 Well, I knew that attach() only creates a copy of the variables in
 the search path.

 What I wanted to ask was how to *retrieve* that copy...

   mat
  id age
 1 NA  NA
 2 NA  NA
 3 NA  NA
 4 NA  NA
 5 NA  NA  

   attach(mat)

   id - sample(100,5)
   age - rnorm(5,mean=30)

 How can I make a new data frame out of the id and age that were
 changed above?
 
 R new.df - data.frame(id,age)
 
 Or, perhaps more automatic:
 
 R new.df - do.call(data.frame, sapply(ls(pos=2), as.name))
 
 Is this what you are after?

There is also

as.data.frame(as.list(pos.to.env(2)))

or ...as.environment(mat)

I wouldn't recommend using - like that though; the consequences of
spelling mistakes on the LHS are a bit scary. If you must, consider

with(pos.to.env(2),{
  id - sample(100,5)
  age - rnorm(5,mean=30)
})

or better, modify before attach, using within() or transform().

-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45) 35327907

__
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] Odp: Problem with retrieving updated variables after attach()

2009-02-10 Thread Wacek Kusnierczyk
Berwin A Turlach wrote:
 G'day David,

 On Tue, 10 Feb 2009 13:23:50 +0100
 David Croll david.cr...@gmx.ch wrote:

   
 Well, I knew that attach() only creates a copy of the variables in
 the search path.

 What I wanted to ask was how to *retrieve* that copy...

   mat
  id age
 1 NA  NA
 2 NA  NA
 3 NA  NA
 4 NA  NA
 5 NA  NA  

   attach(mat)

   id - sample(100,5)
   age - rnorm(5,mean=30)

 How can I make a new data frame out of the id and age that were
 changed above?
 

 R new.df - data.frame(id,age)

 Or, perhaps more automatic:

 R new.df - do.call(data.frame, sapply(ls(pos=2), as.name))

   

or perhaps:

new.df - as.data.frame(mget(names(mat), as.environment(2)))

vQ

__
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] Odp: Problem with retrieving updated variables after attach()

2009-02-10 Thread Petr PIKAL
Hi

r-help-boun...@r-project.org napsal dne 10.02.2009 13:57:44:

 G'day David,
 
 On Tue, 10 Feb 2009 13:23:50 +0100
 David Croll david.cr...@gmx.ch wrote:
 
  Well, I knew that attach() only creates a copy of the variables in
  the search path.
  
  What I wanted to ask was how to *retrieve* that copy...
  
mat
   id age
  1 NA  NA
  2 NA  NA
  3 NA  NA
  4 NA  NA
  5 NA  NA 
  
attach(mat)
  
id - sample(100,5)
age - rnorm(5,mean=30)
  
  How can I make a new data frame out of the id and age that were
  changed above?
 
 R new.df - data.frame(id,age)
 
 Or, perhaps more automatic:
 
 R new.df - do.call(data.frame, sapply(ls(pos=2), as.name))
 
 Is this what you are after?

The question is why he wants to do this? I do not see the point of 
attaching data frame, changing something in attached frame and then 
keeping a new copy.

Why not

mat
new.mat - mat
new.mat[,n1] - some change
new.mat[,n2] - some other change

without tricky use of attach if he wants to keep the changed copy.

Regards
Petr

 
 Cheers,
 
Berwin
 
 === Full address =
 Berwin A TurlachTel.: +65 6516 4416 (secr)
 Dept of Statistics and Applied Probability+65 6516 6650 (self)
 Faculty of Science  FAX : +65 6872 3919 
 National University of Singapore 
 6 Science Drive 2, Blk S16, Level 7  e-mail: sta...@nus.edu.sg
 Singapore 117546http://www.stat.nus.edu.sg/~statba
 
 __
 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] error using R Commander for text file import

2009-02-10 Thread John Fox
Dear Uwe,

Thanks for trying to field this question, but the error is unlikely to be
related to the data since splitCmd() is used internally to format commands
generated by the Rcmdr so that they fit in the Script window. Unfortunately,
the contents of the Script window are likely to be uninformative since the
offending line won't have been displayed.

Dwight: 

I've never seen this error, nor has anyone else reported it, and as you
might imagine, importing a text file is a very common operation. Although I
can't rule it out at this point, I suspect that if this were a bug in the
Rcmdr, it would have surfaced before.

Some more information about what you did might help. Commands generated by
the Rcmdr shouldn't have unbalanced quotes unless the user enters them,
e.g., in a text field. For example, might you have tried to place quotes
around the name of the data set.

Regards,
 John

--
John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
web: socserv.mcmaster.ca/jfox

 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On
 Behalf Of Uwe Ligges
 Sent: February-10-09 6:52 AM
 To: Krehbiel, Dwight
 Cc: r-help@r-project.org
 Subject: Re: [R] error using R Commander for text file import
 
 
 
 Krehbiel, Dwight wrote:
  I am getting the following error on  iMac running Mac OS 10.5.6; this
 occurs whenever I try to import a text file into R Commander:
 
  Error in splitCmd(command) : unbalanced quotes
 
 So can you tell us exactly what you did and what the resulting code in
 the code windows was and how the data file looks like? Does it contain
 unbalanced quotes, for example?
 
 Uwe Ligges
 
  Thus, I am unable to import data into R Commander. Any suggestions as to
 how I might fix this error? I have gotten it many times with more than one
 installation of R 2.8.1 on this computer.
 
  Dwight Krehbiel
  Bethel College
  North Newton, KS 67117
  USA
 
  __
  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.


Re: [R] Fast fourier transformation

2009-02-10 Thread Dieter Menne
botto b.otto at uke.uni-hamburg.de writes:

 
 here is a practical problem we would like to solve. In a pneumatic post the
 acceleration of the capsule is measured and plotted over time. From the
 graph achieved we would like to derive some kind of statistic value that
 describes the stress the capsule, or what is in it, is exhibited to.
 
..
 
 1)  Apply a  fourier transformation to the acceleration profile to 
 
 2)   get a number of harmonic waves describing my graph 
 
 3)  and use the amplitudes of my waves in a weighted fashion to
 calculate some statistical value.
 
 What I tried to do is:
 
 A) construct an artificial profile fg for testing purpose like 
 
 a.   f1 - function(x) 0.5*sin(3*x + pi)

 
 X)  in my test example I can define the amount of harmonic components,
 because here I know that number. Of course afterwards in my natural profiles
 I won't know.
 
 Y)  I have to transform the values I get out of the fft and fourier
 functions to estimate the frequency,  amplitude and phase of my harmonics.
 

Check function spectrum in stats which also has some methods to 
provide smoothed plots. There is also package signal which I have not
tried. And don't expect too much of phase plots, I have seen generations
of students jumping on these to explain the universum, the EEG  and US
politics because it sound so mysterious, and never seen a working method 
coming out of it.

It would have been good if you had provided a real example series because
then it would have been possible to tell you if you could find a reasonable
estimate of the true frequency and acceleration. In general, when you 
have only very few oscillations, you get a seemingly lousy estimate, which
is only the consequence of how fft is defined as a rather broad-minded
model. If you are sure that there is a single frequency with harmonics, 
other methods such as cyclic gams or even cyclic nlme (see the oestrus 
example in that package) might provide better results.

Dieter

__
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] Fast fourier transformation

2009-02-10 Thread baptiste auguie
A powerful scheme for harmonic inversion of time signals known as  
filter diagonalization method is available from MIT: http://ab-initio.mit.edu/wiki/index.php/Harminv


I don't know of any R interface, but it might be a good option for  
your problem.



Cheers,

baptiste

On 10 Feb 2009, at 13:40, Dieter Menne wrote:


botto b.otto at uke.uni-hamburg.de writes:



here is a practical problem we would like to solve. In a pneumatic  
post the
acceleration of the capsule is measured and plotted over time. From  
the
graph achieved we would like to derive some kind of statistic value  
that

describes the stress the capsule, or what is in it, is exhibited to.


..


1)  Apply a  fourier transformation to the acceleration profile  
to


2)   get a number of harmonic waves describing my graph

3)  and use the amplitudes of my waves in a weighted fashion to
calculate some statistical value.

What I tried to do is:

A) construct an artificial profile fg for testing purpose like

a.   f1 - function(x) 0.5*sin(3*x + pi)




X)  in my test example I can define the amount of harmonic  
components,
because here I know that number. Of course afterwards in my natural  
profiles

I won't know.

Y)  I have to transform the values I get out of the fft and  
fourier
functions to estimate the frequency,  amplitude and phase of my  
harmonics.




Check function spectrum in stats which also has some methods to
provide smoothed plots. There is also package signal which I have not
tried. And don't expect too much of phase plots, I have seen  
generations

of students jumping on these to explain the universum, the EEG  and US
politics because it sound so mysterious, and never seen a working  
method

coming out of it.

It would have been good if you had provided a real example series  
because
then it would have been possible to tell you if you could find a  
reasonable
estimate of the true frequency and acceleration. In general, when  
you
have only very few oscillations, you get a seemingly lousy estimate,  
which

is only the consequence of how fft is defined as a rather broad-minded
model. If you are sure that there is a single frequency with  
harmonics,

other methods such as cyclic gams or even cyclic nlme (see the oestrus
example in that package) might provide better results.

Dieter

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


_

Baptiste Auguié

School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

Phone: +44 1392 264187

http://newton.ex.ac.uk/research/emag

__
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 use axes=FALSE to get multple plots?

2009-02-10 Thread Dan Kelley

I am trying to plot two things on one graph, with a y-axis at the left for
one variable, and a y-axis at the right, for the other variable.  I thought
I could do as follows


par(mar=rep(4.5, 4))
plot(0:10, 10:20)
par(new=TRUE)
plot(0:10, 100:110, axes=FALSE)
axis(4)


but this writes both y-axis labels on the left-hand side, and nothing on the
right-hand side.  This is R 2.8.1 (2008-12-22) on OS-X.

Am I missing something?  

PS. I know that I can just make ylab= and draw the right-hand axis name
with mtext, but that then I would need to check par(mgp), to find where
place it, etc.  I'm thinking that I am just missing something in my
understanding.


-- 
View this message in context: 
http://www.nabble.com/how-to-use-axes%3DFALSE-to-get-multple-plots--tp21934005p21934005.html
Sent from the R help mailing list archive at Nabble.com.

[[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] What is the R equivalent of STATA's 'drop' command?

2009-02-10 Thread John C Frain
Try something like

 rm(list=ls(pattern=y+))

John

2009/2/10 stephen sefick ssef...@gmail.com:
 It depends on how the data is set up (I am not an expert), but I have
 had good results with the subset function.  subset(x, var!=3  var!=4)
  this will take the subset of the dataframe x where var is not equal
 to 3 or 4.

 a - rnorm(25)
 var - rep(c(1:5), 5)
 x - data.frame(a, var)
 subset(x, var!=3  var!=4)

 Is this what you want?

 Stephen Sefick

 On Mon, Feb 9, 2009 at 7:27 PM, jjh21 jjhar...@gmail.com wrote:

 Hello,

 I am trying to do some data cleaning in R. I need to drop observations that
 take on certain values of a variable. In STATA I might type something like:

 drop if variable name == 3
 drop if variable name == 4

 Is there an R equivalent of this? I have tried playing around with the
 subset command, but it seems a bit clunky. What would an advanced R user's
 approach be for something like this?

 Thank you!


 --
 View this message in context: 
 http://www.nabble.com/What-is-the-R-equivalent-of-STATA%27s-%27drop%27-command--tp21925249p21925249.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.




 --
 Stephen Sefick

 Let's not spend our time and resources thinking about things that are
 so little or so large that all they really do for us is puff us up and
 make us feel like gods.  We are mammals, and have not exhausted the
 annoying little problems of being mammals.

-K. Mullis

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




-- 
John C Frain
Trinity College Dublin
Dublin 2
Ireland
www.tcd.ie/Economics/staff/frainj/home.html
mailto:fra...@tcd.ie
mailto:fra...@gmail.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.


Re: [R] general inverse solver?

2009-02-10 Thread Erich Neuwirth
My main problem is that yacas can only factorize polynomials in one  
variable.

Any CAS which is not able to factor a^2 - b^2 into (a+b)*(a-B)
for me is less than satisfactory.



On Feb 10, 2009, at 1:51 PM, Gabor Grothendieck wrote:


Yacas was completely rewritten in java (Ryacas interfaces to the
C version) since the Ryacas project started so I would not exactly
characterize yacas as dead.   The work that is going on in yacas
may not have high visibility but that does not mean there is none.

Also while Maxima is more sophisticated in terms of algorithms,
yacas is actually more sophisticated from the viewpoint of its
language  which borrows ideas from both imperative and prolog  
programming
and its interfaces are more sophisticated (it is one of the few CAS  
systems

that developed an OpenMath interface) and its socket server is
used by the Ryacas interface.  yacas can also translate math  
expressions

to TeX and do exact arithmetic.

Also to put this in the correct context, yacas does seem capable of
answering the majority of questions that are posed on r-help that need
a CAS in the answer. From a practical viewpoint it does seem to have
the facilities that are most often needed.   The Ryacas vignette has
a survey of some of its algebra capabilities.

That being said, without taking away from yacas there is work going  
on to

interface R to a second CAS.

On Tue, Feb 10, 2009 at 2:33 AM, Hans W. Borchers
hwborch...@googlemail.com wrote:


I know that Ryacas is promoted here whenever requests about  
symbolic algebra
or calculus appear on the R-help list. But to say the truth, Yacas  
itself is
a very very limited Computer Algebra System and looking onto its  
home page

it appears the development will stop or has stopped anyway.

It would be fair to clearly state that there is no R package to solve
somewhat more involved symbolic mathematical problems. One could  
then point
the requestor to one of the open source Computer Algebra Systems   
(CAS) such

as Maxima or Axiom.

Interestingly, the free Math Toolbox Euler by Grossmann has  
integrated
Maxima into its numerical environment in a way that is really  
useful for
numerical and symbolic computations. I could imagine that in a  
similar way
Maxima can be integrated into R bringing the full power of computer  
algebra

to the R community.

Hans W. Borchers
ABB Corporate Research


Postscript

The Euler Mathematical Toolbox is a powerful, versatile, and open  
source
software for numerical and symbolic computations ... Euler supports  
symbolic

mathematics using the open algebra system Maxima.

http://mathsrv.ku-eichstaett.de/MGF/homes/grothmann/euler/



Gabor Grothendieck wrote:


The forms of equations are limited but its not limited to just one:


library(Ryacas)

Loading required package: XML

x - Sym(x)
y - Sym(y)
Solve(List(x+y == 2, x-y == 0), List(x, y))

[1] Starting Yacas!
expression(list(list(x == 2 - y, y == 1)))


On Mon, Feb 9, 2009 at 7:45 PM, Carl Witthoft c...@witthoft.com  
wrote:

Gabor G a ecrit:
Check out the Ryacas package.   There is a vignette with some
examples.


Which led me to the manuals for yacas itself.  I'm guessing there  
may be

a
way to use yacas'  AND construct to combine a few equations and  
then

hope
the Newton Solver can work with that, but it's not clear that  
will work.


TK!Solver is nice because you aren't limited to linear equations,  
nor to
equations which fit into a matrix structure, and because it's  
legal to
have more than one unknown to be back-solved (assuming the  
problem is not

under- or over-defined, of course).

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





--
View this message in context: 
http://www.nabble.com/general-inverse-solver--tp21902788p21928972.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-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.



--
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide 

[R] Help regarding White's Heteroscedasticity Correction

2009-02-10 Thread Kishore
Hi
I am actually running the White test for correcting Heteroscedasticity.  I
used sandwich()  car(), however the output shows the updated t test of
coefficients, with revised Standard Errors, however the estimates remained
same.  My problem is that the residuals formed a pattern in the original
regression equation.  After running the White's test, I got some new
standard errors - but from here I didn't understand how to plot the
residuals (or) how to correct the estimates??  Can some one direct me in
this regard..

Best,

Kishore/..
http://kaykayatisb.blogspot.com

[[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] how to use axes=FALSE to get multple plots?

2009-02-10 Thread Duncan Murdoch

Dan Kelley wrote:

I am trying to plot two things on one graph, with a y-axis at the left for
one variable, and a y-axis at the right, for the other variable.  I thought
I could do as follows


par(mar=rep(4.5, 4))
plot(0:10, 10:20)
par(new=TRUE)
plot(0:10, 100:110, axes=FALSE)
axis(4)


but this writes both y-axis labels on the left-hand side, and nothing on the
right-hand side.  This is R 2.8.1 (2008-12-22) on OS-X.

Am I missing something?  


PS. I know that I can just make ylab= and draw the right-hand axis name
with mtext, but that then I would need to check par(mgp), to find where
place it, etc.  I'm thinking that I am just missing something in my
understanding.


  
axis() doesn't draw axis labels.  There isn't a simple function for 
drawing text on side 4 as far as I know, but mtext is not so bad:  use


mtext(Right label, side=4, line=3)

to emulate the default ylab, but put it on the right.  See ?title for 
more details if you've changed the default locations.


I don't like to use plot(new=TRUE), because there are lots of things 
that can go wrong when you overplot high level graphics (I'd use 
points() instead), but your example is one of the few cases where you 
can make just as many errors using points() as using par(new=TRUE).  Are 
you really sure you want a graph with two different scales on it?


Duncan Murdoch

__
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 shingle with time and date format

2009-02-10 Thread Jon Loehrke
Hi R-Users,

I have a time series of bivariate observations (x,y,t).  I've  
developed a few panel routines to explore certain aspects of the data,  
and now would like to break the time series up into smaller chunks to  
explore the temporal trends.  I would like to know if anyone has any  
experience breaking up time series with lattice.

Base graphics offers coplot, utilizing the co.intervals routine to  
break up the series into equal chunks.  Lattice has equal.count as a  
wrapper for co.intervals.  As you can see in the example below, I can  
recreate a 'coplot' with lattice but am having difficulty getting the  
x-axis of the shingle plot and the strip labeling on the xyplot to be  
in time or date format.  My question really consists of two parts,  
with the second part being less important for my data visualization  
purposes:

1) How might I be able to convert the x-axis of the shingle plot from  
numeric to date format?
2) How might I be able to customize the strip labels on the xyplot to  
show a range, like min(month, year)-max(month, year) for each panel?

Thank you very much for any helpful suggestions.

Jon
#
# Example R script

library(lattice)

times-as.Date(seq(11400,14190, length.out=100),origin=1970-01-01)
x-rnorm(100)
y-rnorm(100)
df-data.frame(x=x,y=y,times=times)

#I want to recreate something like coplot with lattice
coplot(y~x|times,data=df)


#this doesn't work, which is an issue with co.intervals
breaks-equal.count(times)

#this does work
breaks-equal.count(unclass(times))


#In the lattice book there is this outline
bPlot-plot(breaks)
dPlot-xyplot(y~x|breaks, data=df)
plot(bPlot, position=c(0,0.65,1,1))
plot(dPlot, position=c(0,0,1,0.65),newpage=FALSE)
#The plot is ok, but the xaxis is in numeric and not date
#


Jon Loehrke
Graduate Research Assistant
Department of Fisheries Oceanography
School for Marine Science and Technology
University of Massachusetts
200 Mill Road, Suite 325
Fairhaven, MA 02719
jloeh...@umassd.edu

  sessionInfo()
R version 2.8.1 (2008-12-22)
i386-apple-darwin8.11.1

locale:
en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
[1] lattice_0.17-17
[[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] Odp: Problem with retrieving updated variables after attach()

2009-02-10 Thread David Croll

Thank you, this does the job perfectly!


Regards, David


R new.df - data.frame(id,age)

Or, perhaps more automatic:

R new.df - do.call(data.frame, sapply(ls(pos=2), as.name))

Is this what you are after?

Cheers,

Berwin


__
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] Help regarding White's Heteroscedasticity Correction

2009-02-10 Thread John C Frain
Generally in the presence of heteroskedasticity of unknown form OLS
produces consistent estimates of your regression coefficients. The
estimates of  standard errors are biased in the presence of
heteroskedasticity,  White's  procedure is a way of producing
consistent estimates of the standard errors.  It does not change the
estimates of the coefficients.  It does not change the residuals.

Patterns in your residuals may show up as heteroskedasticity when
tested but they may be an indication of wrong functional form or of
missing variables or of some other form of misspecification.

Best Regards

John

2009/2/10 Kishore gladikish...@gmail.com:
 Hi
 I am actually running the White test for correcting Heteroscedasticity.  I
 used sandwich()  car(), however the output shows the updated t test of
 coefficients, with revised Standard Errors, however the estimates remained
 same.  My problem is that the residuals formed a pattern in the original
 regression equation.  After running the White's test, I got some new
 standard errors - but from here I didn't understand how to plot the
 residuals (or) how to correct the estimates??  Can some one direct me in
 this regard..

 Best,

 Kishore/..
 http://kaykayatisb.blogspot.com

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




-- 
John C Frain
Trinity College Dublin
Dublin 2
Ireland
www.tcd.ie/Economics/staff/frainj/home.html
mailto:fra...@tcd.ie
mailto:fra...@gmail.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] ISOdatetime gives NA for a specific date

2009-02-10 Thread pbarros

Hi all,

I am using ISOdatetime, and I just found out that when I do
ISOdatetime(1995,03,26,2,10,0) (or any other value under minutes or seconds)
I get NA

This does not happen with the same time in other dates, nor with different
hours in the same date.
Any hint why this happens?

Using R 2.8.1 under ESS/GnuEmacs under Windows XP

Pedro
-- 
View this message in context: 
http://www.nabble.com/ISOdatetime-gives-NA-for-a-specific-date-tp21934989p21934989.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.


Re: [R] Help regarding White's Heteroscedasticity Correction

2009-02-10 Thread John Fox
Dear Kishore,

Yes, White's heteroscedasticity-consistent standard errors are just that --
standard errors for the OLS coefficients that are consistent in the presence
of heteroscedasticity. The coefficients themselves don't change. There is an
issue here: although the standard errors and OLS coefficients are
consistent, the OLS estimates lose efficiency. If you know that pattern of
heteroscedasticity, then you might get more efficient estimates by taking it
into account, e.g., in weighted-least-squares regression, or, if the
residual spread increases with the fitted values, by transforming the
response.

I hope this helps,
 John

--
John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
web: socserv.mcmaster.ca/jfox


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On
 Behalf Of Kishore
 Sent: February-10-09 9:19 AM
 To: r-help@r-project.org; r-h...@stat.math.ethz.ch
 Subject: [R] Help regarding White's Heteroscedasticity Correction
 
 Hi
 I am actually running the White test for correcting Heteroscedasticity.  I
 used sandwich()  car(), however the output shows the updated t test of
 coefficients, with revised Standard Errors, however the estimates remained
 same.  My problem is that the residuals formed a pattern in the original
 regression equation.  After running the White's test, I got some new
 standard errors - but from here I didn't understand how to plot the
 residuals (or) how to correct the estimates??  Can some one direct me in
 this regard..
 
 Best,
 
 Kishore/..
 http://kaykayatisb.blogspot.com
 
   [[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.


[R] Problem with PVCM: 0 (non-NA) cases

2009-02-10 Thread Johannes Habel

Hello everybody,

I have a problem with the the function PVCM in the plm package:

I have an unbalanced panel with over 200 companies and 1 to 14 years for
each company. I already excluded all NAs:

 dataset-na.omit(dataset)

Now I'm trying to fit a variable coefficients model:

 model_vc - pvcm(v1 ~ lag(v2,1), model=within, data=dataset)

This results in the following error message: Fehler in lm.fit(x, y, offset
= offset, singular.ok = singular.ok, ...) : 0 (non-NA) cases

I can't figure out what's wrong... Can somebody help me, please?

Thanks so much!

Johannes

PS: Here's additional information on my dataset:

 str(dataset)
Classes ‘plm.dim’ and 'data.frame': 1531 obs. of  4 variables:
 $ company: Factor w/ 210 levels 1164,1177,..: 1 1 1 1 1 1 1 1 1 1 ...
 $ year   : Factor w/ 16 levels 1993,1994,..: 2 3 4 5 6 7 8 9 10 11 ...
 $ v1 : num  0.0993 0.1488 0.0604 0.0902 0.0573 ...
 $ v2 : int  75 75 78 72 74 73 70 70 70 67 ...
 - attr(*, na.action)=Class 'omit'  Named int [1:979] 12 13 14 15 16 17 18
26 39 40 ...
  .. ..- attr(*, names)= chr [1:979] 12 13 14 15 ... 

 summary(dataset)
company  year   v1 v2   
 3121   :  15   2007   :136   Min.   :-1.05746   Min.   :49.00  
 8762   :  15   2006   :128   1st Qu.: 0.08706   1st Qu.:71.00  
 1382   :  14   2005   :125   Median : 0.12834   Median :76.00  
 1388   :  14   2003   :119   Mean   : 0.13399   Mean   :75.37  
 1440   :  14   2004   :119   3rd Qu.: 0.18909   3rd Qu.:80.00  
 1663   :  14   2002   :115   Max.   : 0.71280   Max.   :90.00  
 (Other):1445   (Other):789  
-- 
View this message in context: 
http://www.nabble.com/Problem-with-PVCM%3A-%220-%28non-NA%29-cases%22-tp21933499p21933499.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.


Re: [R] ISOdatetime gives NA for a specific date

2009-02-10 Thread Peter Dalgaard
pbarros wrote:
 Hi all,
 
 I am using ISOdatetime, and I just found out that when I do
 ISOdatetime(1995,03,26,2,10,0) (or any other value under minutes or seconds)
 I get NA
 
 This does not happen with the same time in other dates, nor with different
 hours in the same date.
 Any hint why this happens?
 
 Using R 2.8.1 under ESS/GnuEmacs under Windows XP
 
 Pedro

Daylight savings time, I guess. The clock went directly from 1:59 to
3:00 that day. Other systems behave strangely (er, handle the anomaly)
in different ways:


 ISOdatetime(1995,03,26,1,10,0)
[1] 1995-03-26 01:10:00 CET
 ISOdatetime(1995,03,26,2,10,0)
[1] 1995-03-26 01:10:00 CET
 ISOdatetime(1995,03,26,3,10,0)
[1] 1995-03-26 03:10:00 CEST

(SUSE 10.2)



-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45) 35327907

__
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] ISOdatetime gives NA for a specific date

2009-02-10 Thread Prof Brian Ripley

On Tue, 10 Feb 2009, pbarros wrote:



Hi all,

I am using ISOdatetime, and I just found out that when I do
ISOdatetime(1995,03,26,2,10,0) (or any other value under minutes or seconds)
I get NA

This does not happen with the same time in other dates, nor with different
hours in the same date.
Any hint why this happens?


A non-existent time, most likely:

 x - ISOdatetime(1995,03,26,1,10,0)

x

[1] 1995-03-26 01:10:00 CET

seq(x, length=10, by=hour)

 [1] 1995-03-26 01:10:00 CET  1995-03-26 03:10:00 CEST
 [3] 1995-03-26 04:10:00 CEST 1995-03-26 05:10:00 CEST
 [5] 1995-03-26 06:10:00 CEST 1995-03-26 07:10:00 CEST
 [7] 1995-03-26 08:10:00 CEST 1995-03-26 09:10:00 CEST
 [9] 1995-03-26 10:10:00 CEST 1995-03-26 11:10:00 CEST

in TZ=Europe/Lisbon, which is my guess as to near where you are

There was no 2:10 on 1995-03-26 in Lisbon: the clocks went forward an 
hour at 2 am.



Using R 2.8.1 under ESS/GnuEmacs under Windows XP

Pedro



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
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] pause in function execution

2009-02-10 Thread Fuchs Ira
I tried using the command-line and indeed it does not buffer so that,  
for example:


for (i in 1:5) {
print(x)
Sys.sleep(3)  }

does as expected.

However, the following sleeps for 15 seconds and then produces no  
output:


library(quantmod)

for (i in 1:5) {
getQuote(AAPL)
Sys.sleep(3)  }

Why is that?

Thanks.




On Feb 9, 2009, at 8:04 PM, Rolf Turner wrote:



On 10/02/2009, at 1:46 PM, Fuchs Ira wrote:


The binary in R.app starts the GUI. I suppose I would have to install
the command-line version separately.


On my machine there is a ``file'' /usr/bin/R which is actually a  
symbolic

link to /Library/Frameworks/R.framework/Resources/bin/R.

The latter is an executable shell script.

At the command line in a window you should be able to just type

R

or (if /usr/bin is not in your path)

/usr/bin/R

or (if the symbolic link is not present in /usr/bin)

/Library/Frameworks/R.framework/Resources/bin/R

and get R going.  In such a way as not to invoke the AQUA GUI.

If this doesn't work, I'm afraid I'm out of ideas.

If the last option works, then you should create the symbolic link  
in /usr/bin
(and make sure that /usr/bin is in your path).  Then you'll be able  
to start

simply by typing ``R''.

cheers,

Rolf Turner


##
Attention:This e-mail message is privileged and confidential. If you  
are not theintended recipient please delete the message and notify  
the sender.Any views or opinions presented are solely those of the  
author.


This e-mail has been scanned and cleared by  
MailMarshalwww.marshalsoftware.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.


Re: [R] how to use axes=FALSE to get multple plots?

2009-02-10 Thread Dan Kelley


Duncan Murdoch-2 wrote:
 
 ...Are you really sure you want a graph with two different scales on it?
 

Thanks, Duncan.  I'll use mtext. It is common for people in my research area
to put several axes on plots.  The top two panels from


library(oce)
data(ctd)
plot(ctd)


shows this.  Actually,  oceanographers do something even stranger (not in my
posted example) -- we put the dependent variables on the x axis, and
colour-code the axes to the lines.  

Thanks again.  Dan.



-- 
View this message in context: 
http://www.nabble.com/how-to-use-axes%3DFALSE-to-get-multple-plots--tp21934005p21936243.html
Sent from the R help mailing list archive at Nabble.com.

[[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] pause in function execution

2009-02-10 Thread Fuchs Ira

Oops...forgot to print(getQuote(AAPL).  Sorry.

On Feb 10, 2009, at 10:21 AM, Fuchs Ira wrote:

I tried using the command-line and indeed it does not buffer so  
that, for example:


for (i in 1:5) {
print(x)
Sys.sleep(3)  }

does as expected.

However, the following sleeps for 15 seconds and then produces no  
output:


library(quantmod)

for (i in 1:5) {
getQuote(AAPL)
Sys.sleep(3)  }

Why is that?

Thanks.




On Feb 9, 2009, at 8:04 PM, Rolf Turner wrote:



On 10/02/2009, at 1:46 PM, Fuchs Ira wrote:

The binary in R.app starts the GUI. I suppose I would have to  
install

the command-line version separately.


On my machine there is a ``file'' /usr/bin/R which is actually a  
symbolic

link to /Library/Frameworks/R.framework/Resources/bin/R.

The latter is an executable shell script.

At the command line in a window you should be able to just type

R

or (if /usr/bin is not in your path)

/usr/bin/R

or (if the symbolic link is not present in /usr/bin)

/Library/Frameworks/R.framework/Resources/bin/R

and get R going.  In such a way as not to invoke the AQUA GUI.

If this doesn't work, I'm afraid I'm out of ideas.

If the last option works, then you should create the symbolic link  
in /usr/bin
(and make sure that /usr/bin is in your path).  Then you'll be able  
to start

simply by typing ``R''.

cheers,

Rolf Turner


##
Attention:This e-mail message is privileged and confidential. If  
you are not theintended recipient please delete the message and  
notify the sender.Any views or opinions presented are solely those  
of the author.


This e-mail has been scanned and cleared by  
MailMarshalwww.marshalsoftware.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] plotting the result of a nonlinear regression

2009-02-10 Thread lauramorg...@bluewin.ch
Hello,
to plot the result of a singular non linear regression (using nls) I usually 
use the function plotfit, for example:

r.PTG.V-nls(PTG.P~ fz1(Portata, a,b), data=dati, start=list(a=10, b=10), 
nls.control(maxiter=200), algorithm='port', 
trace=TRUE, na.action=na.omit, lower=list(a=0, b=10), upper=list(a=100, b=100))
plotfit(r.PTG.V)

I tried to use the function plotfit on the result of the following for loop but 
I got an error message:
for (i in 1:length(formList))
{
resultList[[i]] - nls(formList[[i]], data=subset(dati, Fiume==Laveggio), 
start=startList7[[i]], 
nls.control(maxiter=1000, warnOnly=TRUE), algorithm='port', 
na.action=na.omit,lower=lowerList7[[i]], 
upper=upperList7[[i]])
}
plotfit(resultList[[1]]

Error in diff(as.numeric(y[ord])) : 
  (list) object cannot be coerced to type 'double'

Could somebody tell me what this error means? how can I fix this problem? 
Any suggestion appreciated!!
Thanks,
Laura

__
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 add points/lines to a surface plot

2009-02-10 Thread Domenico Vistocco

Dear All,
is there a way to superimpose points and/or lines on a surface plot?

Below I try to explain my problem.
Suppose I have the following surface plot (likelikood for the normal 
variable when both parameters are unknown):


---
normalLike - function(mu, sigma, sample){
   (sigma ^ - length(sample)) * exp(-0.5 * (sigma ^ -2) * sum((sample - 
mu)^2))

}
normalLikeVec - Vectorize(normalLike,  vectorize.args = c(mu,sigma))

teta1 - seq(0, 6, by=0.1)
teta2 - seq(0.1, 8, by=0.1)
matrixMuSigma - outer(teta1, teta2, normalLikeVec, sample=c(0.88, 1.07, 
1.27,1.54, 1.91, 2.27, 3.84, 4.50, 4.64, 9.41))

matrixMuSigma - matrixMuSigma / max(matrixMuSigma)

persp(teta1, teta2, matrixMuSigma)
---

Then I would like to superimpose on the same plot points (or a line) 
corresponding to the following data:

---
#x coordinates
teta1
#y coordinates
sigmaMax - teta2[apply(matrixMuSigma, 1, which.max)]
#z coordinates
apply(matrixMuSigma, 1, max)
---

Thanks in advance,
domenico

PS:
I am trying to explain the geometrical interpretation of profile 
likelihood. Any better idea?


__
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] summary of a list

2009-02-10 Thread lauramorg...@bluewin.ch
Hello,
I'm using the following for loop to find regression curves using a list of 
functions (formList), a list of starting 
values (startList), uppervalues (upperList) and lower values (lowerList).
A sample of the list of function I use in the loop is the following:

FormList - list(PTG.P ~ fz1(Portata, a, b), PTG.P ~ fz2(Portata, a, b), PTG.P 
~ fz3(Portata,a, b, d, e),
PTG.P ~ fz4(Portata, a, b), PTG.P ~ fz5(Portata, a, b, d), PO4.P ~ fz1(Portata, 
a, b),
PO4.P ~ fz2(Portata, a, b), ...

And the loop I use is:
resultList - list()
for (i in 1:length(formList))
{
resultList[[i]] - nls(formList[[i]], data=subset(dati, Fiume==Laveggio), 
start=startList[[i]], 
nls.control(maxiter=1000, warnOnly=TRUE), algorithm='port', 
na.action=na.omit,lower=lowerList[[i]], 
upper=upperList[[i]])
}
When the computation ends I get 5 warning messages (one of false convergence, 4 
of singular convergence:
In nls(formList[[i]], data = subset(dati, Fiume == Laveggio),  : Convergence 
failure: false convergence (8)
2: In nls(formList[[i]], data = subset(dati, Fiume == Laveggio),  : 
Convergence failure: singular convergence (7)

If I want to get the summary of the first object of the resultList I do:
summary(resultList[[1]])
And I get a result with no problem:
Formula: PTG.P ~ fz1(Portata, a, b)

Parameters:
  Estimate Std. Error t value Pr(|t|)   
a   61.158 18.591   3.290  0.00140 **
b7.616  8.720   0.873  0.38464   
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

Residual standard error: 91.32 on 96 degrees of freedom

Algorithm port, convergence message: both X-convergence and relative 
convergence (5)

It also works if I try to get the summary of the first 5 object of the 
resultList with:
summaryList-list()
for (i in 1:5)
{
summaryList[[i]]-summary(resultList[[i]])
}

But if I try to get the summary of all the objects of the resultList (there are 
35 objects) it doesn't work...
I tried:
summaryList-list()
 for (i in 1:length(resultList))
+ {
+ summaryList[[i]]-summary(resultList[[i]])
+ }
And I got the following error message:
Error in chol2inv(object$m$Rmat()) : l'elemento (3, 3) è zero, quindi l'inversa 
non può essere calcolata
Which translated should be: Error in chol2inv(object$m$Rmat()): the element (3, 
3) is zero (NULL?), that's why the 
inverse (inverse function?) can not be computed 

Does somebody have an idea on how to fix this? 

Thanks
Laura

__
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] ISOdatetime gives NA for a specific date

2009-02-10 Thread pbarros

Thanks. Now I know how to handle it. It was killing me

Pedro

Prof Brian Ripley wrote:
 
 On Tue, 10 Feb 2009, pbarros wrote:
 

 Hi all,

 I am using ISOdatetime, and I just found out that when I do
 ISOdatetime(1995,03,26,2,10,0) (or any other value under minutes or
 seconds)
 I get NA

 This does not happen with the same time in other dates, nor with
 different
 hours in the same date.
 Any hint why this happens?
 
 A non-existent time, most likely:
 
   x - ISOdatetime(1995,03,26,1,10,0)
 x
 [1] 1995-03-26 01:10:00 CET
 seq(x, length=10, by=hour)
   [1] 1995-03-26 01:10:00 CET  1995-03-26 03:10:00 CEST
   [3] 1995-03-26 04:10:00 CEST 1995-03-26 05:10:00 CEST
   [5] 1995-03-26 06:10:00 CEST 1995-03-26 07:10:00 CEST
   [7] 1995-03-26 08:10:00 CEST 1995-03-26 09:10:00 CEST
   [9] 1995-03-26 10:10:00 CEST 1995-03-26 11:10:00 CEST
 
 in TZ=Europe/Lisbon, which is my guess as to near where you are
 
 There was no 2:10 on 1995-03-26 in Lisbon: the clocks went forward an 
 hour at 2 am.
 
 Using R 2.8.1 under ESS/GnuEmacs under Windows XP

 Pedro
 
 
 -- 
 Brian D. Ripley,  rip...@stats.ox.ac.uk
 Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
 University of Oxford, Tel:  +44 1865 272861 (self)
 1 South Parks Road, +44 1865 272866 (PA)
 Oxford OX1 3TG, UKFax:  +44 1865 272595
 
 __
 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.
 
 

-- 
View this message in context: 
http://www.nabble.com/ISOdatetime-gives-NA-for-a-specific-date-tp21934989p21936140.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] Strange behaviour of ISOdatetime

2009-02-10 Thread Pedro de Barros

Hi All,

I am watching a strange behaviour of ISOdatetime. In my work 
computer, I get NA when I try to do

 ISOdatetime(1995,03,26,2,0,0)
[1] NA

But on other dates and/or times (hour) works OK
 ISOdatetime(1995,03,25,2,0,0)
[1] 1995-03-25 02:00:00 GMT

In my home computer, I do not have this problem.
I am running the same version of R (2.8.1 patched) on both machines, 
the same version of Gnu Emacs (22.3.1) and the same version of ESS 
(5.3.10). Both are running Windows XP. Has anyone experienced this before?


Pedro

__
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] ISOdatetime gives NA for a specific date

2009-02-10 Thread pbarros


Thanks a lot. I will need to change the time to GMT, then, I guess (this is
indeed GMT time).

Pedro

Daylight savings time, I guess. The clock went directly from 1:59 to
3:00 that day. Other systems behave strangely (er, handle the anomaly)
in different ways:


 ISOdatetime(1995,03,26,1,10,0)
[1] 1995-03-26 01:10:00 CET
 ISOdatetime(1995,03,26,2,10,0)
[1] 1995-03-26 01:10:00 CET
 ISOdatetime(1995,03,26,3,10,0)
[1] 1995-03-26 03:10:00 CEST

(SUSE 10.2)



-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45) 35327907

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



-- 
View this message in context: 
http://www.nabble.com/ISOdatetime-gives-NA-for-a-specific-date-tp21934989p21936112.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.


Re: [R] Strange behaviour of ISOdatetime

2009-02-10 Thread David Winsemius
My guess is that your two machines have different setting for locale.  
What does this produce on each of them:


sessionInfo()$locale

(Note: It would have been part of the information that you were asked  
to provide per the posting guide.)

---
For questions about unexpected behavior or a possible bug, you should,  
at a minimum, copy and paste the output from sessionInfo() into your  
message. When mentioning version numbers, always use the full version  
number, e.g., `2.6.1', not just `2.6', and also mention the platform  
(Windows, Linux, MacOS X, with their versions). Other potentially  
relevant details include the locale (type Sys.getlocale() at the R  
prompt), and whether you installed a pre-compiled binary version of R  
or compiled it yourself.


--
David Winsemius


On Feb 10, 2009, at 11:31 AM, Pedro de Barros wrote:


Hi All,

I am watching a strange behaviour of ISOdatetime. In my work  
computer, I get NA when I try to do

 ISOdatetime(1995,03,26,2,0,0)
[1] NA

But on other dates and/or times (hour) works OK
 ISOdatetime(1995,03,25,2,0,0)
[1] 1995-03-25 02:00:00 GMT

In my home computer, I do not have this problem.
I am running the same version of R (2.8.1 patched) on both machines,  
the same version of Gnu Emacs (22.3.1) and the same version of ESS  
(5.3.10). Both are running Windows XP. Has anyone experienced this  
before?


Pedro

__
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] how to add points/lines to a surface plot

2009-02-10 Thread Uwe Ligges

See ?persp, particularly the example that starts with
 # (2) Add to existing persp plot - using trans3d() :

Uwe Ligges


Domenico Vistocco wrote:

Dear All,
is there a way to superimpose points and/or lines on a surface plot?

Below I try to explain my problem.
Suppose I have the following surface plot (likelikood for the normal 
variable when both parameters are unknown):


--- 


normalLike - function(mu, sigma, sample){
   (sigma ^ - length(sample)) * exp(-0.5 * (sigma ^ -2) * sum((sample - 
mu)^2))

}
normalLikeVec - Vectorize(normalLike,  vectorize.args = c(mu,sigma))

teta1 - seq(0, 6, by=0.1)
teta2 - seq(0.1, 8, by=0.1)
matrixMuSigma - outer(teta1, teta2, normalLikeVec, sample=c(0.88, 1.07, 
1.27,1.54, 1.91, 2.27, 3.84, 4.50, 4.64, 9.41))

matrixMuSigma - matrixMuSigma / max(matrixMuSigma)

persp(teta1, teta2, matrixMuSigma)
--- 



Then I would like to superimpose on the same plot points (or a line) 
corresponding to the following data:
--- 


#x coordinates
teta1
#y coordinates
sigmaMax - teta2[apply(matrixMuSigma, 1, which.max)]
#z coordinates
apply(matrixMuSigma, 1, max)
--- 



Thanks in advance,
domenico

PS:
I am trying to explain the geometrical interpretation of profile 
likelihood. Any better idea?


__
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] arithmetic comparison over corresponding values from two vectors

2009-02-10 Thread T Joshi
Hi,
I have scenario in which I wish to check whether numeric values in one array
falls within the range of numbers defined over corresponding values in two
other vectors:

starts = c(12,45,67,110)
ends=c(24, 58,102,150)

trgroup=c(18,87)

The result should be 1,3 , indices of vector starts/ends.
which(trgroup=starts  trgroup=ends) wouldn't give required result.
I don't want to write a for loop for doing this.  Kindly help with ideas.

Josh

[[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] summary of a list

2009-02-10 Thread Dieter Menne
lauramorgana at bluewin.ch lauramorgana at bluewin.ch writes:

 
 Hello,
 I'm using the following for loop to find regression curves using a list of
functions (formList), a list of

.. long non-reproducible code removed

 And I got the following error message:
 Error in chol2inv(object$m$Rmat()) : l'elemento (3, 3) è zero, quindi
l'inversa non può essere calcolata
 Which translated should be: Error in chol2inv(object$m$Rmat()): the element
(3, 3) is zero (NULL?),
 that's why the 
 inverse (inverse function?) can not be computed 

nls is rather nasty or nice in telling you when the result should not 
be trusted. Other software gives nonsense result without blinking.

In package nlme, there is a function nlsList which does directly what you
want, but there is little help besides revising the model for the cases
without convergence. 

Also try check Gabor Grothendieks package nls2 which could help you 
finding better start values.

Dieter

__
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] plotting the result of a nonlinear regression

2009-02-10 Thread stephen sefick
?predict

On Tue, Feb 10, 2009 at 11:06 AM, lauramorg...@bluewin.ch
lauramorg...@bluewin.ch wrote:
 Hello,
 to plot the result of a singular non linear regression (using nls) I usually 
 use the function plotfit, for example:

 r.PTG.V-nls(PTG.P~ fz1(Portata, a,b), data=dati, start=list(a=10, b=10), 
 nls.control(maxiter=200), algorithm='port',
 trace=TRUE, na.action=na.omit, lower=list(a=0, b=10), upper=list(a=100, 
 b=100))
 plotfit(r.PTG.V)

 I tried to use the function plotfit on the result of the following for loop 
 but I got an error message:
 for (i in 1:length(formList))
 {
resultList[[i]] - nls(formList[[i]], data=subset(dati, 
 Fiume==Laveggio), start=startList7[[i]],
nls.control(maxiter=1000, warnOnly=TRUE), algorithm='port', 
 na.action=na.omit,lower=lowerList7[[i]],
upper=upperList7[[i]])
 }
 plotfit(resultList[[1]]

 Error in diff(as.numeric(y[ord])) :
  (list) object cannot be coerced to type 'double'

 Could somebody tell me what this error means? how can I fix this problem?
 Any suggestion appreciated!!
 Thanks,
 Laura

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




-- 
Stephen Sefick

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

-K. Mullis

__
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] Help regarding White's Heteroscedasticity Correction

2009-02-10 Thread Kingsford Jones
or simultaneously estimate the coefficients and variance structure via
nlme::gls and its 'weights' argument...

On Tue, Feb 10, 2009 at 7:57 AM, John Fox j...@mcmaster.ca wrote:
 Dear Kishore,

 Yes, White's heteroscedasticity-consistent standard errors are just that --
 standard errors for the OLS coefficients that are consistent in the presence
 of heteroscedasticity. The coefficients themselves don't change. There is an
 issue here: although the standard errors and OLS coefficients are
 consistent, the OLS estimates lose efficiency. If you know that pattern of
 heteroscedasticity, then you might get more efficient estimates by taking it
 into account, e.g., in weighted-least-squares regression, or, if the
 residual spread increases with the fitted values, by transforming the
 response.

 I hope this helps,
  John

 --
 John Fox, Professor
 Department of Sociology
 McMaster University
 Hamilton, Ontario, Canada
 web: socserv.mcmaster.ca/jfox


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
 On
 Behalf Of Kishore
 Sent: February-10-09 9:19 AM
 To: r-help@r-project.org; r-h...@stat.math.ethz.ch
 Subject: [R] Help regarding White's Heteroscedasticity Correction

 Hi
 I am actually running the White test for correcting Heteroscedasticity.  I
 used sandwich()  car(), however the output shows the updated t test of
 coefficients, with revised Standard Errors, however the estimates remained
 same.  My problem is that the residuals formed a pattern in the original
 regression equation.  After running the White's test, I got some new
 standard errors - but from here I didn't understand how to plot the
 residuals (or) how to correct the estimates??  Can some one direct me in
 this regard..

 Best,

 Kishore/..
 http://kaykayatisb.blogspot.com

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


__
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] arithmetic comparison over corresponding values from two vectors

2009-02-10 Thread Marc Schwartz
on 02/10/2009 11:02 AM T Joshi wrote:
 Hi,
 I have scenario in which I wish to check whether numeric values in one array
 falls within the range of numbers defined over corresponding values in two
 other vectors:
 
 starts = c(12,45,67,110)
 ends=c(24, 58,102,150)
 
 trgroup=c(18,87)
 
 The result should be 1,3 , indices of vector starts/ends.
 which(trgroup=starts  trgroup=ends) wouldn't give required result.
 I don't want to write a for loop for doing this.  Kindly help with ideas.
 
 Josh

Try this:

 sapply(trgroup, function(x) which((x = starts)  (x = ends)))
[1] 1 3

HTH,

Marc Schwartz

__
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 running as a server on windows?

2009-02-10 Thread Antje

Nobody can help with this question (or tell me where I can find help) ?

Antje schrieb:

Hi there,

I'm not sure whether this is the right mailing list to put this 
question... if not, please tell me where I can find help.


I have a spare dual-core machine which run Windows XP Professional and 
is nearly unused (nearly! Unfortunately, I cannot change OS).
And I'm investigating Knime (knime.org) to set up data analysis 
workflows. They have some nodes to execute R on a remote machine. Is it 
possible to run R on this windows machine, so that I can call it from 
somewhere else?


Antje

__
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] arithmetic comparison over corresponding values from two vectors

2009-02-10 Thread Keith Jewell
sapply(trgroup, function(x) which(x=starts  x =ends))

works for your example data, but there's probably a better way

HTH

KJ

T Joshi tejalonl...@gmail.com wrote in message 
news:11417a880902100902w53664a3dq11aee64a963d8...@mail.gmail.com...
 Hi,
 I have scenario in which I wish to check whether numeric values in one 
 array
 falls within the range of numbers defined over corresponding values in two
 other vectors:

 starts = c(12,45,67,110)
 ends=c(24, 58,102,150)

 trgroup=c(18,87)

 The result should be 1,3 , indices of vector starts/ends.
 which(trgroup=starts  trgroup=ends) wouldn't give required result.
 I don't want to write a for loop for doing this.  Kindly help with ideas.

 Josh

__
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 add points/lines to a surface plot

2009-02-10 Thread David Winsemius
In this case, following your instructions and a bit of noodling with  
the example solves the problem with:


persp(teta1, teta2, matrixMuSigma) - res
points(trans3d( teta1, sigmaMax, apply(matrixMuSigma, 1, max),  
pmat=res), col=red)


--
David Winsemius

On Feb 10, 2009, at 11:50 AM, Uwe Ligges wrote:


See ?persp, particularly the example that starts with
# (2) Add to existing persp plot - using trans3d() :

Uwe Ligges


Domenico Vistocco wrote:

Dear All,
is there a way to superimpose points and/or lines on a surface plot?
Below I try to explain my problem.
Suppose I have the following surface plot (likelikood for the  
normal variable when both parameters are unknown):
--- normalLike 
 - function(mu, sigma, sample){
  (sigma ^ - length(sample)) * exp(-0.5 * (sigma ^ -2) *  
sum((sample - mu)^2))

}
normalLikeVec - Vectorize(normalLike,  vectorize.args =  
c(mu,sigma))

teta1 - seq(0, 6, by=0.1)
teta2 - seq(0.1, 8, by=0.1)
matrixMuSigma - outer(teta1, teta2, normalLikeVec, sample=c(0.88,  
1.07, 1.27,1.54, 1.91, 2.27, 3.84, 4.50, 4.64, 9.41))

matrixMuSigma - matrixMuSigma / max(matrixMuSigma)
persp(teta1, teta2, matrixMuSigma)
--- Then 
 I would like to superimpose on the same plot points (or a line)  
corresponding to the following data:
--- #x 
 coordinates

teta1
#y coordinates
sigmaMax - teta2[apply(matrixMuSigma, 1, which.max)]
#z coordinates
apply(matrixMuSigma, 1, max)
--- Thanks 
 in advance,

domenico
PS:
I am trying to explain the geometrical interpretation of profile  
likelihood. Any better idea?

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


Re: [R] arithmetic comparison over corresponding values from two vectors

2009-02-10 Thread Charles C. Berry

On Tue, 10 Feb 2009, Keith Jewell wrote:


sapply(trgroup, function(x) which(x=starts  x =ends))

works for your example data, but there's probably a better way



For large scale problems this works well:

 http://finzi.psych.upenn.edu/R/Rhelp02a/archive/60815.html


HTH,

Chuck




HTH

KJ

T Joshi tejalonl...@gmail.com wrote in message
news:11417a880902100902w53664a3dq11aee64a963d8...@mail.gmail.com...

Hi,
I have scenario in which I wish to check whether numeric values in one
array
falls within the range of numbers defined over corresponding values in two
other vectors:

starts = c(12,45,67,110)
ends=c(24, 58,102,150)

trgroup=c(18,87)

The result should be 1,3 , indices of vector starts/ends.
which(trgroup=starts  trgroup=ends) wouldn't give required result.
I don't want to write a for loop for doing this.  Kindly help with ideas.

Josh


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



Charles C. Berry(858) 534-2098
Dept of Family/Preventive Medicine
E mailto:cbe...@tajo.ucsd.edu   UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

__
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 running as a server on windows?

2009-02-10 Thread Uwe Ligges



Antje wrote:

Nobody can help with this question (or tell me where I can find help) ?

Antje schrieb:

Hi there,

I'm not sure whether this is the right mailing list to put this 
question... if not, please tell me where I can find help.


I have a spare dual-core machine which run Windows XP Professional and 
is nearly unused (nearly! Unfortunately, I cannot change OS).
And I'm investigating Knime (knime.org) to set up data analysis 
workflows. They have some nodes to execute R on a remote machine. Is 
it possible to run R on this windows machine, so that I can call it 
from somewhere else?



Call from somewhere else is somewhat unspecific. Anyway, there are 
several ways:
- Work using a Remote Desktop Connection (as I do for maintaining the 
CRAN windows builder, for example).

- Install some secure shell server and work command line based.
- Install some framework that allows to start processes on that machine 
as a node in a computer cluster (such as mpi) - this is not that easy on 
Windows and you always need a lucky combination of libraries (mpi/Rmpi 
and so on) that work together.


Uwe Ligges




Antje

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


Re: [R] R running as a server on windows?

2009-02-10 Thread Rowe, Brian Lee Yung (Portfolio Analytics)
Did you try the forums on Knime? That might be a better bet.


-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Antje
Sent: Tuesday, February 10, 2009 12:24 PM
To: r-h...@stat.math.ethz.ch
Subject: Re: [R] R running as a server on windows?


Nobody can help with this question (or tell me where I can find help) ?

Antje schrieb:
 Hi there,
 
 I'm not sure whether this is the right mailing list to put this 
 question... if not, please tell me where I can find help.
 
 I have a spare dual-core machine which run Windows XP Professional and

 is nearly unused (nearly! Unfortunately, I cannot change OS).
 And I'm investigating Knime (knime.org) to set up data analysis 
 workflows. They have some nodes to execute R on a remote machine. Is
it 
 possible to run R on this windows machine, so that I can call it from 
 somewhere else?
 
 Antje
 
 __
 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.

--
This message w/attachments (message) may be privileged, confidential or 
proprietary, and if you are not an intended recipient, please notify the 
sender, do not use or share it and delete it. Unless specifically indicated, 
this message is not an offer to sell or a solicitation of any investment 
products or other financial product or service, an official confirmation of any 
transaction, or an official statement of Merrill Lynch. Subject to applicable 
law, Merrill Lynch may monitor, review and retain e-communications (EC) 
traveling through its networks/systems. The laws of the country of each 
sender/recipient may impact the handling of EC, and EC may be archived, 
supervised and produced in countries other than the country in which you are 
located. This message cannot be guaranteed to be secure or error-free. 
References to Merrill Lynch are references to any company in the Merrill 
Lynch  Co., Inc. group of companies, which are wholly-owned by Bank of America 
Corporation. Secu!
 rities and Insurance Products: * Are Not FDIC Insured * Are Not Bank 
Guaranteed * May Lose Value * Are Not a Bank Deposit * Are Not a Condition to 
Any Banking Service or Activity * Are Not Insured by Any Federal Government 
Agency. Attachments that are part of this E-communication may have additional 
important disclosures and disclaimers, which you should read. This message is 
subject to terms available at the following link: 
http://www.ml.com/e-communications_terms/. By messaging with Merrill Lynch you 
consent to the foregoing.
--

__
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 running as a server on windows?

2009-02-10 Thread Greg Snow
I, for one, don't fully understand the question, and while there are many on 
this list that are much smarter than I am, they may also have trouble 
understanding the question.

At first glance it looks like you are asking if R runs on Windows XP (the 
answer is yes, but this seems to simple to be the real question).

Are you asking about knime?  Then you should ask on a forum about knime.

If you are asking about ways to run R as a server on a windows machine, then 
look at the nws package.  It takes a bit of setting up (including installing 
python and some addons to that, starting a server, etc.), but may do what you 
want.  I have no idea if it interacts with knime at all.

If this does not help, then try rephrasing the question or asking somewhere 
where there are more knime users, 

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
 project.org] On Behalf Of Antje
 Sent: Tuesday, February 10, 2009 10:24 AM
 To: r-h...@stat.math.ethz.ch
 Subject: Re: [R] R running as a server on windows?
 
 Nobody can help with this question (or tell me where I can find help) ?
 
 Antje schrieb:
  Hi there,
 
  I'm not sure whether this is the right mailing list to put this
  question... if not, please tell me where I can find help.
 
  I have a spare dual-core machine which run Windows XP Professional
 and
  is nearly unused (nearly! Unfortunately, I cannot change OS).
  And I'm investigating Knime (knime.org) to set up data analysis
  workflows. They have some nodes to execute R on a remote machine. Is
 it
  possible to run R on this windows machine, so that I can call it from
  somewhere else?
 
  Antje
 
  __
  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.


[R] loglik and arima()

2009-02-10 Thread Stephen Collins
All - 

I am evaluating an arima(2,1,3) and arima(3,1,3) and notice the 
log-likelihood of the restricted model is higher than the log-likelihood 
of the unrestricted. 

Since these are nested models, I thought the unrestricted model would have 
a log-likelihood at least as large as that of the restricted model.  Am I 
interpreting the loglik output incorrectly?

Regards,

   
Stephen Collins, MPP | Analyst
Health  Benefits | Aon Consulting
200 East Randolph, Suite 900, Chicago, IL
Tel: 312-381-2578 | Fax: 312-381-0136
Email: stephen_coll...@aon.com
 
Aon Consulting selected by the readers of Business Insurance as the “Best 
Employee Benefit Consulting Firm” in 2006, 2007, and 2008
 
NOTE: The information contained in this transmission, including any 
attachment(s) is only for the use of the intended individual(s) or entity, 
and may contain information that is privileged and confidential. If the 
reader of this message is not an intended recipient, you are hereby 
notified that any dissemination, distribution, disclosure, or copying of 
this information is unauthorized and strictly prohibited. If you have 
received this communication in error, please contact the sender 
immediately by reply email and destroy all copies of the original message.
 

[[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] Strange behaviour of ISOdatetime

2009-02-10 Thread Tony Plate

Have you checked that that time exists in the time zone you are using?  From 
?ISOdatetime:

Note
...
Remember that in most timezones some times do not occur and some occur twice because of transitions to/from summer time. What happens in those cases is OS-specific. 


You could try working out what your system is using as the transition to/from 
summer time.  (If you need to generate times that are 2 hours after midnight, 
try using ISOdatetime to generate the midnight times and add 2 hours).

On my system, all this works fine:


ISOdatetime(1995,03,26,2,0,0)

[1] 1995-03-26 02:00:00 MST

ISOdatetime(1995,03,26,0,0,0) + 2 * 60 * 60

[1] 1995-03-26 02:00:00 MST

sessionInfo()
R version 2.8.1 (2008-12-22) 
i386-pc-mingw32 


locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United 
States.1252;LC_MONETARY=English_United 
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

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


other attached packages:
[1] TimeWarp_0.7abind_1.2-0 trackObjs_0.8-0 tap.misc_1.0   
[5] bmc.misc_1.0RtTests_0.1-5  





-- Tony Plate

Pedro de Barros wrote:

Hi All,

I am watching a strange behaviour of ISOdatetime. In my work computer, I 
get NA when I try to do

  ISOdatetime(1995,03,26,2,0,0)
[1] NA

But on other dates and/or times (hour) works OK
  ISOdatetime(1995,03,25,2,0,0)
[1] 1995-03-25 02:00:00 GMT

In my home computer, I do not have this problem.
I am running the same version of R (2.8.1 patched) on both machines, the 
same version of Gnu Emacs (22.3.1) and the same version of ESS (5.3.10). 
Both are running Windows XP. Has anyone experienced this before?


Pedro

__
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] Rterm.exe stops responding to keyboard input

2009-02-10 Thread CB
I've been trying to use Rterm.exe, mainly because of Rgui.exe's lack of
support for incremental history searching. But on my system (Win XP, SP3),
it (rterm from R-2.8.1) frequently just stops responding to keyboard input.
This happens often (enough to make it unusable), and generally after a
switch to another window. It doesn't seem to hang exactly, as if I leave it
a while (minutes) it sometimes starts responding again. It isn't using any
CPU to speak of whilst being mute.

Anyone else know of this?

[[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] R on Mobile Devices (Android)

2009-02-10 Thread Warren Young

Harsh wrote:


At the cost of sounding far-fetched and almost incredulous, I would
like to know if any R user is remotely considering the use of R on
Mobile devices, and Android in particular.


In addition to the other objections in the other replies, I add this 
one: the assignment operator and the parens are up on ALT keys on the 
Android keyboard.  Typing R expressions would be pretty painful.


You can demo this by installing an ssh client and logging in remotely to 
a machine with R on it, and trying to use it remotely.  A local one 
wouldn't be better...it might not even be faster, because the faster CPU 
on the machine running R might matter more than the speed of the network 
link between client and server.


I briefly thought of what it would take to port R to an iPhone or iPod 
touch, and the keyboard issues would be even worse.


Bottom line, R has the idiom of a real keyboard written into its bones. 
 To be popular, a statistical analysis tool for such devices would have 
to work differently, taking advantage of the platform's native input 
mechanisms.



mobile phone would allow for micro statistics to be collected from the
log files reflecting number of calls dropped, average time spent
talking, a time series of the amount of time taken for battery
recharge, and a host of other information that could be collated and
analyzed.


I agree with the other person that the program to write to cover this 
case would be just a stat gatherer, which somehow gets the data off the 
device for analysis by R running elsewhere.  It could be a web service, 
or you could write a CSV file that somehow gets downloaded from the 
device for use on the computer the phone syncs to.


__
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 running as a server on windows?

2009-02-10 Thread Bio7

Yes you can run the Rserve application on a remote computer in e.g network
and then you can connect
it from your Desktop computer. I've done this already with a remote Linux
computer (Rserve is running
very stable on a Linux computer).
For example i clustered an R,G,B image on a linux computer with R to make
use of the additional RAM
without to load my Desktop application (The remote connection will be a new
feature in the next release of my application). 
If the mentioned application uses Rserve and can be configured with an ip
adress etc. it should be
easily possible. 
Please read the information how to config Rserve(and read the security info
carefully!) on the Rserve website:

http://www.rforge.net/Rserve/ http://www.rforge.net/Rserve/ 

-Documentation

I hope this information helps!

Best regards

Marcel




-- 
View this message in context: 
http://www.nabble.com/R-running-as-a-server-on-windows--tp21929048p21939495.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.


Re: [R] Rterm.exe stops responding to keyboard input

2009-02-10 Thread Henrik Bengtsson
Hi,

this sounds awfully similar to what I reported in r-help thread '[R]
Windows Vista, Rterm  LeftAlt + Tab issue' on Aug 21, 2008, cf.

  https://stat.ethz.ch/pipermail/r-help/2008-August/171548.html

At least we are not alone ;)  ...and I though it was an issue with
Windows Vista only, because I didn't notice any problem with Windows
XP Pro I had before.  It might have been that I only had SP 2 (I
think), so it may be related to post-SP 2 updates that are also
included in Vista.

In Windows, you can shift between applications using either
LeftAlt+TAB or RightAlt+TAB, but I discovered that the freezing
problem only occurred with LeftAlt+TAB, which is the combination I use
most frequently.  I ended up remapping the physical left-most Alt key
(on a US keyboard) to signal Right Alt (and vice versa for the
right-most Alt key).  I used KeyTweak
[http://webpages.charter.net/krumsick/] do this.  Since then I've
forgot about the issue, so I guess it works to circumvent the problem.

Let us know if this solves your problem

Henrik


On Tue, Feb 10, 2009 at 10:54 AM, CB cb.li...@gmail.com wrote:
 I've been trying to use Rterm.exe, mainly because of Rgui.exe's lack of
 support for incremental history searching. But on my system (Win XP, SP3),
 it (rterm from R-2.8.1) frequently just stops responding to keyboard input.
 This happens often (enough to make it unusable), and generally after a
 switch to another window. It doesn't seem to hang exactly, as if I leave it
 a while (minutes) it sometimes starts responding again. It isn't using any
 CPU to speak of whilst being mute.

 Anyone else know of this?

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


[R] How to split a character vector into 3 vectors

2009-02-10 Thread kayj

Hi ,


Does any one know how to split a character vector , I have a vector X that
looks like this and each row has 3 characters

  X
ASK
DGH
ASG
AUJ
FRT

I would like to split the vector into 3 vectors that look like this

X1  X2  X3
A   S   K
D   G   H
A   S   G
A   U   J
U   R   T

thanks

-- 
View this message in context: 
http://www.nabble.com/How-to-split-a-character-vector-into-3-vectors-tp21939492p21939492.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] forestplot

2009-02-10 Thread Marino, Mark
Dear R users,
 
Is there any way to control the size of the box around the mean when
creating a Forest plot using the forestplot function?
 
regards
 
Mark
 

Mark T. Marino, MD

VP, Early Clinical Development

Mannkind Corp.

61 S. Paramus Road

Paramus, NJ 07652

201-983-5238 Office

203-512-4008 Cell

mmar...@mannkindcorp.com

 

 

[[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] How to split a character vector into 3 vectors

2009-02-10 Thread Jorge Ivan Velez
Dear kayj,

Try this:

X-c(ASK, DGH, ASG, AUJ, FRT)
res-data.frame(do.call(rbind,strsplit(X,)))
colnames(res)-paste(X,1:ncol(res),sep=)
res

HTH,

Jorge


On Tue, Feb 10, 2009 at 1:50 PM, kayj kjaj...@yahoo.com wrote:


 Hi ,


 Does any one know how to split a character vector , I have a vector X that
 looks like this and each row has 3 characters

  X
 ASK
 DGH
 ASG
 AUJ
 FRT

 I would like to split the vector into 3 vectors that look like this

 X1  X2  X3
 A   S   K
 D   G   H
 A   S   G
 A   U   J
 U   R   T

 thanks

 --
 View this message in context:
 http://www.nabble.com/How-to-split-a-character-vector-into-3-vectors-tp21939492p21939492.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.


[[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] How to split a character vector into 3 vectors

2009-02-10 Thread Nordlund, Dan (DSHS/RDA)
See ?strsplit

Hope this is helpful,

Dan

Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA  98504-5204
 
 

 -Original Message-
 From: r-help-boun...@r-project.org 
 [mailto:r-help-boun...@r-project.org] On Behalf Of kayj
 Sent: Tuesday, February 10, 2009 10:50 AM
 To: r-help@r-project.org
 Subject: [R] How to split a character vector into 3 vectors
 
 
 Hi ,
 
 
 Does any one know how to split a character vector , I have a 
 vector X that
 looks like this and each row has 3 characters
 
   X
 ASK
 DGH
 ASG
 AUJ
 FRT
 
 I would like to split the vector into 3 vectors that look like this
 
 X1X2  X3
 A S   K
 D G   H
 A S   G
 A U   J
 U R   T
 
 thanks
 
 -- 
 View this message in context: 
 http://www.nabble.com/How-to-split-a-character-vector-into-3-v
 ectors-tp21939492p21939492.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-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] cwhmisc package requests update all the time!

2009-02-10 Thread Ben Bolker
Nguyen Dinh Nguyen n.nguyen at garvan.org.au writes:

 
 Dear Christian,
 Every single time check update package, “cwhmisc” always requests updating.
 I’m aware that the package was latest updated in CRAN on 20Nov2008.
 Is there anything wrong with my R library or somethingelse?
 I use R 2.8.1 on Window XP service pack 2

   Have you installed packages in more than one place?
I think I've experienced such a phenomenon where R detected
that I had an old copy in a non-standard place, but updated the 
version in the default library location instead (and hence
asked to update it again the next time).
   If you post some more information about installed package
versions, lib.loc, etc. you might get a better diagnosis ...

  Ben Bolker

__
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 split a character vector into 3 vectors

2009-02-10 Thread jdeisenberg


kayj wrote:
 
 Hi ,
 
 
 Does any one know how to split a character vector , I have a vector X that
 looks like this and each row has 3 characters
 
   X
 ASK
 DGH
 ASG
 AUJ
 FRT
 
 I would like to split the vector into 3 vectors that look like this
 
 X1X2  X3
 A S   K
 D G   H
 A S   G
 A U   J
 U R   T
 
 thanks
 
 

If I understand you correctly, you have this vector:

x - c(ASK, DGH, ASG, AUJ, URT)

This code seems to do what you want:

x1 - substr(x, 1, 1)
x2 - substr(x, 2, 2)
x3 - substr(x, 3, 3)

There's probably a much simpler and more elegant way to do it, though.
-- 
View this message in context: 
http://www.nabble.com/How-to-split-a-character-vector-into-3-vectors-tp21939492p21939521.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.


Re: [R] How to split a character vector into 3 vectors

2009-02-10 Thread Henrique Dallazuanna
Another option is:

read.table(textConnection(gsub((\\w), \\1;, X)), sep = ;)

On Tue, Feb 10, 2009 at 4:50 PM, kayj kjaj...@yahoo.com wrote:


 Hi ,


 Does any one know how to split a character vector , I have a vector X that
 looks like this and each row has 3 characters

  X
 ASK
 DGH
 ASG
 AUJ
 FRT

 I would like to split the vector into 3 vectors that look like this

 X1  X2  X3
 A   S   K
 D   G   H
 A   S   G
 A   U   J
 U   R   T

 thanks

 --
 View this message in context:
 http://www.nabble.com/How-to-split-a-character-vector-into-3-vectors-tp21939492p21939492.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.




-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

[[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] loglik and arima()

2009-02-10 Thread markleeds
 hi: maybe it's minimizing the negative of the likeihood rather than 
maximizing the likelihood ?
other than that, i don't see that being possible because of what you 
said. see what

happens if you estimate an arima(1,1,3) ?





On Tue, Feb 10, 2009 at 12:51 PM, Stephen Collins wrote:


All -
I am evaluating an arima(2,1,3) and arima(3,1,3) and notice the 
log-likelihood of the restricted model is higher than the 
log-likelihood of the unrestricted.
Since these are nested models, I thought the unrestricted model would 
have a log-likelihood at least as large as that of the restricted 
model.  Am I interpreting the loglik output incorrectly?


Regards,

   Stephen Collins, MPP | Analyst
Health  Benefits | Aon Consulting
200 East Randolph, Suite 900, Chicago, IL
Tel: 312-381-2578 | Fax: 312-381-0136
Email: stephen_coll...@aon.com
 Aon Consulting selected by the readers of Business Insurance as the 
���Best Employee Benefit Consulting Firm��� in 2006, 2007, and 2008
 NOTE: The information contained in this transmission, including any 
attachment(s) is only for the use of the intended individual(s) or 
entity, and may contain information that is privileged and 
confidential. If the reader of this message is not an intended 
recipient, you are hereby notified that any dissemination, 
distribution, disclosure, or copying of this information is 
unauthorized and strictly prohibited. If you have received this 
communication in error, please contact the sender immediately by reply 
email and destroy all copies of the original message.


[[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] Rterm.exe stops responding to keyboard input

2009-02-10 Thread CB
Henrik,

Ah, I did briefly search the list archive, but hadn't come across your
earlier post, sorry.

I can confirm the conditions you outlined back then (ie. it's L-ALT+TAB, and
only that, that causes the problem, that on return to rterm I can use ctrl-C
to interrupt a running R call but then no further keyboard input).

Rather than remapping the key (just being lazy) I've found another
workaround -- a couple of taps on the left-ALT key whilst focus is on the
Rterm window seems to revive Rterm for me.

Thanks for the left-ALT tip. I hadn't noticed that the problem was specific
to this means of switching windows.

Cheers,

CB.

2009/2/11 Crispin Bennett cris...@cb-ss.net

 Henrik,

 Ah, I did briefly search the list archive, but hadn't come across your
 earlier post, sorry.

 I can confirm the conditions you outlined back then (ie. it's L-ALT+TAB,
 and only that, that causes the problem, that on return to rterm I can use
 ctrl-C to interrupt a running R call but then no further keyboard input).

 Rather than remapping the key (just being lazy) I've found another
 workaround -- a couple of taps on the left-ALT key whilst focus is on the
 Rterm window seems to revive Rterm for me.

 Thanks for the left-ALT tip. I hadn't noticed that the problem was specific
 to this means of switching windows.

 Cheers,

 CB.

 2009/2/11 Henrik Bengtsson h...@stat.berkeley.edu

 Hi,

 this sounds awfully similar to what I reported in r-help thread '[R]
 Windows Vista, Rterm  LeftAlt + Tab issue' on Aug 21, 2008, cf.

  https://stat.ethz.ch/pipermail/r-help/2008-August/171548.html

 At least we are not alone ;)  ...and I though it was an issue with
 Windows Vista only, because I didn't notice any problem with Windows
 XP Pro I had before.  It might have been that I only had SP 2 (I
 think), so it may be related to post-SP 2 updates that are also
 included in Vista.

 In Windows, you can shift between applications using either
 LeftAlt+TAB or RightAlt+TAB, but I discovered that the freezing
 problem only occurred with LeftAlt+TAB, which is the combination I use
 most frequently.  I ended up remapping the physical left-most Alt key
 (on a US keyboard) to signal Right Alt (and vice versa for the
 right-most Alt key).  I used KeyTweak
 [http://webpages.charter.net/krumsick/] do this.  Since then I've
 forgot about the issue, so I guess it works to circumvent the problem.

 Let us know if this solves your problem

 Henrik


 On Tue, Feb 10, 2009 at 10:54 AM, CB cb.li...@gmail.com wrote:
  I've been trying to use Rterm.exe, mainly because of Rgui.exe's lack of
  support for incremental history searching. But on my system (Win XP,
 SP3),
  it (rterm from R-2.8.1) frequently just stops responding to keyboard
 input.
  This happens often (enough to make it unusable), and generally after a
  switch to another window. It doesn't seem to hang exactly, as if I leave
 it
  a while (minutes) it sometimes starts responding again. It isn't using
 any
  CPU to speak of whilst being mute.
 
  Anyone else know of this?
 
 [[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.


[R] rscript write function

2009-02-10 Thread Applejus

Hi,

I have this very simple two-line script :

test.r:

print (abc);
write(def,test.txt);

When run with rscript.exe --vanilla test.r (or just rscript.exe test.r), I
get the abc output in the shell but no file is created in the
directory

I noticed that the only time the test.txt gets written is when the test.r
script is placed in the bin directory where rscript.exe resides. I want a
way to execute my test.r script and output the corresponding file in another
directory, without having to copy the rscript.exe and dlls to that
directory.

I hope there is a way!! (I have this constraint because I am developping a
website that connects with R and my script resides in a session folder
created dynamically for every user...)

Thanks!
-- 
View this message in context: 
http://www.nabble.com/rscript-write-function-tp21940621p21940621.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.


Re: [R] rscript write function

2009-02-10 Thread Applejus

OK,
obviously that was a silly question...
SOLUTION: just specify the path in the write function...!

Sorry ! 


Applejus wrote:
 
 Hi,
 
 I have this very simple two-line script :
 
 test.r:
 
 print (abc);
 write(def,test.txt);
 
 When run with rscript.exe --vanilla test.r (or just rscript.exe test.r), I
 get the abc output in the shell but no file is created in the
 directory
 
 I noticed that the only time the test.txt gets written is when the test.r
 script is placed in the bin directory where rscript.exe resides. I want a
 way to execute my test.r script and output the corresponding file in
 another directory, without having to copy the rscript.exe and dlls to that
 directory.
 
 I hope there is a way!! (I have this constraint because I am developping a
 website that connects with R and my script resides in a session folder
 created dynamically for every user...)
 
 Thanks!
 

-- 
View this message in context: 
http://www.nabble.com/rscript-write-function-tp21940621p21942388.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.


Re: [R] forestplot

2009-02-10 Thread Uwe Ligges



Marino, Mark wrote:

Dear R users,
 
Is there any way to control the size of the box around the mean when

creating a Forest plot using the forestplot function?


H,

 forestplot
Error: object 'forestplot' not found

 PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html

 and provide commented, minimal, self-contained, reproducible code.

Uwe Ligges



regards
 
Mark
 


Mark T. Marino, MD

VP, Early Clinical Development

Mannkind Corp.

61 S. Paramus Road

Paramus, NJ 07652

201-983-5238 Office

203-512-4008 Cell

mmar...@mannkindcorp.com

 

 


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


[R] Mixed ANCOVA with between-Ss covariate?

2009-02-10 Thread Mike Lawrence
Hi all,

I have data from an experiment with 3 independent variables, 2 are
within and 1 is between. In addition to the dependent variable, I have
a covariate that is a single measure per subject. Below I provide an
example generated data set and my approach to implementing the ANCOVA.
However the output confuses me; why does the covariate only appear in
the first strata? Presumably it should appear in every strata in which
there can be between-Ss effects or interactions with between-Ss
effects, no?

#generate data
set.seed(1)
a=rbind(
expand.grid(
id=1:20
,iv1 = 1:2
,iv2 = 1:2
)
)
a$group = factor(a$id11)
a$dv = rnorm(length(a[,1]))
a$covariate = NA
for(i in unique(a$id)){
a$covariate[a$id==i]= rnorm(1)
}

#make sure id, iv1, and iv2 are factorized
a$id=factor(a$id)
a$iv1=factor(a$iv1)
a$iv2=factor(a$iv2)

#run ANCOVA
covariate_aov = aov(dv~covariate+group*iv1*iv2+Error(id/(iv1*iv2)),data=a)
summary(covariate_aov)


-- 
Mike Lawrence
Graduate Student
Department of Psychology
Dalhousie University
www.thatmike.com

Looking to arrange a meeting? Check my public calendar:
http://www.thatmike.com/mikes-public-calendar

~ Certainty is folly... I think. ~

__
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] Putting values and axis X labels on the charts based on allEffects

2009-02-10 Thread Dimitri Liakhovitski
Dear everybody!
Need help with graphics. I am runnig a simple lm and then using
allEffects from 'effects' package:

require(effects)
model-lm(Y~A+B, data=mydataframe)

I am trying to build (for each predictor - A and then B) a plot of means on Y.
I was successful doing it like this - in one swoop:

ml.eff-allEffects(ml1, se=F)
plot(ml.eff,ylab=Title of Y)

Is it possible to show on my graph:
1. The actual Y values for each dot.
2. The title for A on the A graph and the title for B on the B graph -
but without having to do it one by one - because in reality I have
more predictors than one.

Thank you very much!


-- 
Dimitri Liakhovitski
MarketTools, Inc.
dimitri.liakhovit...@markettools.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] OT: A test with dependent samples.

2009-02-10 Thread Rolf Turner


I am appealing to the general collective wisdom of this
list in respect of a statistics (rather than R) question.  This question
comes to me from a friend who is a veterinary oncologist.  In a study  
that

she is writing up there were 73 cats who were treated with a drug called
piroxicam.  None of the cats were observed to be subject to vomiting  
prior

to treatment; 12 of the cats were subject to vomiting after treatment
commenced.  She wants to be able to say that the treatment had a  
``significant''

impact with respect to this unwanted side-effect.

Initially she did a chi-squared test.  (Presumably on the matrix
matrix(c(73,0,61,12),2,2) --- she didn't give details and I didn't  
pursue

this.) I pointed out to her that because of the dependence --- same 73
cats pre- and post- treatment --- the chi-squared test is inappropriate.

So what *is* appropriate?  There is a dependence structure of some sort,
but it seems to me to be impossible to estimate.

After mulling it over for a long while (I'm slow!) I decided that a
non-parametric approach, along the following lines, makes sense:

We have 73 independent pairs of outcomes (a,b) where a or b is 0
if the cat didn't barf, and is 1 if it did barf.

We actually observe 61 (0,0) pairs and 12 (0,1) pairs.

If there is no effect from the piroxicam, then (0,1) and (1,0) are
equally likely.  So given that the outcome is in {(0,1),(1,0)} the
probability of each is 1/2.

Thus we have a sequence of 12 (0,1)-s where (under the null hypothesis)
the probability of each entry is 1/2.  Hence the probability of this
sequence is (1/2)^12 = 0.00024.  So the p-value of the (one-sided) test
is 0.00024.  Hence the result is ``significant'' at the usual levels,
and my vet friend is happy.

I would very much appreciate comments on my reasoning.  Have I made any
goof-ups, missed any obvious pit-falls?  Gone down a wrong garden path?

Is there a better approach?

Most importantly (!!!): Is there any literature in which this  
approach is
spelled out?  (The journal in which she wishes to publish will almost  
surely
demand a citation.  They *won't* want to see the reasoning spelled  
out in

the paper.)

I would conjecture that this sort of scenario must arise reasonably  
often

in medical statistics and the suggested approach (if it is indeed valid
and sensible) would be ``standard''.  It might even have a name!  But I
have no idea where to start looking, so I thought I'd ask this  
wonderfully

learned list.

Thanks for any input.

cheers,

Rolf Turner

##
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

__
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] [ANN] ggplot2 + rggobi course. July 30-31, Washington DC

2009-02-10 Thread hadley wickham
Hi everyone,

We're very pleased to offer a two-day looking-at-data course.

July 30-31
Washington DC

Day one: static graphics with ggplot2
Day two: interactive graphics with rggobi and GGobi.

You can attend one day (for $295) or both days (for $550).
Student discounts are available.

All proceeds go to the GGobi Foundation to support graphics research.

Find out more, and book your tickets online at
http://lookingatdata.com

Regards,

Hadley Wickham
Dianne Cook


-- 
http://had.co.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] OT: A test with dependent samples.

2009-02-10 Thread David Winsemius
In the biomedical arena, at least as I learned from Rosner's  
introductory text, the usual approach to analyzing paired 2 x 2 tables  
is McNemar's test.


?mcnemar.test

 mcnemar.test(matrix(c(73,0,61,12),2,2))

McNemar's Chi-squared test with continuity correction

data:  matrix(c(73, 0, 61, 12), 2, 2)
McNemar's chi-squared = 59.0164, df = 1, p-value = 1.564e-14

The help page has citation to Agresti.

--
David winsemius
On Feb 10, 2009, at 4:33 PM, Rolf Turner wrote:



I am appealing to the general collective wisdom of this
list in respect of a statistics (rather than R) question.  This  
question
comes to me from a friend who is a veterinary oncologist.  In a  
study that
she is writing up there were 73 cats who were treated with a drug  
called
piroxicam.  None of the cats were observed to be subject to vomiting  
prior

to treatment; 12 of the cats were subject to vomiting after treatment
commenced.  She wants to be able to say that the treatment had a  
``significant''

impact with respect to this unwanted side-effect.

Initially she did a chi-squared test.  (Presumably on the matrix
matrix(c(73,0,61,12),2,2) --- she didn't give details and I didn't  
pursue

this.) I pointed out to her that because of the dependence --- same 73
cats pre- and post- treatment --- the chi-squared test is  
inappropriate.


So what *is* appropriate?  There is a dependence structure of some  
sort,

but it seems to me to be impossible to estimate.

After mulling it over for a long while (I'm slow!) I decided that a
non-parametric approach, along the following lines, makes sense:

We have 73 independent pairs of outcomes (a,b) where a or b is 0
if the cat didn't barf, and is 1 if it did barf.

We actually observe 61 (0,0) pairs and 12 (0,1) pairs.

If there is no effect from the piroxicam, then (0,1) and (1,0) are
equally likely.  So given that the outcome is in {(0,1),(1,0)} the
probability of each is 1/2.

Thus we have a sequence of 12 (0,1)-s where (under the null  
hypothesis)

the probability of each entry is 1/2.  Hence the probability of this
sequence is (1/2)^12 = 0.00024.  So the p-value of the (one-sided)  
test

is 0.00024.  Hence the result is ``significant'' at the usual levels,
and my vet friend is happy.

I would very much appreciate comments on my reasoning.  Have I made  
any
goof-ups, missed any obvious pit-falls?  Gone down a wrong garden  
path?


Is there a better approach?

Most importantly (!!!): Is there any literature in which this  
approach is
spelled out?  (The journal in which she wishes to publish will  
almost surely
demand a citation.  They *won't* want to see the reasoning spelled  
out in

the paper.)

I would conjecture that this sort of scenario must arise reasonably  
often
in medical statistics and the suggested approach (if it is indeed  
valid
and sensible) would be ``standard''.  It might even have a name!   
But I
have no idea where to start looking, so I thought I'd ask this  
wonderfully

learned list.

Thanks for any input.

cheers,

Rolf Turner

##
Attention:\ This e-mail message is privileged and confid...{{dropped: 
9}}


__
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] ifelse()

2009-02-10 Thread kayj

I have a problem with ifelse(), I do not understand how it works. 

 X-c(2,2,1,1,0,0)
 str(X)
 num [1:6] 2 2 1 1 0 0
 Y-ifelse(X0,1,0)
 Y
[1] 1 1 1 1 0 0


Can some one explain what is going on, I do not understand what ifelse is
doing in this case. Can someone explain the output Y.

Thanks

-- 
View this message in context: 
http://www.nabble.com/ifelse%28%29-tp21943309p21943309.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] ifelse()

2009-02-10 Thread kayj

I have a problem with ifelse(), I do not understand how it works. 

 X-c(2,2,1,1,0,0)
 str(X)
 num [1:6] 2 2 1 1 0 0
 Y-ifelse(X0,1,0)
 Y
[1] 1 1 1 1 0 0


Can some one explain what is going on, I do not understand what ifelse is
doing in this case. Can someone explain the output Y.

Thanks

-- 
View this message in context: 
http://www.nabble.com/ifelse%28%29-tp21943308p21943308.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] tcltk, tcltk2, Rcmdr, Mac OS X

2009-02-10 Thread Lawrence Hanser
Dear Colleagues,
When I try to install Rcmdr the following happens:

--
 library(Rcmdr)
Error in structure(.External(dotTclObjv, objv, PACKAGE = tcltk), class =
tclObj) :
  [tcl] invalid command name font.

Error : .onAttach failed in 'attachNamespace'
Error: package/namespace load failed for 'Rcmdr'
--

I wondered if this is because there is no tcltk package installed.  So I
tried:

--
 install.packages(tcltk)
Warning in install.packages(tcltk) :
  argument 'lib' is missing: using '/Users/hanser/Library/R/library'
Warning message:
package 'tcltk' is not available
--

Is there in fact a tcltk package?  Has it been replaced by tcltk2?

Help appreciated.

Regards,

Larry

[[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] ifelse()

2009-02-10 Thread David Winsemius
It is checking the series of values of X and returning a series of 1  
and 0's;

   1 if it meets your condition (X0) and
   0 if it doesn't.

What did you expect?

A more complex invocation might look like this:
 ifelse( X  0, 1:3, -1:-2)
[1]  1  2  3  1 -1 -2
Note the recycling of the elements of the yes and no arguments

Consider also:

 (X0)+0
[1] 1 1 1 1 0 0


--
David Winsemius
On Feb 10, 2009, at 4:44 PM, kayj wrote:



I have a problem with ifelse(), I do not understand how it works.


X-c(2,2,1,1,0,0)
str(X)

num [1:6] 2 2 1 1 0 0

Y-ifelse(X0,1,0)
Y

[1] 1 1 1 1 0 0




Can some one explain what is going on, I do not understand what  
ifelse is

doing in this case. Can someone explain the output Y.

Thanks

--
View this message in context: 
http://www.nabble.com/ifelse%28%29-tp21943309p21943309.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-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] ifelse()

2009-02-10 Thread Aiste Aistike
Hello,

ifelse checks condition whether X (or, ina fact every value in X) is greater
than 0. If it is 1 is assigned and if it isn't then 0.

2 and 1 are greater than 0, therefore the first four values of Y are 1. 0
isn't greater than 0, therefore the last two values of Y are 0.

2009/2/10 kayj kjaj...@yahoo.com


 I have a problem with ifelse(), I do not understand how it works.

  X-c(2,2,1,1,0,0)
  str(X)
  num [1:6] 2 2 1 1 0 0
  Y-ifelse(X0,1,0)
  Y
 [1] 1 1 1 1 0 0
 

 Can some one explain what is going on, I do not understand what ifelse is
 doing in this case. Can someone explain the output Y.

 Thanks

 --
 View this message in context:
 http://www.nabble.com/ifelse%28%29-tp21943308p21943308.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.htmlhttp://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.


  1   2   >