[R] FW: Completing Unordered Categorical missing variables using package mi

2015-06-18 Thread IOANNA IOANNOU
 

Hello all, 

 

A perhaps simple question. I am trying to complete unordered categorical
missing data using mi package. There are two variables with missing data:
Mat and Use. The problem is that the Use has several categories and somehow
this means I can't plot the results as I get this error. Any idea how to fix
the problem?

Any help much appreciated, 

Best, 

Ioanna

 

new-read(Sample.csv)

new$Use-factor(new$Use)

MissingData - missing_data.frame(new)

MissingData - change(MissingData, y = DS, what = type, to =
ordered-categorical)

 

# STEP 3: look deeper

summary(MissingData)

summary(MissingData@patterns)

show(MissingData)

hist(MissingData)

 

 

# STEP 4: impute

## Not run: 

IMPsample - mi(MissingData)

 

 

#STEP5: diagnostics

Plot(IMPsample)

 

Error in `rownames-`(`*tmp*`, value = c(Oc11, Oc12, Oc13, Oc14,  : 

  length of 'dimnames' [1] not equal to array extent

 

Data

new

  DS  Use Material SurfaceIM

31237  3 Oc22 Wood   95.710401 3.148

48947  1 Oc19 Wood  124.427200 1.762

7038   5 Oc11 Wood  142.113800 1.890

8150   3 Oc32Steel   70.709451 2.530

43471  1 Oc19   NA3.609650 1.597

24815  5 Oc11 Wood  121.541500 3.638

8683   2 Oc11 Wood   80.341550 2.242

47303  1 Oc39   NA   19.018000 1.410

27467  5 Oc11 Wood   86.799050 3.782

35026  2 Oc11 Wood  113.185700 2.565

50635  5 Oc19   NA   28.169550 3.887

9459   2 Oc11 Wood   40.825350 1.779

14042  2 Oc13Steel   36.233100 4.293

17393  3 Oc11 Wood   56.069700 2.833

21157  5 Oc11 Wood   89.254700 4.958

42345  2 Oc19   NA2.973600 0.468

4372   5 Oc11 Wood7.872750 3.950

16654  5 Oc11 Wood   75.315600 6.395

47335  1 Oc19   NA   14.564400 1.781

49609  5 Oc19   NA   17.249000 3.545

4973   5 Oc19 Wood   28.511699 3.243

44784  2 Oc19   NA4.473000 2.328

29581  5 Oc11 Wood   96.884250 4.378

31949  3 Oc11 Wood  126.996500 3.225

7352   5 Oc11 Wood   71.905200 3.430

43139  1 Oc19   NA  133.573551 1.849

43350  2 Oc19   NA3.739350 1.205

11592  2 Oc11 Wood   72.146800 2.906

33767  3 Oc11 Wood   91.578001 2.905

51748  5 Oc39   NA9.108800 3.138

21160  5 Oc12 Wood  100.677100 4.268

34390  2 Oc12 Wood  120.401199 1.603

23255  5 Oc12 Wood  122.333801 5.557

38414  2 Oc21Steel   69.686100 3.021

48810  3 Oc29 Wood   79.609950 3.670

44611  2 Oc19   NA   15.328000 1.480

17905  3 Oc11 Wood   61.188500 1.857

35509  2 Oc11 Wood  160.180349 2.511

10252  2 Oc11 Wood   94.414799 1.446

47152  2 Oc19 Wood   12.160450 2.285

43221  2 Oc11 Wood   70.796299 1.361

32569  3 Oc11 Wood   97.269300 2.842

5671   5 Oc11 Wood   84.672250 3.050

1157   3 Oc11 Wood   79.297800 2.612

3441   2 Oc11 Wood  112.435650 2.105

36678  5 Oc21 Wood   27.223500 4.017

52241  5 Oc19 Wood3.946150 3.373

4688   5 Oc11 Wood   68.009700 3.766

42933  2 Oc19 Wood3.946801 2.039

31048  5 Oc11 Wood   25.172301 3.633

28660  1 Oc11 Wood  133.387099 1.285

22726  5 Oc12 Wood  216.952900 7.550

22397  5 Oc11 Wood  115.320750 5.825

41008  3 Oc11 Wood   97.253199 1.960

49054  3 Oc21   NA8.542800 1.329

5594   5 Oc41   RC  264.505000 3.185

45379  3 Oc41 Wood   39.357100 2.909

17498  3 Oc11 Wood   45.544750 1.459

1176   5 Oc11 Wood   87.020400 2.750

33055  1 Oc11 Wood   55.777250 1.437

37071  5 Oc32 Wood  201.629599 3.287

53813  5 Oc19 Wood   56.919600 4.322

11037  2 Oc11 Wood  107.886600 1.479

14453  2 Oc11 Wood  106.369949 2.508

3767   1 Oc11 Wood   71.325500 2.012

52303  5 Oc29   NA8.916150 6.092

19706  5 Oc19 Wood   25.936699 6.417

37658  5 Oc14 Wood   65.761651 4.317

26195  1 Oc12 Wood   82.510849 0.835

35808  3 Oc13 Wood   54.798851 2.337

6035   5 Oc12 Wood  286.075700 3.905

33383  3 Oc11 Wood   96.809150 2.560

43497  1 Oc19   NA   13.039000 1.103

41777  5   NA   NA   47.153349 2.658

12024  2 Oc11 Wood   19.851000 2.567

39538  1 Oc19   NA   31.996200 2.108

15553  3 Oc19 Wood  197.062201 2.559

31522  3 Oc11 Wood  129.499700 2.906

11916  2 Oc11 Wood   58.358951 2.939

9688   2 Oc11 Wood  106.568201 1.822

1690   3 Oc11 Wood  202.613700 2.290

9773 Oc11 Wood  179.321800 1.987

12410  2 Oc14Steel  108.682100 2.821

52428  5 Oc19   NA   36.041699 6.042

14109  2 Oc21Steel  130.929300 4.178

52769  5 Oc31 Wood   18.525650 2.187

11324  1 Oc11 Wood   94.108351 1.456

12394  2 Oc21   RC 1836.975800 2.415

35991  3 Oc11 Wood  114.716550 2.664

4006   5 Oc39Steel  309.854000 4.041

43404  2 Oc19   RC   27.745400 1.772

12680  1 Oc21   RC  327.789699 2.669

43607  1 Oc29   NA5.812499 2.406

33590  3 Oc11 Wood8.115450 3.183

16230  5 Oc32 Wood  610.293850 6.312

19815  5 Oc11 Wood   89.220350 6.122

4520   

Re: [R] Polysomnographic data analysis with R?

2015-06-18 Thread Jim Lemon
Hi Charles,
As I don't know what sort of data you are using, I can only guess. If
you want to visualize the sleep patterns and events, it is fairly easy
to extract these from the sleep example on the EDF format page and
display them.

sleep_stages-list(labels=c(Sleep stage W,
 Sleep stage N1,
 Sleep stage N2,
 Sleep stage N3,
 Sleep stage N2,
 Sleep stage N3,
 Sleep stage N2),
 starts=c(0,660,960,1140,1440,1620,1890),
 ends=c(660,960,1140,1440,1620,1890,1920))
library(plotrix)
gantt.chart(sleep_stages,vgridlab=seq(0,2000,by=100),
 vgridpos=seq(0,2000,by=100),main=Sleep recording,
 taskcolors=2:5)
abline(v=c(660,742,993,1019,1526,1620,1634))
sleep_events-c(Lights off,Turning right side - back,
 Limb movement R+L leg,Limb movement R leg,
 Obstructive apnea,Obstructive apnea,
 Turning back - left side)
staxlab(side=1,at=c(660,742,993,1019,1526,1620,1634),
 labels=sleep_events,pos=0.555,
 top.line=1,nlines=4,cex=0.7)

Jim


On Wed, Jun 17, 2015 at 10:15 PM, Charles Novaes de Santana
charles.sant...@gmail.com wrote:
 Dear Jim,

 Thank you for your response. Yes, it is the European Data Format you
 mention. Actually we can read the data correctly, but I was wondering if
 there is any package that can identify different sleep phases automatically
 based on the data. I supposed such a package does not exist, it is really
 difficult to automatize the identification of sleep phases based only on
 data, but I asked here just in case.

 Thanks for your attention!

 Best,

 Charles

 On 17 June 2015 at 13:46, Jim Lemon drjimle...@gmail.com wrote:

 Hi Charles,
 This looks like the European Data Format (EDF and EDF+), which has a
 complete file specification. If there is no existing R package, it
 might be possible to write an import function from the specification,
 something like the functions in the foreign package.

 Jim


 On Wed, Jun 17, 2015 at 4:55 AM, Charles Novaes de Santana
 charles.sant...@gmail.com wrote:
  Dear all,
 
  Do you know if there is any R package or function we can use to analyze
  polysomnographic data?
 
  For example, something that can import an EDF file (or in a different
  format) and can give some properties of the polysomnographic records
  like
  periods of different sleep phases, etc.
 
  I looked for it in the web and I didn't find. But maybe I used the wrong
  key-words.
 
  Any help will be much appreciated!
 
  Best,
 
  Charles
  --
  Um axé! :)
 
  --
  Charles Novaes de Santana, PhD
  http://www.imedea.uib-csic.es/~charles
 
  [[alternative HTML version deleted]]
 
  __
  R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
  http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.




 --
 Um axé! :)

 --
 Charles Novaes de Santana, PhD
 http://www.imedea.uib-csic.es/~charles

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

[R] help for lay person assisting R user with disability

2015-06-18 Thread Courtney Bryant
Good Morning,
I am currently working with a disabled R user who is a student here at CMU.  
The student has both sight and mobility issues.  The student has asked for an 
assistant who is well versed in R to enter data for her, which we are having a 
hard time finding.  I would like information from R developers/users about 
how/how well R interfaces with Excel (an easier skill set to find!)   In your 
opinion, could it be as easy as uploading data from excel into R?  

Also, do you know of a way to enlarge the R interface or otherwise assist in 
making the program accessible to a low vision person?  My  limited 
understanding leads me to believe that screen magnifiers like zoom text don't 
work particularly well.  If you have information on that, I would very much 
appreciate it.  

Thanks for your help and for bearing with me!
Courtney



Courtney Bryant, EOS Specialist 
Equal Opportunity Services, Human Resources
Carnegie Mellon University
412-268-3930 | cbry...@andrew.cmu.edu 

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to round only one df row how to keep 3rd sigdif if zero

2015-06-18 Thread PIKAL Petr
Hi

You need to distinguish between an object and printing an object on console. 
When you print an object you can use several options for formating.

?sprintf, ?formatC

 formatC(t(a), digits=1, format=f)
  [,1]   [,2]   [,3]
count 1.0  2.0  3.0
rate  16.7 33.3 50.0


Also when you transpose a the result is not data frame but matrix.

 str(t(a))
 num [1:2, 1:3] 1 16.7 2 33.3 3 50
 - attr(*, dimnames)=List of 2
  ..$ : chr [1:2] count rate
  ..$ : NULL
 str(a)
'data.frame':   3 obs. of  2 variables:
 $ count: num  1 2 3
 $ rate : num  16.7 33.3 50


If you used google or other internet search options you would get plenty of 
results yourself.

try formatting numbers R

Cheers
Petr

 -Original Message-
 From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of
 bcrombie
 Sent: Thursday, June 18, 2015 3:09 PM
 To: r-help@r-project.org
 Subject: [R] How to round only one df row  how to keep 3rd sigdif if
 zero

 # How do I round only one row of a dataframe?
 # After transposing a dataframe of counts  rates, all values took on
 the most # of signif digits in the dataset (rates), but I want counts
 to remain only one digit.
 # Also, how can I keep 3 significant digits in R when the 3rd is a
 zero?
 count - c(1, 2, 3)
 rate - c(16.7, 33.3, 50.0)
 a - data.frame(count,rate)
 a
 # count rate
 # 1 1 16.7
 # 2 2 33.3
 # 3 3 50.0
 a - t(a)
 a
 # [,1] [,2] [,3]
 # count  1.0  2.03
 # rate  16.7 33.3   50



 --
 View this message in context: http://r.789695.n4.nabble.com/How-to-
 round-only-one-df-row-how-to-keep-3rd-sigdif-if-zero-tp4708819.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-
 guide.html
 and provide commented, minimal, self-contained, reproducible code.


Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny 
pouze jeho adresátům.
Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně 
jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze 
svého systému.
Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email 
jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či 
zpožděním přenosu e-mailu.

V případě, že je tento e-mail součástí obchodního jednání:
- vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a 
to z jakéhokoliv důvodu i bez uvedení důvodu.
- a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; 
Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce 
s dodatkem či odchylkou.
- trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným 
dosažením shody na všech jejích náležitostech.
- odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost 
žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně 
pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně 
osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi 
či osobě jím zastoupené známá.

This e-mail and any documents attached to it may be confidential and are 
intended only for its intended recipients.
If you received this e-mail by mistake, please immediately inform its sender. 
Delete the contents of this e-mail with all attachments and its copies from 
your system.
If you are not the intended recipient of this e-mail, you are not authorized to 
use, disseminate, copy or disclose this e-mail in any manner.
The sender of this e-mail shall not be liable for any possible damage caused by 
modifications of the e-mail or by delay with transfer of the email.

In case that this e-mail forms part of business dealings:
- the sender reserves the right to end negotiations about entering into a 
contract in any time, for any reason, and without stating any reasoning.
- if the e-mail contains an offer, the recipient is entitled to immediately 
accept such offer; The sender of this e-mail (offer) excludes any acceptance of 
the offer on the part of the recipient containing any amendment or variation.
- the sender insists on that the respective contract is concluded only upon an 
express mutual agreement on all its aspects.
- the sender of this e-mail informs that he/she is not authorized to enter into 
any contracts on behalf of the company except for cases in which he/she is 
expressly authorized to do so in writing, and such authorization or power of 
attorney is submitted to the recipient or the person represented by the 
recipient, or the existence of such authorization is known to the recipient of 
the person represented by the recipient.
__
R-help@r-project.org mailing 

Re: [R] Cross tabulation with top one variable and side as multiple variables

2015-06-18 Thread David L Carlson
They do not match because xtabs() in R produces a multidimensional array (one 
dimension for each variable). Looking at your spreadsheet on nabble, it appears 
that SPSS is just creating 4 crosstabulations with TREND against each of the 
other variables. That is easily done in R, but for tested code, you need to 
give us reproducible data using dput(). I get an error using read.spss() on 
your uploaded file. You should also read some of the extensive free 
documentation available on R. The ftable() function creates a two dimensional 
representation of that 5-dimensional array. But your spreadsheet is just a 
stack of two-dimensional tables. You could get there with the margin.table() 
function, but unless you really need the 5-dimensional array, you probably want 
something more like:

rowvars - c(AGET, SEXT, EDUCRT,  JOBRT)
table.lst - lapply(rowvars, function(x) xtabs(~x+TREND))

That would give you a list containing a crosstabulation table between each of 
the variables and TREND. A spreadsheet with 2000 tables seems a bit unwieldy so 
you might want to give some thought to what you really want as output.

-
David L Carlson
Department of Anthropology
Texas AM University
College Station, TX 77840-4352

-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of jagadishpchary
Sent: Thursday, June 18, 2015 1:46 AM
To: r-help@r-project.org
Subject: Re: [R] Cross tabulation with top one variable and side as multiple 
variables

I think my explanation in the post is not giving the full details on the job
to be done. Sorry for that. Here is what I am doing..

1.  I have a SPSS data set with more than 2000 variables. However for test
purpose I have created a temporary data set with 5 variables which I am
reading it to R environment (Attached the test.sav file).
2.  There is a variable called “TREND” which has the year data. So all I 
need
to do is cross tabulate the variables with this Trend variable. 
In SPSS the syntax would be

CTABLES
/VLABELS VARIABLES =ALL DISPLAY=LABEL
/TABLES (AGET +SEXT +EDUCRT +JOBRT ) [COUNT F40.0] by TREND.

The final cross tabulation results are placed in the attached excel report
with sheet name “Results”.

As I am new to R  - I tried searching the forums for the cross tabulation
with top variable constant and multiple variables as side however I could
not find it. Anyhow I tried using the below syntax :

Xtabs ( ~ AGET +SEXT +EDUCRT +JOBRT + TREND, data=mydata)
summary(~AGET +SEXT +EDUCRT +JOBRT, data= mydata, fun=table)
ftable (mydata, row.vars=c(AGET ,  SEXT ,  EDUCRT  , “JOBRT”),
col.vars=TREND)

the results are not identical to what I am getting in SPSS

Hence I would request to suggest me a R code that helps me in getting the
results as shown in the attached excel report with sheet name “Results”.
Test.sav http://r.789695.n4.nabble.com/file/n4708799/Test.sav  
Cross_tabulation.xlsx
http://r.789695.n4.nabble.com/file/n4708799/Cross_tabulation.xlsx  




--
View this message in context: 
http://r.789695.n4.nabble.com/Cross-tabulation-with-top-one-variable-and-side-as-multiple-variables-tp4708379p4708799.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] help for lay person assisting R user with disability

2015-06-18 Thread David L Carlson
You may have people knowledgeable about R there at Carnegie Mellon since it 
hosts a mirror for R software (one of 18 in the US). As Petr pointed out it is 
relatively easy to transfer information from an Excel spreadsheet to R by 
cutting and pasting (the method he suggested is for Windows computers) or by 
saving the file in a tab delimited or comma separated format so data entry 
should not be a problem assuming the data are arranged in a consistent format. 

As for the interface, there are a number of ways of interacting with R, but the 
default method involves a command window that allows you to type commands. On 
Windows it is called the R Console and the GUI Preferences option on the Edit 
menu tab allows you to choose the font, its size, and the number of rows and 
columns. For example changing the default size of 10 to 24 makes the type and 
the window larger. If the settings are saved, they should be preserved when the 
program is restarted.

There are also some graphical user interfaces for R that may be easier to use 
such as R Commander.

-
David L Carlson
Department of Anthropology
Texas AM University
College Station, TX 77840-4352

-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of PIKAL Petr
Sent: Thursday, June 18, 2015 10:04 AM
To: Courtney Bryant; r-help@R-project.org
Subject: Re: [R] help for lay person assisting R user with disability

Hi

I believe that others come with more elaborated answers.

Probably easiest way how to transfer Excel data to R is:

select rectangular area you want to transfer, preferably with sensible header.

pres Ctrl-C

In R enter command
object - read.delim(clipboard)

possibly with header or NA options.

However this approach is not reproducible (you lose information about data 
source in .Rhistory), so there are other ways (e.g. through saved CSV file) but 
they can be more tricky.

Cheers
Petr


 -Original Message-
 From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of
 Courtney Bryant
 Sent: Thursday, June 18, 2015 4:33 PM
 To: r-help@R-project.org
 Subject: [R] help for lay person assisting R user with disability

 Good Morning,
 I am currently working with a disabled R user who is a student here at
 CMU.  The student has both sight and mobility issues.  The student has
 asked for an assistant who is well versed in R to enter data for her,
 which we are having a hard time finding.  I would like information from
 R developers/users about how/how well R interfaces with Excel (an
 easier skill set to find!)   In your opinion, could it be as easy as
 uploading data from excel into R?

 Also, do you know of a way to enlarge the R interface or otherwise
 assist in making the program accessible to a low vision person?  My
 limited understanding leads me to believe that screen magnifiers like
 zoom text don't work particularly well.  If you have information on
 that, I would very much appreciate it.

 Thanks for your help and for bearing with me!
 Courtney



 Courtney Bryant, EOS Specialist
 Equal Opportunity Services, Human Resources Carnegie Mellon University
 412-268-3930 | cbry...@andrew.cmu.edu

 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-
 guide.html
 and provide commented, minimal, self-contained, reproducible code.


Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny 
pouze jeho adresátům.
Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně 
jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze 
svého systému.
Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email 
jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či 
zpožděním přenosu e-mailu.

V případě, že je tento e-mail součástí obchodního jednání:
- vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a 
to z jakéhokoliv důvodu i bez uvedení důvodu.
- a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; 
Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce 
s dodatkem či odchylkou.
- trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným 
dosažením shody na všech jejích náležitostech.
- odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost 
žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně 
pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně 
osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi 
či osobě jím zastoupené známá.

This e-mail and any documents attached to it may be confidential and are 
intended only for its intended 

Re: [R] help for lay person assisting R user with disability

2015-06-18 Thread Gabor Grothendieck
On Thu, Jun 18, 2015 at 10:32 AM, Courtney Bryant cbry...@andrew.cmu.edu
wrote:

 Good Morning,
 I am currently working with a disabled R user who is a student here at
 CMU.  The student has both sight and mobility issues.  The student has
 asked for an assistant who is well versed in R to enter data for her, which
 we are having a hard time finding.  I would like information from R
 developers/users about how/how well R interfaces with Excel (an easier
 skill set to find!)   In your opinion, could it be as easy as uploading
 data from excel into R?

 Also, do you know of a way to enlarge the R interface or otherwise assist
 in making the program accessible to a low vision person?  My  limited
 understanding leads me to believe that screen magnifiers like zoom text
 don't work particularly well.  If you have information on that, I would
 very much appreciate it.

 Thanks for your help and for bearing with me!
 Courtney


1. If the data file is in the form of a rectangular table with rows and
columns and the first row is a header row then if, in Excel, it is saved as
a .csv file it can be read into R like this:

   DF - read.csv(/Users/JoeDoe/myspreadsheet.csv)

2. The openxlsx, readxl (and a number of other packages) can alternetely be
used to directly read in an xls or xlsx file, e.g.

  install.packages(readxl)
  library(readxl)
  DF - read_excel(/Users/JoeDoe/myspreadsheet.xlsx)

3. The Windows magnifier that comes with Windows does work with R.

-- 
Statistics  Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] adjusted values for CI in a within-subjects design

2015-06-18 Thread Ernesto Guerra
Dear R-ers,
I am trying to adjust the values of a within-items, within-subjects design
(the experimental conditions are within subjects), to calculate between
subjects confidence intervals (CI). I am following the recommendations from
O'Brien  Cousineau (2014; see also Cousineau, 2005; Morey, 2008 for
similar solutions). So, formula is the following.

# formula for corrected CI:
# Y = Xsj - Xj. + X..
# where...
# Xsj = single value of a trial of a time window per participant
# Xj. = participants mean on that conditions across trials
# X.. = overall mean on that condition
# W = sqrt(J/(J-1))*(Y - Y.j) + Y.j
# where...
# J = sqrt(f/(f-1))
# f = total number of measures per subject
# Y.j = mean for a condition across participants
# W = the corrected value from which we can calculate the CI between
subjects.

I've written a code that does that using a dataset of random values (0,1),
but with the same structure that the actual dataset for which I hope to
calculate corrected CI.

fixprop subj trial time
11 11
01 12
11 13
01 14
01 15
01 16

The experiments deliver the time course of an effect (similar to
longitudinal data), meaning, we have N time steps in which the effect is
modulated. I've tested the script with this dummy dataset of 4
participants, 10 items, and 400 time steps, and it works nicely. The tricky
part here is that in the real experiments, we have many more participants,
items and time steps. Thus, the adjustment needs to be done many many
times.

With the dummy dataset the process takes about 6 seconds,
 proc.time() - ptm
   user  system elapsed
   4.530.066.03

but when I've added a bit more data (10 participants, 125 trials, 400 time
steps), the scritp takes more than an hour,
 proc.time() - ptm
   user  system elapsed
3483.64  879.31 4456.86

So, I don't even want to try doing this with real data, in which we have
thousands of times steps, and generally over 50 participants (although less
items in general, perhaps 40 or 50).

QUESTION: does anyone know how could I optimize my script, such as it does
not take forever?

Here is the script.

library(doBy)
library(plotrix)
library(matrixStats)
library(doBy)
library(bear)
library(ggplot2)
library(reshape)

rm(list=ls())   # clear memory
setwd (??) # set directory
infile = test.txt#
test.txt is the name of the fixation report
data = read.delim(file=infile, header=T, sep=\t)  # load the file
data = data[with(data, order(subj,trial)), ]# data need to
be organized by part, by trials
head(data)

subj = unique(data$subj)
np=length(subj); np # how many participants
trial = unique(data$trial)
nt=length(trial); nt # how many items
timewindows = unique(data$time)
twsn=length(timewindows); twsn # how many time steps

critcoln = 1 #column in which we find the dependent variable
ncoln = 4 #total number of columns of your file
f = 2 #total number of conditions per subject

tm - cbind(rep(c(critcoln:twsn), each=(nt*np)))
newvar - cbind(rep(c((critcoln+ncoln):(critcoln+ncoln)),
each=(nt*np*twsn)))
subj - cbind(rep(1:np, each=nt, times=twsn))
count -cbind(rep(c(1:1), each=(nt*np*twsn)))



X..data = summaryBy(fixprop ~ time, FUN = mean, keep.names=T, data=data)
Xj.data = summaryBy(fixprop ~ subj + time, FUN = mean, keep.names=T,
data=data)

ptm - proc.time()
prev_tw = 0
prev_subj = 0
j = 0
t = 0
for (i in 1:(nrow(data)))
{
  curr_tw = tm[i]
  curr_subj = subj[i]
  if (prev_subj  curr_subj)
  {j = j + 1}
  Y. = data[i,critcoln] - Xj.data[j,3]
  if (prev_tw  curr_tw)
  {t = t + 1}
  Y = Y. + X..data[t,2]
  data[i,newvar[i]] - Y
  prev_tw = curr_tw
  prev_subj = curr_subj
}
proc.time() - ptm
colnames(data)[ncoln+1] - 'fixprop_adj'

Y.jdata = summaryBy(fixprop_adj ~ subj + time, FUN = mean, keep.names=T,
data=data)

J = sqrt(f/(f-1)) #correction factor
newvar - cbind(rep(c((critcoln+ncoln+1):(critcoln+ncoln+1)),
each=(nt*np*twsn)))

prev_tw = 0
t = 0
for (i in 1:(nrow(data)))
{
  curr_tw = tm[i]
  if (prev_tw  curr_tw)
  {t = t + 1}
  W = J*((data[i,ncoln+1]) - Y.jdata[t,3]) + Y.jdata[t,3]
  data[i,newvar[i]] - W
  prev_tw = curr_tw
}
proc.time() - ptm
colnames(data)[ncoln+2] - 'fixprop_final'

That's all. The processes that really take long are the for loops, I know
loops are not the best, but I couldn't think of a process that can do this
better so far...

Any comments, suggestions, criticisms and questions are welcome...
Cheers,
Ernesto.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] How to round only one df row how to keep 3rd sigdif if zero

2015-06-18 Thread bcrombie
# How do I round only one row of a dataframe?
# After transposing a dataframe of counts  rates, all values took on the
most # of signif digits in the dataset (rates), but I want counts to remain
only one digit.
# Also, how can I keep 3 significant digits in R when the 3rd is a zero?
count - c(1, 2, 3)
rate - c(16.7, 33.3, 50.0)
a - data.frame(count,rate)
a
# count rate
# 1 1 16.7
# 2 2 33.3
# 3 3 50.0
a - t(a)
a
# [,1] [,2] [,3]
# count  1.0  2.03
# rate  16.7 33.3   50



--
View this message in context: 
http://r.789695.n4.nabble.com/How-to-round-only-one-df-row-how-to-keep-3rd-sigdif-if-zero-tp4708819.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] help for lay person assisting R user with disability

2015-06-18 Thread PIKAL Petr
Hi

I believe that others come with more elaborated answers.

Probably easiest way how to transfer Excel data to R is:

select rectangular area you want to transfer, preferably with sensible header.

pres Ctrl-C

In R enter command
object - read.delim(clipboard)

possibly with header or NA options.

However this approach is not reproducible (you lose information about data 
source in .Rhistory), so there are other ways (e.g. through saved CSV file) but 
they can be more tricky.

Cheers
Petr


 -Original Message-
 From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of
 Courtney Bryant
 Sent: Thursday, June 18, 2015 4:33 PM
 To: r-help@R-project.org
 Subject: [R] help for lay person assisting R user with disability

 Good Morning,
 I am currently working with a disabled R user who is a student here at
 CMU.  The student has both sight and mobility issues.  The student has
 asked for an assistant who is well versed in R to enter data for her,
 which we are having a hard time finding.  I would like information from
 R developers/users about how/how well R interfaces with Excel (an
 easier skill set to find!)   In your opinion, could it be as easy as
 uploading data from excel into R?

 Also, do you know of a way to enlarge the R interface or otherwise
 assist in making the program accessible to a low vision person?  My
 limited understanding leads me to believe that screen magnifiers like
 zoom text don't work particularly well.  If you have information on
 that, I would very much appreciate it.

 Thanks for your help and for bearing with me!
 Courtney



 Courtney Bryant, EOS Specialist
 Equal Opportunity Services, Human Resources Carnegie Mellon University
 412-268-3930 | cbry...@andrew.cmu.edu

 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-
 guide.html
 and provide commented, minimal, self-contained, reproducible code.


Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny 
pouze jeho adresátům.
Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně 
jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze 
svého systému.
Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email 
jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či 
zpožděním přenosu e-mailu.

V případě, že je tento e-mail součástí obchodního jednání:
- vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a 
to z jakéhokoliv důvodu i bez uvedení důvodu.
- a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; 
Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce 
s dodatkem či odchylkou.
- trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným 
dosažením shody na všech jejích náležitostech.
- odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost 
žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně 
pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně 
osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi 
či osobě jím zastoupené známá.

This e-mail and any documents attached to it may be confidential and are 
intended only for its intended recipients.
If you received this e-mail by mistake, please immediately inform its sender. 
Delete the contents of this e-mail with all attachments and its copies from 
your system.
If you are not the intended recipient of this e-mail, you are not authorized to 
use, disseminate, copy or disclose this e-mail in any manner.
The sender of this e-mail shall not be liable for any possible damage caused by 
modifications of the e-mail or by delay with transfer of the email.

In case that this e-mail forms part of business dealings:
- the sender reserves the right to end negotiations about entering into a 
contract in any time, for any reason, and without stating any reasoning.
- if the e-mail contains an offer, the recipient is entitled to immediately 
accept such offer; The sender of this e-mail (offer) excludes any acceptance of 
the offer on the part of the recipient containing any amendment or variation.
- the sender insists on that the respective contract is concluded only upon an 
express mutual agreement on all its aspects.
- the sender of this e-mail informs that he/she is not authorized to enter into 
any contracts on behalf of the company except for cases in which he/she is 
expressly authorized to do so in writing, and such authorization or power of 
attorney is submitted to the recipient or the person represented by the 
recipient, or the existence of such authorization is known to the recipient of 
the person represented by the 

Re: [R] help for lay person assisting R user with disability

2015-06-18 Thread Liz Hare
Hi Courtney and John,

The RStudio environment mentioned below will not work with speech output (I 
tried with Window-Eyes awhile ago). Some of my clients use it but I have no 
experience with it. Since the student is partially sighted, they might be able 
to customize the environment with big fonts and contrast, I’m just not sure.

Using a screen reader like Window-Eyes, the student could use the R GUI 
environment, although it’s a little frustrating because it doesn’t speak a lot 
and you need to use the mouse keys a lot.

The other option if you have to stick with Windows  is to run R at the command 
prompt, which makes interaction slightly easier but you’d have to figure out 
how to log the output.

What is being recommended for the rest of the students in the class? Ideally, 
this student’s experience should be as close as possible to the others’. 

Liz
 On Jun 18, 2015, at 12:17 PM, John McKown john.archie.mck...@gmail.com 
 wrote:
 
 On Thu, Jun 18, 2015 at 9:32 AM, Courtney Bryant cbry...@andrew.cmu.edu
 wrote:
 
 Good Morning,
 I am currently working with a disabled R user who is a student here at
 CMU.  The student has both sight and mobility issues.  The student has
 asked for an assistant who is well versed in R to enter data for her, which
 we are having a hard time finding.  I would like information from R
 developers/users about how/how well R interfaces with Excel (an easier
 skill set to find!)   In your opinion, could it be as easy as uploading
 data from excel into R?
 
 Also, do you know of a way to enlarge the R interface or otherwise assist
 in making the program accessible to a low vision person?  My  limited
 understanding leads me to believe that screen magnifiers like zoom text
 don't work particularly well.  If you have information on that, I would
 very much appreciate it.
 
 Thanks for your help and for bearing with me!
 Courtney
 
 
 I am a bit confused (a normal condition for me). Is the student writing R
 code or is the student running a application written in R? Also, since you
 mentioned Excel, I am assuming that the student is using a PC running
 Windows as opposed to Linux or a Mac.
 
 If the student is writing R code, then I'd suggest that your computer
 support person install Rstudio. It is cost free and can be downloaded here:
 http://www.rstudio.com/ . The installer can then customize Rstudio to use a
 really large font, if that would be helpful. Please forgive my lack of
 knowledge about accessibility issues. If the student has trouble typing
 (mobility issue?), this likely won't help. Would a speech to text / text to
 speech interface help instead of a screen magnifier? I know next to nothing
 about these tools, other than that they exist.
 
 ===
 
 If the student is running an R application (which is what enter data for
 her implies to me), then any accessibility issues would need to be
 addressed in the application itself. But I don't understand why a data
 entry assistant would need any skills in R itself in order to enter data
 into it. But without knowing more, that's about all that I can say. One
 thought: CMU has a college teaching electrical and computer engineering.
 Depending on what that means, perhaps someone from that college (professor,
 TA, or grad student) could see what your student is doing and perhaps have
 some insights on how to help. Or is there a computer club on campus where
 some geeky student might be found? You might look here:
 http://www.club.cc.cmu.edu/ If these are true geeks (and the web site
 sounds promising), then a lure of beer  pizza would likely be irresistible
 grin.
 
 ===
 
 For interfacing R with Excel, you might want to look at RExcel here:
 http://rcom.univie.ac.at/download.html#RExcel . It has a free student
 version. But is this more for an Excel user who wants to use R for
 analysis, not an R user wanting to use Excel for data entry.
 
 
 
 -- 
 Yoda of Borg, we are. Futile, resistance is, yes. Assimilated, you will be.
 
 My sister opened a computer store in Hawaii. She sells C shells down by the
 seashore.
 If someone tell you that nothing is impossible:
 Ask him to dribble a football.
 
 He's about as useful as a wax frying pan.
 
 10 to the 12th power microphones = 1 Megaphone
 
 Maranatha! 
 John McKown
 
   [[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

Liz Hare, PhD
Dog Genetics LLC
dogg...@earthlink.net
http://www.doggenetics.com http://www.doggenetics.com/

[[alternative HTML version deleted]]

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

Re: [R] help for lay person assisting R user with disability

2015-06-18 Thread John McKown
On Thu, Jun 18, 2015 at 9:32 AM, Courtney Bryant cbry...@andrew.cmu.edu
wrote:

 Good Morning,
 I am currently working with a disabled R user who is a student here at
 CMU.  The student has both sight and mobility issues.  The student has
 asked for an assistant who is well versed in R to enter data for her, which
 we are having a hard time finding.  I would like information from R
 developers/users about how/how well R interfaces with Excel (an easier
 skill set to find!)   In your opinion, could it be as easy as uploading
 data from excel into R?

 Also, do you know of a way to enlarge the R interface or otherwise assist
 in making the program accessible to a low vision person?  My  limited
 understanding leads me to believe that screen magnifiers like zoom text
 don't work particularly well.  If you have information on that, I would
 very much appreciate it.

 Thanks for your help and for bearing with me!
 Courtney


I am a bit confused (a normal condition for me). Is the student writing R
code or is the student running a application written in R? Also, since you
mentioned Excel, I am assuming that the student is using a PC running
Windows as opposed to Linux or a Mac.

If the student is writing R code, then I'd suggest that your computer
support person install Rstudio. It is cost free and can be downloaded here:
http://www.rstudio.com/ . The installer can then customize Rstudio to use a
really large font, if that would be helpful. Please forgive my lack of
knowledge about accessibility issues. If the student has trouble typing
(mobility issue?), this likely won't help. Would a speech to text / text to
speech interface help instead of a screen magnifier? I know next to nothing
about these tools, other than that they exist.

===

If the student is running an R application (which is what enter data for
her implies to me), then any accessibility issues would need to be
addressed in the application itself. But I don't understand why a data
entry assistant would need any skills in R itself in order to enter data
into it. But without knowing more, that's about all that I can say. One
thought: CMU has a college teaching electrical and computer engineering.
Depending on what that means, perhaps someone from that college (professor,
TA, or grad student) could see what your student is doing and perhaps have
some insights on how to help. Or is there a computer club on campus where
some geeky student might be found? You might look here:
http://www.club.cc.cmu.edu/ If these are true geeks (and the web site
sounds promising), then a lure of beer  pizza would likely be irresistible
grin.

===

For interfacing R with Excel, you might want to look at RExcel here:
http://rcom.univie.ac.at/download.html#RExcel . It has a free student
version. But is this more for an Excel user who wants to use R for
analysis, not an R user wanting to use Excel for data entry.



-- 
Yoda of Borg, we are. Futile, resistance is, yes. Assimilated, you will be.

My sister opened a computer store in Hawaii. She sells C shells down by the
seashore.
If someone tell you that nothing is impossible:
Ask him to dribble a football.

He's about as useful as a wax frying pan.

10 to the 12th power microphones = 1 Megaphone

Maranatha! 
John McKown

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Correlation matrix for pearson correlation (r,p,BH(FDR))

2015-06-18 Thread Rainer Schuermann
The way the sample data is provided is not useful. I have re-built your data, 
please find the dput() version below (and pls check whether I got it right...).

This is not my area of competence at all, but from what I see from the help 
page is that the expected parameters are, among others:

x   A matrix or dataframe
y   A second matrix or dataframe __with the same number of rows as x__

I hope that somebody with a better understanding of your intention is able to 
pick up from here, with the sample data in useful format.

Rgds,
Rainer


dput( genes )
structure(list(Genes = structure(1:10, .Label = c(KCNAB3, KCNB1, 
KCNB2, KERA, KGFLP1, KGFLP2, KHDC1, KHDC1L, KHDC3L, 
KHDRBS1), class = factor), Cell.line1 = c(12.02005181, 0.02457449, 
0.44791862, 0.06090217, 0.02450101, 0, 0, 2.3189445, 0, 0), Cell.line2 = 
c(11.140091, 
1.3028535, 0.1060137, 0, 0, 0, 0, 2.8252262, 0, 0), Cell.line3 = c(15.60381163, 
0.81538294, 0.09864136, 0.03352993, 0, 0, 0, 5.29099724, 0, 0
), Cell.line4 = c(13.44151596, 0.59318327, 0, 0.03634781, 0, 
0, 0, 7.44183228, 0, 0), Cell.line5 = c(25.3716103, 0.15332321, 
0, 0.04190912, 0, 0, 0, 1.94629741, 0, 0), Cell.line6 = c(8.12373424, 
4.18181234, 0.05857207, 0, 0.02563099, 0, 0, 8.56022436, 0, 0
), Cell.line7 = c(7.67506261, 1.65268403, 0.05945414, 0, 0.03902548, 
0, 0, 7.50838343, 0, 0.0308118), Cell.line8 = c(24.43776341, 
5.9834632, 0.20733924, 0.07752608, 0, 0, 0, 7.17964645, 0, 0), 
Cell.line9 = c(18.33244818, 1.51423807, 0.05830982, 0.01585643, 
0, 0, 0, 3.28602729, 0, 0), Cell.line10 = c(9.224225, 0, 
0, 16.664245, 0, 0, 0, 0, 3.598534, 2.600173)), .Names = c(Genes, 
Cell.line1, Cell.line2, Cell.line3, Cell.line4, Cell.line5, 
Cell.line6, Cell.line7, Cell.line8, Cell.line9, Cell.line10
), row.names = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 
10), class = data.frame)

dput( features )
structure(list(Cell.line = c(Growth rate, Drug sensitivity
), Cell.line1 = c(NA, 41.33), Cell.line2 = c(NA, 26.76), 
Cell.line3 = c(NA, 24.19), Cell.line4 = c(51.41, NA), 
Cell.line5 = c(NA_character_, NA_character_), Cell.line6 = c(5.03, 
1.40), Cell.line7 = c(6.57, 1.88), Cell.line8 = c(8, 
1.33), Cell.line9 = c(1.26, 5.05), Cell.line10 = c(3, 
9.12)), .Names = c(Cell.line, Cell.line1, Cell.line2, 
Cell.line3, Cell.line4, Cell.line5, Cell.line6, Cell.line7, 
Cell.line8, Cell.line9, Cell.line10), row.names = c(NA, 
-2L), class = data.frame)


On Thu June 18 2015 10:19:55 Sarah Bazzocco wrote:
 This post was called help before, I changed the Subject.
 Thanks for the comments.
 Here the example: (I have the two lists saved as .csv and I can open them in 
 R)
 
 Sheet one- Genes (10 genes expression, not binary, meaured in 10 cell lines)
  genes
  Genes  Cell.line1 Cell.line2  Cell.line3  Cell.line4  Cell.line5
 1   KCNAB3 12.02005181 11.1400910 15.60381163 13.44151596 25.37161030
 2KCNB1  0.02457449  1.3028535  0.81538294  0.59318327  0.15332321
 3KCNB2  0.44791862  0.1060137  0.09864136  0.  0.
 4 KERA  0.06090217  0.000  0.03352993  0.03634781  0.04190912
 5   KGFLP1  0.02450101  0.000  0.  0.  0.
 6   KGFLP2  0.  0.000  0.  0.  0.
 7KHDC1  0.  0.000  0.  0.  0.
 8   KHDC1L  2.31894450  2.8252262  5.29099724  7.44183228  1.94629741
 9   KHDC3L  0.  0.000  0.  0.  0.
 10 KHDRBS1  0.  0.000  0.  0.  0.
Cell.line6 Cell.line7  Cell.line8  Cell.line9 Cell.line10
 1  8.12373424 7.67506261 24.43776341 18.332448189.224225
 2  4.18181234 1.65268403  5.98346320  1.514238070.00
 3  0.05857207 0.05945414  0.20733924  0.058309820.00
 4  0. 0.  0.07752608  0.01585643   16.664245
 5  0.02563099 0.03902548  0.  0.0.00
 6  0. 0.  0.  0.0.00
 7  0. 0.  0.  0.0.00
 8  8.56022436 7.50838343  7.17964645  3.286027290.00
 9  0. 0.  0.  0.3.598534
 10 0. 0.03081180  0.  0.2.600173
 
 Sheet two - features (2 features(Growth rate,drug sensitivity for 10 cell 
 lines)
  features
  Cell.line Cell.line1 Cell.line2 Cell.line3 Cell.line4 Cell.line5
 1  Growth rate NA NA NA  51.41 NA
 2 Drug sensitivity   5.03   6.57  8   1.26  3
   Cell.line6 Cell.line7 Cell.line8 Cell.line9 Cell.line10
 1  41.33  26.76  24.19 NA  NA
 2   1.40   1.88   1.33   5.059.12
 
 What I found:
 corr.test {psych}
 corr.test(x, y = NULL, use = 
 pairwise,method=pearson,adjust=BH,alpha=.01)
 -- I adjusted the original command to what I need (BH insted og holm) and 
 alpha=.01 insted of 0.05.
 
 I would be very happy, if someone could show me how to use this command, in 
 particular 

Re: [R] How to round only one df row how to keep 3rd sigdif if zero

2015-06-18 Thread Crombie, Burnette N
Thanks for taking the time to share your thoughts, PP.  I always extensively 
google  search before resorting to R forum.  In my real dataset, not in the 
example I created for the forum, I had tried converting the matrix to a 
dataframe but it retained the unwanted format.  And, these tables are being 
used in a report generated with the rtf package, so I have to get the format 
right for outside the console.  Because of another unrelated issue, though, I 
had to use a different approach to creating the dataframe with counts/rates 
added, so the issue was circumvented.  Cheers.

-Original Message-
From: PIKAL Petr [mailto:petr.pi...@precheza.cz] 
Sent: Thursday, June 18, 2015 10:56 AM
To: Crombie, Burnette N; r-help@r-project.org
Subject: RE: [R] How to round only one df row  how to keep 3rd sigdif if zero

Hi

You need to distinguish between an object and printing an object on console. 
When you print an object you can use several options for formating.

?sprintf, ?formatC

 formatC(t(a), digits=1, format=f)
  [,1]   [,2]   [,3]
count 1.0  2.0  3.0
rate  16.7 33.3 50.0


Also when you transpose a the result is not data frame but matrix.

 str(t(a))
 num [1:2, 1:3] 1 16.7 2 33.3 3 50
 - attr(*, dimnames)=List of 2
  ..$ : chr [1:2] count rate
  ..$ : NULL
 str(a)
'data.frame':   3 obs. of  2 variables:
 $ count: num  1 2 3
 $ rate : num  16.7 33.3 50


If you used google or other internet search options you would get plenty of 
results yourself.

try formatting numbers R

Cheers
Petr

 -Original Message-
 From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of 
 bcrombie
 Sent: Thursday, June 18, 2015 3:09 PM
 To: r-help@r-project.org
 Subject: [R] How to round only one df row  how to keep 3rd sigdif if 
 zero

 # How do I round only one row of a dataframe?
 # After transposing a dataframe of counts  rates, all values took on 
 the most # of signif digits in the dataset (rates), but I want counts 
 to remain only one digit.
 # Also, how can I keep 3 significant digits in R when the 3rd is a 
 zero?
 count - c(1, 2, 3)
 rate - c(16.7, 33.3, 50.0)
 a - data.frame(count,rate)
 a
 # count rate
 # 1 1 16.7
 # 2 2 33.3
 # 3 3 50.0
 a - t(a)
 a
 # [,1] [,2] [,3]
 # count  1.0  2.03
 # rate  16.7 33.3   50



 --
 View this message in context: http://r.789695.n4.nabble.com/How-to-
 round-only-one-df-row-how-to-keep-3rd-sigdif-if-zero-tp4708819.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting- 
 guide.html and provide commented, minimal, self-contained, 
 reproducible code.


Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny 
pouze jeho adresátům.
Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně 
jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze 
svého systému.
Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email 
jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či 
zpožděním přenosu e-mailu.

V případě, že je tento e-mail součástí obchodního jednání:
- vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a 
to z jakéhokoliv důvodu i bez uvedení důvodu.
- a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; 
Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce 
s dodatkem či odchylkou.
- trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným 
dosažením shody na všech jejích náležitostech.
- odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost 
žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně 
pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně 
osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi 
či osobě jím zastoupené známá.

This e-mail and any documents attached to it may be confidential and are 
intended only for its intended recipients.
If you received this e-mail by mistake, please immediately inform its sender. 
Delete the contents of this e-mail with all attachments and its copies from 
your system.
If you are not the intended recipient of this e-mail, you are not authorized to 
use, disseminate, copy or disclose this e-mail in any manner.
The sender of this e-mail shall not be liable for any possible damage caused by 
modifications of the e-mail or by delay with transfer of the email.

In case that this e-mail forms part of business dealings:
- the sender reserves the right to end negotiations about entering into a 
contract in any time, for any reason, and without stating any reasoning.
- if the e-mail contains an 

Re: [R] help for lay person assisting R user with disability

2015-06-18 Thread Bert Gunter
Given that neither you nor the student are (skilled?) R users, I think you
would do better contacting someone locally for help -- there will be many
in the statistics and social sciences departments (among others).

There are several R packages that interface with Excel (e.g. RExcel), but
it may merely be a matter of reading in text files via R's native
facilities (e.g. read.csv ) . A local resource can best help you sort out
what would work best in your situation imho.

Cheers,
Bert

Bert Gunter

Data is not information. Information is not knowledge. And knowledge is
certainly not wisdom.
   -- Clifford Stoll

On Thu, Jun 18, 2015 at 7:32 AM, Courtney Bryant cbry...@andrew.cmu.edu
wrote:

 Good Morning,
 I am currently working with a disabled R user who is a student here at
 CMU.  The student has both sight and mobility issues.  The student has
 asked for an assistant who is well versed in R to enter data for her, which
 we are having a hard time finding.  I would like information from R
 developers/users about how/how well R interfaces with Excel (an easier
 skill set to find!)   In your opinion, could it be as easy as uploading
 data from excel into R?

 Also, do you know of a way to enlarge the R interface or otherwise assist
 in making the program accessible to a low vision person?  My  limited
 understanding leads me to believe that screen magnifiers like zoom text
 don't work particularly well.  If you have information on that, I would
 very much appreciate it.

 Thanks for your help and for bearing with me!
 Courtney



 Courtney Bryant, EOS Specialist
 Equal Opportunity Services, Human Resources
 Carnegie Mellon University
 412-268-3930 | cbry...@andrew.cmu.edu

 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] help for lay person assisting R user with disability

2015-06-18 Thread Duncan Murdoch
On 18/06/2015 11:32 AM, Courtney Bryant wrote:
 Good Morning,
 I am currently working with a disabled R user who is a student here at CMU.  
 The student has both sight and mobility issues.  The student has asked for an 
 assistant who is well versed in R to enter data for her, which we are having 
 a hard time finding.  I would like information from R developers/users about 
 how/how well R interfaces with Excel (an easier skill set to find!)   In your 
 opinion, could it be as easy as uploading data from excel into R?  
 
 Also, do you know of a way to enlarge the R interface or otherwise assist in 
 making the program accessible to a low vision person?  My  limited 
 understanding leads me to believe that screen magnifiers like zoom text don't 
 work particularly well.  If you have information on that, I would very much 
 appreciate it.  
 

There was an article not too long ago in the R Journal about this issue;
you can read it here:

http://journal.r-project.org/archive/2013-1/godfrey.pdf

I think the main R thing that has changed since then is the rise in the
prominence and maturity of RStudio.  At that time the author didn't find
it very easy to use, but it might be worth investigating again.

The author put together a web page

http://r-resources.massey.ac.nz/StatSoftware/

that you might find useful as well.

Duncan Murdoch

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] help for lay person assisting R user with disability

2015-06-18 Thread Clint Bowman
Almost 20 years ago my son was in the DO-IT program at the University of 
Washington http://www.washington.edu/doit/.  They have been very 
proactive in reaching out to other institutions.


They have been solving problems such as yours and I suspect can suggest 
several workable solutions.


Clint

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Thu, 18 Jun 2015, Liz Hare wrote:


Hi Courtney and John,

The RStudio environment mentioned below will not work with speech output (I 
tried with Window-Eyes awhile ago). Some of my clients use it but I have no 
experience with it. Since the student is partially sighted, they might be able 
to customize the environment with big fonts and contrast, I’m just not sure.

Using a screen reader like Window-Eyes, the student could use the R GUI 
environment, although it’s a little frustrating because it doesn’t speak a lot 
and you need to use the mouse keys a lot.

The other option if you have to stick with Windows  is to run R at the command 
prompt, which makes interaction slightly easier but you’d have to figure out 
how to log the output.

What is being recommended for the rest of the students in the class? Ideally, 
this student’s experience should be as close as possible to the others’.

Liz

On Jun 18, 2015, at 12:17 PM, John McKown john.archie.mck...@gmail.com wrote:

On Thu, Jun 18, 2015 at 9:32 AM, Courtney Bryant cbry...@andrew.cmu.edu
wrote:


Good Morning,
I am currently working with a disabled R user who is a student here at
CMU.  The student has both sight and mobility issues.  The student has
asked for an assistant who is well versed in R to enter data for her, which
we are having a hard time finding.  I would like information from R
developers/users about how/how well R interfaces with Excel (an easier
skill set to find!)   In your opinion, could it be as easy as uploading
data from excel into R?

Also, do you know of a way to enlarge the R interface or otherwise assist
in making the program accessible to a low vision person?  My  limited
understanding leads me to believe that screen magnifiers like zoom text
don't work particularly well.  If you have information on that, I would
very much appreciate it.

Thanks for your help and for bearing with me!
Courtney



I am a bit confused (a normal condition for me). Is the student writing R
code or is the student running a application written in R? Also, since you
mentioned Excel, I am assuming that the student is using a PC running
Windows as opposed to Linux or a Mac.

If the student is writing R code, then I'd suggest that your computer
support person install Rstudio. It is cost free and can be downloaded here:
http://www.rstudio.com/ . The installer can then customize Rstudio to use a
really large font, if that would be helpful. Please forgive my lack of
knowledge about accessibility issues. If the student has trouble typing
(mobility issue?), this likely won't help. Would a speech to text / text to
speech interface help instead of a screen magnifier? I know next to nothing
about these tools, other than that they exist.

===

If the student is running an R application (which is what enter data for
her implies to me), then any accessibility issues would need to be
addressed in the application itself. But I don't understand why a data
entry assistant would need any skills in R itself in order to enter data
into it. But without knowing more, that's about all that I can say. One
thought: CMU has a college teaching electrical and computer engineering.
Depending on what that means, perhaps someone from that college (professor,
TA, or grad student) could see what your student is doing and perhaps have
some insights on how to help. Or is there a computer club on campus where
some geeky student might be found? You might look here:
http://www.club.cc.cmu.edu/ If these are true geeks (and the web site
sounds promising), then a lure of beer  pizza would likely be irresistible
grin.

===

For interfacing R with Excel, you might want to look at RExcel here:
http://rcom.univie.ac.at/download.html#RExcel . It has a free student
version. But is this more for an Excel user who wants to use R for
analysis, not an R user wanting to use Excel for data entry.



--
Yoda of Borg, we are. Futile, resistance is, yes. Assimilated, you will be.

My sister opened a computer store in Hawaii. She sells C shells down by the
seashore.
If someone tell you that nothing is impossible:
Ask him to dribble a football.

He's about as useful as a wax frying pan.

10 to the 12th power microphones = 1 Megaphone

Maranatha! 
John McKown

[[alternative HTML version deleted]]


[R] Repeated Measures ANOVA and Missing Values in the data set

2015-06-18 Thread gianni lavaredo
I am doing Repeated Measures ANOVA with missing values. When i run my model
i get this error message.




*aov.out = aov(values ~ time + Error(subject/time), data=mydata2)Warning
message:In aov(values ~ time + Error(subject/time), data = mydata2) :
Error() model is singular*

The missing Values are not a error of my instrument. They mean the element
of my analysis is absent and i want to consider this.

thanks in advance

these are my data:

subject - c(1,2,3,4,5,6,7,8,9,10)
time1 - c(5040,3637,6384,5309,5420,3549,NA,5140,3890,3910)
time2 - c(5067, 3668, NA, 6489, NA, 3922, 3408, 6613, 4063, 3937)
time3 - c( 3278, 3814, 8745, 4760, 4911, 5716, 5547, 5844, 4914, 4390)
time4 - c(   0, 2971,0, 2776, 2128, 1208, 2935, 2739, 3054, 3363)
time5 - c(4161, 3483, 6728, 5008, 5562, 4380, 4006, 7536, 3805, 3923)
time6 - c( 3604, 3411, 2523, 3264, 3578, 2941, 2939,   NA, 3612, 3604)
mydata - data.frame(time1, time2, time3, time4, time5, time6)
mydata2 = stack(mydata)
subject  = factor(rep(subject,6))
mydata2[3] = subject
colnames(mydata2) = c(values, time, subject)
aov.out = aov(values ~ time + Error(subject/time), data=mydata2)
summary(aov.out)
model.tables(aov.out,means)

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Sign of specific elements of a vector

2015-06-18 Thread David Winsemius

On Jun 18, 2015, at 1:21 PM, Marc Schwartz wrote:

 Just to augment Bert’s comment, other options are likely to introduce some 
 level of overhead that while perhaps looking better, will not be materially 
 faster. Depending upon the length of your vector, you could do some testing 
 to see.
 

Another method which depends upon R recycling of vector arguments:

x - x*c(rep(1,19), -1)

Might be a bit faster:

 set.seed(1)
 x - rnorm(1e6)
 system.time(x - x*c(rep(1,19), -1))
   user  system elapsed 
  0.005   0.000   0.005 
 set.seed(1)
 system.time({
+ IND - seq(20,length(x), by=20)
+ x[IND] - -x[IND]})
   user  system elapsed 
  0.010   0.001   0.011 

-- 
David.

 One thing that might yield a little bit of performance improvement would be 
 to pre-calculate the indices:
 
 set.seed(1)
 x - rnorm(100)
 IND - seq(20,100, by=20)
 
 IND
 [1]  20  40  60  80 100
 
 x[IND]
 [1]  0.5939013  0.7631757 -0.1350546 -0.5895209 -0.4734006
 
 x[IND] - -x[IND]
 
 x[IND]
 [1] -0.5939013 -0.7631757  0.1350546  0.5895209  0.4734006
 
 
 But unless your vector is very large, I suspect the performance gain may be 
 minimal in real time.
 
 Regards,
 
 Marc Schwartz
 
 
 On Jun 18, 2015, at 3:07 PM, Bert Gunter bgunter.4...@gmail.com wrote:
 
 Your **is** the coolest and most efficient way to do this. It's
 vectorized -- apply() stuff is not.
 
 Cheers,
 Bert
 
 Bert Gunter
 
 Data is not information. Information is not knowledge. And knowledge is
 certainly not wisdom.
  -- Clifford Stoll
 
 On Thu, Jun 18, 2015 at 12:40 PM, Frank S. f_j_...@hotmail.com wrote:
 
 Hi everyone,
 
 I have an x vector and I would want to change the sign every 20
 elements. For this puspose,
 I wrote the following code:
 
 set.seed(1)
 x - rnorm(100)
 x
 x[seq(20,100, by=20)] - -x[seq(20,100, by=20)]
 x
 
 However, I'm afraid  it is a rudimentary form to get the desired result.
 II wonder wether there is a cool way to do so, that is, for example with
 apply or sign function.
 
 Thans in advanced for your help!
 
 Frank S.
 
 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

David Winsemius
Alameda, CA, USA

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Correlation matrix for pearson correlation (r,p,BH(FDR))

2015-06-18 Thread Peter Langfelder
You have multiple options. I will advertise my own solution - install
the package WGCNA, installation instructions at

http://labs.genetics.ucla.edu/horvath/CoexpressionNetwork/Rpackages/WGCNA/#cranInstall

then you can use the function
cp = corAndPvalue(t(genes), t(features)).

You need to transpose both because the function expects variables in
columns and samples in rows.

This will give you a list whose components include 'cor' (matrix of
the correlation values) and 'p' (matrix of the Student p-values). To
get a matrix of the corresponding FDR, use

fdr = apply(cp$p, 2, p.adjust, method = fdr)

Hope this helps,

Peter


On Thu, Jun 18, 2015 at 1:19 AM, Sarah Bazzocco sarah.bazzo...@vhir.org wrote:
 This post was called help before, I changed the Subject.
 Thanks for the comments.
 Here the example: (I have the two lists saved as .csv and I can open them in 
 R)

 Sheet one- Genes (10 genes expression, not binary, meaured in 10 cell lines)
 genes
  Genes  Cell.line1 Cell.line2  Cell.line3  Cell.line4  Cell.line5
 1   KCNAB3 12.02005181 11.1400910 15.60381163 13.44151596 25.37161030
 2KCNB1  0.02457449  1.3028535  0.81538294  0.59318327  0.15332321
 3KCNB2  0.44791862  0.1060137  0.09864136  0.  0.
 4 KERA  0.06090217  0.000  0.03352993  0.03634781  0.04190912
 5   KGFLP1  0.02450101  0.000  0.  0.  0.
 6   KGFLP2  0.  0.000  0.  0.  0.
 7KHDC1  0.  0.000  0.  0.  0.
 8   KHDC1L  2.31894450  2.8252262  5.29099724  7.44183228  1.94629741
 9   KHDC3L  0.  0.000  0.  0.  0.
 10 KHDRBS1  0.  0.000  0.  0.  0.
Cell.line6 Cell.line7  Cell.line8  Cell.line9 Cell.line10
 1  8.12373424 7.67506261 24.43776341 18.332448189.224225
 2  4.18181234 1.65268403  5.98346320  1.514238070.00
 3  0.05857207 0.05945414  0.20733924  0.058309820.00
 4  0. 0.  0.07752608  0.01585643   16.664245
 5  0.02563099 0.03902548  0.  0.0.00
 6  0. 0.  0.  0.0.00
 7  0. 0.  0.  0.0.00
 8  8.56022436 7.50838343  7.17964645  3.286027290.00
 9  0. 0.  0.  0.3.598534
 10 0. 0.03081180  0.  0.2.600173

 Sheet two - features (2 features(Growth rate,drug sensitivity for 10 cell 
 lines)
 features
  Cell.line Cell.line1 Cell.line2 Cell.line3 Cell.line4 Cell.line5
 1  Growth rate NA NA NA  51.41 NA
 2 Drug sensitivity   5.03   6.57  8   1.26  3
   Cell.line6 Cell.line7 Cell.line8 Cell.line9 Cell.line10
 1  41.33  26.76  24.19 NA  NA
 2   1.40   1.88   1.33   5.059.12

 What I found:
 corr.test {psych}
 corr.test(x, y = NULL, use = 
 pairwise,method=pearson,adjust=BH,alpha=.01)
 -- I adjusted the original command to what I need (BH insted og holm) and 
 alpha=.01 insted of 0.05.

 I would be very happy, if someone could show me how to use this command, in 
 particular how to refer as x and y to the two sheets I have (Genes and 
 Features). I would take it from there.

 Thanks a lot in advance.

 Sarah






 - Original Message -
 From: Rainer Schuermann rainer.schuerm...@gmx.net
 To: Sarah Bazzocco sarah.bazzo...@vhir.org
 Sent: Thursday, 18 June, 2015 8:14:56 AM
 Subject: Re: [R] help



 Hi Sarah,



 Not an answer to our question but a piece of well intended advice:



 1. Don't post HTML but plain text. Not only that people will tell you this in 
 a sometimes not very friendly manner - using HTML actually does make posts 
 illegible in this mailing list. Code, and R _is_ code, is always plain text.



 2. Don't pose an abstract problem - this looks too much like Can you please 
 do my work for me. Show us what you have tried already, and people will 
 happily jump in and provide their thoughts and advice.



 3. Always make sure that you ave a reproducible example in your mail, and a 
 set of data of the same type and structure you are using - ideally using 
 dput().



 See further advice here



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

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



 and here:



 http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example



 For your problem, R has an immense wealth of ideas and solutions.



 Rgds,

 Rainer







 On Wed June 17 2015 16:57:24 Sarah Bazzocco wrote:



 Hello,



 �



 I am a R-beginner and I need some help.�The question is very simple: I need 
 to do a pearson correlations (r,p-value and FDR with BH) from an Expression 
 array (with several thousand genes for lets say 20 cell lines)�with some 
 features of those cell lines.







 My problem I 

Re: [R] help for lay person assisting R user with disability

2015-06-18 Thread Paul Murrell

Hi

Jonathon Godfrey has published some information and guidelines on the 
accessibility of R (and other stat software), e.g., ...


http://r-resources.massey.ac.nz/StatSoftware/
http://journal.r-project.org/archive/2013-1/godfrey.pdf

Paul

On 06/19/15 02:32, Courtney Bryant wrote:

Good Morning, I am currently working with a disabled R user who is a
student here at CMU.  The student has both sight and mobility issues.
The student has asked for an assistant who is well versed in R to
enter data for her, which we are having a hard time finding.  I would
like information from R developers/users about how/how well R
interfaces with Excel (an easier skill set to find!)   In your
opinion, could it be as easy as uploading data from excel into R?

Also, do you know of a way to enlarge the R interface or otherwise
assist in making the program accessible to a low vision person?  My
limited understanding leads me to believe that screen magnifiers like
zoom text don't work particularly well.  If you have information on
that, I would very much appreciate it.

Thanks for your help and for bearing with me! Courtney



Courtney Bryant, EOS Specialist Equal Opportunity Services, Human
Resources Carnegie Mellon University 412-268-3930 |
cbry...@andrew.cmu.edu

__ R-help@r-project.org
mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the
posting guide http://www.R-project.org/posting-guide.html and provide
commented, minimal, self-contained, reproducible code.



--
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
p...@stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Sign of specific elements of a vector

2015-06-18 Thread Frank S.
Hi everyone,
 
I have an x vector and I would want to change the sign every 20 elements. For 
this puspose,
I wrote the following code:
 
set.seed(1)
x - rnorm(100)
x
x[seq(20,100, by=20)] - -x[seq(20,100, by=20)]
x
 
However, I'm afraid  it is a rudimentary form to get the desired result. II 
wonder wether there is a cool way to do so, that is, for example with apply or 
sign function.
 
Thans in advanced for your help!

Frank S.
  
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] help for lay person assisting R user with disability

2015-06-18 Thread Courtney Bryant
Hi Liz,
This is a particularly sticky case – the student is attempting to get a PhD but 
is currently in between programs until her current project (which we’re 
attempting to hire an assistant for, or better yet some up with a solution she 
can work on her own) is completed and “accepted” in some way.
I believe her main access issue is around mobility, she has little use of her 
hands.  I wasn’t sure if sight was as much of an issue, but from what I’ve 
learned here it seems that enlarging the text itself is easy enough.  I will 
double check with her about her computer – at the end of the day, if she is 
game, perhaps I could provide her with a mac.

Courtney Bryant, EOS Specialist
Equal Opportunity Services, Human Resources
Carnegie Mellon University
412-268-3930 | cbry...@andrew.cmu.edumailto:cbry...@andrew.cmu.edu



From: Liz Hare [mailto:dogg...@earthlink.net]
Sent: Thursday, June 18, 2015 12:42 PM
To: John McKown
Cc: Courtney Bryant; r-help@R-project.org
Subject: Re: [R] help for lay person assisting R user with disability

Hi Courtney and John,

The RStudio environment mentioned below will not work with speech output (I 
tried with Window-Eyes awhile ago). Some of my clients use it but I have no 
experience with it. Since the student is partially sighted, they might be able 
to customize the environment with big fonts and contrast, I’m just not sure.

Using a screen reader like Window-Eyes, the student could use the R GUI 
environment, although it’s a little frustrating because it doesn’t speak a lot 
and you need to use the mouse keys a lot.

The other option if you have to stick with Windows  is to run R at the command 
prompt, which makes interaction slightly easier but you’d have to figure out 
how to log the output.

What is being recommended for the rest of the students in the class? Ideally, 
this student’s experience should be as close as possible to the others’.

Liz
On Jun 18, 2015, at 12:17 PM, John McKown 
john.archie.mck...@gmail.commailto:john.archie.mck...@gmail.com wrote:

On Thu, Jun 18, 2015 at 9:32 AM, Courtney Bryant 
cbry...@andrew.cmu.edumailto:cbry...@andrew.cmu.edu
wrote:


Good Morning,
I am currently working with a disabled R user who is a student here at
CMU.  The student has both sight and mobility issues.  The student has
asked for an assistant who is well versed in R to enter data for her, which
we are having a hard time finding.  I would like information from R
developers/users about how/how well R interfaces with Excel (an easier
skill set to find!)   In your opinion, could it be as easy as uploading
data from excel into R?

Also, do you know of a way to enlarge the R interface or otherwise assist
in making the program accessible to a low vision person?  My  limited
understanding leads me to believe that screen magnifiers like zoom text
don't work particularly well.  If you have information on that, I would
very much appreciate it.

Thanks for your help and for bearing with me!
Courtney

I am a bit confused (a normal condition for me). Is the student writing R
code or is the student running a application written in R? Also, since you
mentioned Excel, I am assuming that the student is using a PC running
Windows as opposed to Linux or a Mac.

If the student is writing R code, then I'd suggest that your computer
support person install Rstudio. It is cost free and can be downloaded here:
http://www.rstudio.com/ . The installer can then customize Rstudio to use a
really large font, if that would be helpful. Please forgive my lack of
knowledge about accessibility issues. If the student has trouble typing
(mobility issue?), this likely won't help. Would a speech to text / text to
speech interface help instead of a screen magnifier? I know next to nothing
about these tools, other than that they exist.

===

If the student is running an R application (which is what enter data for
her implies to me), then any accessibility issues would need to be
addressed in the application itself. But I don't understand why a data
entry assistant would need any skills in R itself in order to enter data
into it. But without knowing more, that's about all that I can say. One
thought: CMU has a college teaching electrical and computer engineering.
Depending on what that means, perhaps someone from that college (professor,
TA, or grad student) could see what your student is doing and perhaps have
some insights on how to help. Or is there a computer club on campus where
some geeky student might be found? You might look here:
http://www.club.cc.cmu.edu/ If these are true geeks (and the web site
sounds promising), then a lure of beer  pizza would likely be irresistible
grin.

===

For interfacing R with Excel, you might want to look at RExcel here:
http://rcom.univie.ac.at/download.html#RExcel . It has a free student
version. But is this more for an Excel user who wants to use R for
analysis, not an R user wanting to use Excel for data entry.



--
Yoda of Borg, we are. Futile, resistance is, 

[R] R problem

2015-06-18 Thread Endy
Hi, R users.
I am using windows 7 ultimate, as an OS, and the R version
3.2.0. This combination creates some problems when I run R.  The problem 
focuses on the command ‘source’.
More precisely, suppose that we have a main function, let call it mainfn, which
calls within it another function, call it subfn, with the command 
source(“C:\\Program
Files\\. . .\\subfn.txt”).
 The files with the R
code of the two functions, mainfn and subfn, are .txt files. First I load the
mainfn  function using   File-  Source R code…  and I get
source(“C:\\Program Files\\ . . .\\mainfn.txt”)
Then I run the mainfn 
mainfn ()
and I get 
Error in file(filename, r, encoding = encoding)
: 
  cannot open the
connection
Any suggestion what goes wrong?
 

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] Sign of specific elements of a vector

2015-06-18 Thread Marc Schwartz
Just to augment Bert’s comment, other options are likely to introduce some 
level of overhead that while perhaps looking better, will not be materially 
faster. Depending upon the length of your vector, you could do some testing to 
see.

One thing that might yield a little bit of performance improvement would be to 
pre-calculate the indices:

set.seed(1)
x - rnorm(100)
IND - seq(20,100, by=20)

 IND
[1]  20  40  60  80 100

 x[IND]
[1]  0.5939013  0.7631757 -0.1350546 -0.5895209 -0.4734006

x[IND] - -x[IND]

 x[IND]
[1] -0.5939013 -0.7631757  0.1350546  0.5895209  0.4734006


But unless your vector is very large, I suspect the performance gain may be 
minimal in real time.

Regards,

Marc Schwartz


 On Jun 18, 2015, at 3:07 PM, Bert Gunter bgunter.4...@gmail.com wrote:
 
 Your **is** the coolest and most efficient way to do this. It's
 vectorized -- apply() stuff is not.
 
 Cheers,
 Bert
 
 Bert Gunter
 
 Data is not information. Information is not knowledge. And knowledge is
 certainly not wisdom.
   -- Clifford Stoll
 
 On Thu, Jun 18, 2015 at 12:40 PM, Frank S. f_j_...@hotmail.com wrote:
 
 Hi everyone,
 
 I have an x vector and I would want to change the sign every 20
 elements. For this puspose,
 I wrote the following code:
 
 set.seed(1)
 x - rnorm(100)
 x
 x[seq(20,100, by=20)] - -x[seq(20,100, by=20)]
 x
 
 However, I'm afraid  it is a rudimentary form to get the desired result.
 II wonder wether there is a cool way to do so, that is, for example with
 apply or sign function.
 
 Thans in advanced for your help!
 
 Frank S.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] Sign of specific elements of a vector

2015-06-18 Thread Bert Gunter
Your **is** the coolest and most efficient way to do this. It's
vectorized -- apply() stuff is not.

Cheers,
Bert

Bert Gunter

Data is not information. Information is not knowledge. And knowledge is
certainly not wisdom.
   -- Clifford Stoll

On Thu, Jun 18, 2015 at 12:40 PM, Frank S. f_j_...@hotmail.com wrote:

 Hi everyone,

 I have an x vector and I would want to change the sign every 20
 elements. For this puspose,
 I wrote the following code:

 set.seed(1)
 x - rnorm(100)
 x
 x[seq(20,100, by=20)] - -x[seq(20,100, by=20)]
 x

 However, I'm afraid  it is a rudimentary form to get the desired result.
 II wonder wether there is a cool way to do so, that is, for example with
 apply or sign function.

 Thans in advanced for your help!

 Frank S.

 [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R problem

2015-06-18 Thread William Dunlap
Usually, along with that error message, you get a warning
that gives a few details about the problem, like the name
of the file and the reason it could be opened.  E.g.,
   filename - no\\such\\file.blah.blah
   file(filename, r, encoding=UTF-8)
  Error in file(filename, r, encoding = UTF-8) :
cannot open the connection
  In addition: Warning message:
  In file(filename, r, encoding = UTF-8) :
cannot open file 'no\such\file.blah.blah': No such file or directory
Did you suppress warnings?


Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Thu, Jun 18, 2015 at 10:55 AM, Endy pert...@yahoo.gr wrote:

 Hi, R users.
 I am using windows 7 ultimate, as an OS, and the R version
 3.2.0. This combination creates some problems when I run R.  The problem
 focuses on the command ‘source’.
 More precisely, suppose that we have a main function, let call it mainfn,
 which
 calls within it another function, call it subfn, with the command
  source(“C:\\Program
 Files\\. . .\\subfn.txt”).
  The files with the R
 code of the two functions, mainfn and subfn, are .txt files. First I load
 the
 mainfn  function using   File-  Source R code…  and I get
 source(“C:\\Program Files\\ . . .\\mainfn.txt”)
 Then I run the mainfn
 mainfn ()
 and I get
 Error in file(filename, r, encoding = encoding)
 :
   cannot open the
 connection
 Any suggestion what goes wrong?
 

 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] Is there a convenient way of extracting the matrix `solve(X %*% t(X) + PENALTY)` from an additive model fit in mgcv?

2015-06-18 Thread Simon Wood

Yes...

## example fit...
 library(mgcv)
 set.seed(2) ## simulate some data...
 dat - gamSim(1,n=400,dist=normal,scale=2)
 b - gam(y~s(x0)+s(x1)+s(x2)+s(x3),data=dat)
## extract the thing required in the title
 b$Vp/b$sig2

best,
Simon


On 18/06/15 03:23, Andrew Crane-Droesch wrote:

The title says it all. An additive model can be fit by `solve(X %*% t(X)
+ PENALTY)%*%t(X)%*%y` (though of course there are more efficient ways
to do it). I want the matrix `solve(X %*% t(X) + PENALTY)` from a fitted
gam object. GAM objects can be a bit tricky to navigate -- is there a
convenient way of extracting this?

Happy to explain why I'm interested in this to anyone who would like to
know, off-list.

Many thanks!
Andrew

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



--
Simon Wood, Mathematical Science, University of Bath BA2 7AY UK
+44 (0)1225 386603   http://people.bath.ac.uk/sw283

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Is there a convenient way of extracting the matrix `solve(X %*% t(X) + PENALTY)` from an additive model fit in mgcv?

2015-06-18 Thread Andrew Crane-Droesch
...That should have been obvious!  I'm a little embarrassed!

Thanks,
Andrew

**
On 06/18/2015 01:14 PM, Simon Wood wrote:
 Yes...

 ## example fit...
  library(mgcv)
  set.seed(2) ## simulate some data...
  dat - gamSim(1,n=400,dist=normal,scale=2)
  b - gam(y~s(x0)+s(x1)+s(x2)+s(x3),data=dat)
 ## extract the thing required in the title
  b$Vp/b$sig2

 best,
 Simon


 On 18/06/15 03:23, Andrew Crane-Droesch wrote:
 The title says it all. An additive model can be fit by `solve(X %*% t(X)
 + PENALTY)%*%t(X)%*%y` (though of course there are more efficient ways
 to do it). I want the matrix `solve(X %*% t(X) + PENALTY)` from a fitted
 gam object. GAM objects can be a bit tricky to navigate -- is there a
 convenient way of extracting this?

 Happy to explain why I'm interested in this to anyone who would like to
 know, off-list.

 Many thanks!
 Andrew

 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Is there a convenient way of extracting the matrix `solve(X %*% t(X) + PENALTY)` from an additive model fit in mgcv?

2015-06-18 Thread Andrew Crane-Droesch
The title says it all. An additive model can be fit by `solve(X %*% t(X) 
+ PENALTY)%*%t(X)%*%y` (though of course there are more efficient ways 
to do it). I want the matrix `solve(X %*% t(X) + PENALTY)` from a fitted 
gam object. GAM objects can be a bit tricky to navigate -- is there a 
convenient way of extracting this?


Happy to explain why I'm interested in this to anyone who would like to 
know, off-list.


Many thanks!
Andrew

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Grouping in R

2015-06-18 Thread PIKAL Petr
Hi

We can only guess what you really want.

Maybe this.

set.seed(111)
cust-sample(letters[1:5], 500, replace =T)
value-sample(1:1000, 500)
month-sample(1:12, 500, replace=T)
dat-data.frame(cust, value, month)
dat.ag-aggregate(dat$value, list(dat$month, dat$cust), sum)

 head(dat.ag)
  Group.1 Group.2x
1   1   a 2444
2   2   a 6234
3   3   a 6082
4   4   a 3691
5   5   a 3044
6   6   a 3534

dput(dat.ag)
structure(list(Group.1 = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L,
10L, 11L, 12L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L,
12L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 1L, 2L,
3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 1L, 2L, 3L, 4L, 5L,
6L, 7L, 8L, 9L, 10L, 11L, 12L), Group.2 = structure(c(1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L,
5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L), .Label = c(a, b,
c, d, e), class = factor), x = c(2444L, 6234L, 6082L,
3691L, 3044L, 3534L, 7444L, 1819L, 2295L, 4774L, 3659L, 1159L,
6592L, 1272L, 8245L, 2324L, 5189L, 3935L, 2945L, 2386L, 2796L,
2869L, 3142L, 4657L, 4411L, 6223L, 3266L, 3842L, 6056L, 7472L,
3879L, 7135L, 4544L, 4498L, 2703L, 3409L, 2748L, 2288L, 2654L,
4995L, 4626L, 5543L, 2162L, 4681L, 5853L, 6229L, 3001L, 5274L,
3852L, 2635L, 5643L, 2809L, 2988L, 3756L, 5180L, 2997L, 4883L,
4208L, 2669L, 3151L)), .Names = c(Group.1, Group.2, x), row.names = c(NA,
-60L), class = data.frame)


But maybe something different. Who knows?

If you wanted grouping by value use

?cut or ?findInterval

Cheers
Petr


 -Original Message-
 From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Shivi82
 Sent: Thursday, June 18, 2015 9:22 AM
 To: r-help@r-project.org
 Subject: [R] Grouping in R

 Hi All,

 I am working on a data where the total row count is 25+ and have
 approx.
 20 variables. One of the var on which i need to summarize the data is
 Consignor i.e. seller name.

 Now the issue here is after deleting all the duplicate names i still
 have 55000 unique customer name and i am not sure on how to summarize
 the data.

 Is there a possibility that i could create 8 or 10 groups based on the
 weight or booking they made from our company and eventually all 55000
 customers would fall under these 10 groups. Then it could be easier for
 me to analyze in which group there is a variance on a month on month
 level.




 --
 View this message in context: http://r.789695.n4.nabble.com/Grouping-
 in-R-tp4708800.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-
 guide.html
 and provide commented, minimal, self-contained, reproducible code.


Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny 
pouze jeho adresátům.
Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně 
jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze 
svého systému.
Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email 
jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či 
zpožděním přenosu e-mailu.

V případě, že je tento e-mail součástí obchodního jednání:
- vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a 
to z jakéhokoliv důvodu i bez uvedení důvodu.
- a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; 
Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce 
s dodatkem či odchylkou.
- trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným 
dosažením shody na všech jejích náležitostech.
- odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost 
žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně 
pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně 
osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi 
či osobě jím zastoupené známá.

This e-mail and any documents attached to it may be confidential and are 
intended only for its intended recipients.
If you received this e-mail by mistake, please immediately inform its sender. 
Delete the contents of this e-mail with all attachments and its copies from 
your system.
If you are not the intended recipient of this e-mail, you are not authorized to 
use, disseminate, copy or disclose this e-mail in any manner.
The sender of this e-mail shall not be liable for any possible damage caused by 
modifications of the e-mail or by delay with transfer of the email.

In case that this e-mail forms part of business dealings:
- 

Re: [R] Error bars and CI

2015-06-18 Thread Mohan.Radhakrishnan
Hi Dennis,
 I have copied the 'r' group. Could you explain ? Why 
can't we compute CI and error bars using this data set ?
The graph generated has equal-sized error bars and a 99% confidence band. 
Groups are not needed here. But the error bar and CI calculations could be 
incorrect but I am able to draw this.

  V1 IDX
1  0.796   1
2  0.542   2
3  0.510   3
4  0.617   4
5  0.482   5
6  0.387   6
7  0.272   7
8  0.536   8
9  0.498   9
10 0.402  10
11 0.328  11
12 0.542  12
13 0.299  13
14 0.647  14
15 0.291  15
16 0.815  16
17 0.680  17
18 0.363  18
19 0.560  19
20 0.334  20

Assume the dataframe is 'jc'.

print(summary(jc$V1))
error - qt(0.995,df=length(jc$V1)-1)*sd(jc$V1)/sqrt(length(jc$V1))
error1 - mean(jc$V1)-error
error2 - mean(jc$V1)+error
print(error1)
print(error2)

q - qplot(geom = line,jc$IDX,jc$V1, 
colour='red')+geom_errorbar(aes(x=jc$IDX, ymin=jc$V1-sd(jc$V1), 
ymax=jc$V1+sd(jc$V1)), width=0.25)+
geom_ribbon(aes(x=jc$IDX, y=jc$V1, ymin=error1, 
ymax=error2),fill=ivory2,alpha = 0.4)+
xlab('Iterations') + ylab(Java Collections)+theme_bw()


Thanks,
Mohan

-Original Message-
From: Dennis Murphy [mailto:djmu...@gmail.com]
Sent: Wednesday, June 17, 2015 8:42 PM
To: Radhakrishnan, Mohan (Cognizant)
Subject: Re: [R] Error bars and CI

Q: How do you expect to get error bars when you plot groups having samples of 
size 1? If you are not grouping, then what is the point of trying to 
manufacture variation where none exists? I'd suggest you think a little more 
deeply about what you can achieve with the available data.

This plot visualizes the data you posted. Every point is accounted for. I named 
the input data frame DF.

ggplot(DF, aes(x = IDX, y = V1)) +
   geom_line() + geom_point()

If you don't have replicate data at each unique x-value you want to plot, you 
cannot legitimately plot error bars, confidence intervals or any other visual 
that describes a (summary of) a distribution. If the values of V1 are supposed 
to represent averages that come from other data set, then you should have a 
corresponding column of standard deviations/standard errors, and *then* you can 
plot error bars, CIs, etc. Without a legitimate measure of variation in your 
input data frame, I don't see how you can possibly generate a line graph with 
accompanying error bars/CIs.

Dennis

On Wed, Jun 17, 2015 at 1:13 AM,  mohan.radhakrish...@cognizant.com wrote:
 I think it could be something like this. But the mean is for the entire set. 
 Not groups.
 I get a graph with this code but error bars are not there.


 p-ggplot(jc,aes(IDX,V1,colour=V1))
 p - p + stat_summary(fun.y=mean,geom=point)
 p - p + stat_summary(fun.y=mean,geom=line)
 p - p + stat_summary(fun.data=mean_cl_normal,conf.int = .99,
 geom=errorbar, width=0.2)


 Thanks,
 Mohan

 -Original Message-
 From: Radhakrishnan, Mohan (Cognizant)
 Sent: Wednesday, June 17, 2015 12:54 PM
 To: 'Dennis Murphy'
 Cc: r-help@r-project.org
 Subject: RE: [R] Error bars and CI

 Your sample code is working. But I am missing the logic when my dataset is 
 involved.

 My full dataset is this. It is the V1 column I am interested in.  I am not 
 'grouping' here.

   V1 IDX
 1  0.796   1
 2  0.542   2
 3  0.510   3
 4  0.617   4
 5  0.482   5
 6  0.387   6
 7  0.272   7
 8  0.536   8
 9  0.498   9
 10 0.402  10
 11 0.328  11
 12 0.542  12
 13 0.299  13
 14 0.647  14
 15 0.291  15
 16 0.815  16
 17 0.680  17
 18 0.363  18
 19 0.560  19
 20 0.334  20

 Thanks,
 Mohan

 -Original Message-
 From: Dennis Murphy [mailto:djmu...@gmail.com]
 Sent: Tuesday, June 16, 2015 1:18 AM
 To: Radhakrishnan, Mohan (Cognizant)
 Subject: Re: [R] Error bars and CI

 Hi:

 Firstly, your dplyr code to generate the summary data frame is unnecessary 
 and distracting, particularly since you didn't provide the input data set; 
 you are asked to provide a *minimal* reproducible example, which you could 
 easily have done with a built-in data set.
 That said, to get what I perceive you want, I used the InsectSprays data from 
 the autoloaded datasets package.

 # Function to compute standard error of a mean sem - function(x)
 sqrt(var(x)/length(x))

 ## Use insectSprays data for illustration ## Compute mean and SE of
 count for each level of spray

 library(dplyr)
 library(ggplot2)

 insectSumm - InsectSprays %%
   group_by(spray) %%
   summarise(mean = mean(count), se = sem(count))


 # Since the x-variable is a factor, need to map group = 1 to # draw lines 
 between factor levels. geom_pointrange() can be # used to produce the 99% CIs 
 per factor level, geom_errorbar() # for the mean +/- SE. I ordered the geoms 
 so that the errorbar # is last, but if you want it (mostly) overwritten, put 
 the # geom_pointrange() call last.

 ggplot(insectSumm, aes(x = spray, y = mean)) +
theme_bw() +
geom_line(aes(group = 1), size = 1, color = darkorange) +
geom_pointrange(aes(ymin = mean - 

[R] Grouping in R

2015-06-18 Thread Shivi82
Hi All,

I am working on a data where the total row count is 25+ and have approx.
20 variables. One of the var on which i need to summarize the data is
Consignor i.e. seller name. 

Now the issue here is after deleting all the duplicate names i still have
55000 unique customer name and i am not sure on how to summarize the data.

Is there a possibility that i could create 8 or 10 groups based on the
weight or booking they made from our company and eventually all 55000
customers would fall under these 10 groups. Then it could be easier for me
to analyze in which group there is a variance on a month on month level.




--
View this message in context: 
http://r.789695.n4.nabble.com/Grouping-in-R-tp4708800.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Proc Mixed variance of random effects in R

2015-06-18 Thread Thierry Onkelinx
Dear Gram,

A few things first: Please don't post in HTML, it mangles your text.
R-sig-mixed model is a better list for questions on mixed models. Send
further replies only to that list and not to r-help.

You are probably not fitting the same model in R as the one in SAS. Please
provide the equations of the SAS model and then you can help you translate
that into R code. You are assuming that we all speak SAS, but this is an R
mailing list. The lingua franca among statistical software is mathematics.

Best regards,


ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie  Kwaliteitszorg / team Biometrics  Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to say
what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey

2015-06-17 19:52 GMT+02:00 Grams Robins grams_rob...@yahoo.com:

 Hi, I'm trying to convert the following SAS code in R to get the same
 result that I get from SAS. Here is the SAS code:
 DATA plants;
 INPUT  sample $  treatmt $ y ;
 cards;

 1   trt16.426264755
 1   trt16.95419631
 1   trt16.64385619
 1   trt27.348728154
 1   trt26.247927513
 1   trt26.491853096
 2   trt12.807354922
 2   trt12.584962501
 2   trt13.584962501
 2   trt23.906890596
 2   trt23
 2   trt23.459431619
 3   trt12
 3   trt14.321928095
 3   trt13.459431619
 3   trt23.807354922
 3   trt23
 3   trt22.807354922
 4   trt10
 4   trt10
 4   trt10
 4   trt20
 4   trt20
 4   trt20
 ;
 RUN;

 PROC MIXED ASYCOV NOBOUND  DATA=plants ALPHA=0.05 method=ML;
 CLASS sample treatmt;
 MODEL  y = treatmt ;
 RANDOM int treatmt/ subject=sample ;
 RUN; I get the following covariance estimates from SAS:Intercept
 sample == 5.5795treatmt sample == -0.08455Residual == 0.3181I tried the
 following in R, but I get different results.   options(contrasts = c(factor
 = contr.SAS, ordered = contr.poly))
 df$sample=as.factor(df$sample)
 lmer(y~ 1+treatmt+(1+treatmt|sample),REML=FALSE, data = df) Since the
 results from R are standard deviations, I have to square all results to get
 the variances.sample== 2.357412^2 = 5.557391
 sample*treatmt==0.004977^2 = 2.477053e-05
 residual==0.517094^2 = 0.2673862As shown above, the results from SAS
 and R are different. Do you know how to get the exact values in R?I
 appreciate any help.Thanks,Gram

 [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] R 3.2.1 liftoff

2015-06-18 Thread Peter Dalgaard
The build system sent R-3.2.1.tar.gz (codename World-Famous Astronaut) in 
orbit this morning.

The list below details the changes in this release.

You can get the source code from

http://cran.r-project.org/src/base/R-3/R-3.2.1.tar.gz

or wait for it to be mirrored at a CRAN site nearer to you.

Binaries for various platforms will appear in due course.


For the R Core Team,

Peter Dalgaard


These are the md5sums for the freshly created files, in case you wish
to check that they are uncorrupted:


MD5 (AUTHORS) = eb97a5cd38acb1cfc6408988bffef765
MD5 (COPYING) = eb723b61539feef013de476e68b5c50a
MD5 (COPYING.LIB) = a6f89e2100d9b6cdffcea4f398e37343
MD5 (FAQ) = 181370b39076e34f64b842257076cd5c
MD5 (INSTALL) = 3964b9119adeaab9ceb633773fc94aac
MD5 (NEWS) = 6342bc1164e9f8e17713f47cff1910b4
MD5 (NEWS.0) = bfcd7c147251b5474d96848c6f57e5a8
MD5 (NEWS.1) = eb78c4d053ec9c32b815cf0c2ebea801
MD5 (NEWS.2) = 8e2f4d1d5228663ae598a09bf1e2bc6b
MD5 (R-latest.tar.gz) = c2aac8b40f84e08e7f8c9068de9239a3
MD5 (README) = aece1dfbd18c1760128c3787f5456af6
MD5 (RESOURCES) = a59076c1ac7e9bab0f0a38b3f57a3914
MD5 (THANKS) = ba00f6cc68a823e1741cfa6011f40ccb
MD5 (R-3/R-3.2.1.tar.gz) = c2aac8b40f84e08e7f8c9068de9239a3


This is the relevant part of the NEWS file

CHANGES IN R 3.2.1:

  NEW FEATURES:

* utf8ToInt() now checks that its input is valid UTF-8 and returns
  NA if it is not.

* install.packages() now allows type = both with repos = NULL if
  it can infer the type of file.

* nchar(x, *) and nzchar(x) gain a new argument keepNA which
  governs how the result for NAs in x is determined.  For the R
  3.2.x series, the default remains FALSE which is fully back
  compatible.  From R 3.3.0, the default will change to keepNA = NA
  and you are advised to consider this for code portability.

* news() more flexibly extracts dates from package NEWS.Rd files.

* lengths(x) now also works (trivially) for atomic x and hence can
  be used more generally as an efficient replacement of sapply(x,
  length) and similar.

* The included version of PCRE has been updated to 8.37, a bug-fix
  release.

* diag() no longer duplicates a matrix when extracting its
  diagonal.

* as.character.srcref() gains an argument to allow characters
  corresponding to a range of source references to be extracted.

  BUG FIXES:

* acf() and ccf() now guarantee values strictly in [-1,1] (instead
  of sometimes very slightly outside). PR#15832.

* as.integer() now gives NA (with a warning) as it
  does for the corresponding numeric or negative number coercions.
  Further, as.integer(M + 0.1) now gives M (instead of NA) when M
  is the maximal representable integer.

* On some platforms nchar(x, c) and nchar(x, w) would return
  values (possibly NA) for inputs which were declared to be UTF-8
  but were not, or for invalid strings without a marked encoding in
  a multi-byte locale, rather than give an error.  Additional
  checks have been added to mitigate this.

* apply(a, M, function(u) c(X = ., Y = .)) again has dimnames
  containing X and Y (as in R  3.2.0).

* (Windows only) In some cases, the --clean option to R CMD INSTALL
  could fail.  (PR#16178)

* (Windows only) choose.files() would occasionally include
  characters from the result of an earlier call in the result of a
  later one.  (PR#16270)

* A change in RSiteSearch() in R 3.2.0 caused it to submit invalid
  URLs.  (PR#16329)

* Rscript and command line R silently ignored incomplete statements
  at the end of a script; now they are reported as parse errors.
  (PR#16350)

* Parse data for very long strings was not stored.  (PR#16354)

* plotNode(), the workhorse of the plot method for dendrograms is
  no longer recursive, thanks to Suharto Anggono, and hence also
  works for deeply nested dendrograms.  (PR#15215)

* The parser could overflow internally when given numbers in
  scientific format with extremely large exponents.  (PR#16358)

* If the CRAN mirror was not set, install.packages(type = both)
  and related functions could repeatedly query the user for it.
  (Part of PR#16362)

* The low-level functions .rowSums() etc. did not check the length
  of their argument, so could segfault. (PR#16367)

* The quietly argument of library() is now correctly propagated
  from .getRequiredPackages2().

* Under some circumstances using the internal PCRE when building R
  fron source would cause external libs such as -llzma to be
  omitted from the main link.

* The .Primitive default methods of the logic operators, i.e., !, 
  and |, now give correct error messages when appropriate, e.g.,
  for ``(TRUE) or `!`().  (PR#16385)

* cummax(x) now correctly propagates NAs also when x is of type
  integer and begins with an NA.

* summaryRprof() could fail 

Re: [R] Cross tabulation with top one variable and side as multiple variables

2015-06-18 Thread jagadishpchary
I think my explanation in the post is not giving the full details on the job
to be done. Sorry for that. Here is what I am doing..

1.  I have a SPSS data set with more than 2000 variables. However for test
purpose I have created a temporary data set with 5 variables which I am
reading it to R environment (Attached the test.sav file).
2.  There is a variable called “TREND” which has the year data. So all I 
need
to do is cross tabulate the variables with this Trend variable. 
In SPSS the syntax would be

CTABLES
/VLABELS VARIABLES =ALL DISPLAY=LABEL
/TABLES (AGET +SEXT +EDUCRT +JOBRT ) [COUNT F40.0] by TREND.

The final cross tabulation results are placed in the attached excel report
with sheet name “Results”.

As I am new to R  - I tried searching the forums for the cross tabulation
with top variable constant and multiple variables as side however I could
not find it. Anyhow I tried using the below syntax :

Xtabs ( ~ AGET +SEXT +EDUCRT +JOBRT + TREND, data=mydata)
summary(~AGET +SEXT +EDUCRT +JOBRT, data= mydata, fun=table)
ftable (mydata, row.vars=c(AGET ,  SEXT ,  EDUCRT  , “JOBRT”),
col.vars=TREND)

the results are not identical to what I am getting in SPSS

Hence I would request to suggest me a R code that helps me in getting the
results as shown in the attached excel report with sheet name “Results”.
Test.sav http://r.789695.n4.nabble.com/file/n4708799/Test.sav  
Cross_tabulation.xlsx
http://r.789695.n4.nabble.com/file/n4708799/Cross_tabulation.xlsx  




--
View this message in context: 
http://r.789695.n4.nabble.com/Cross-tabulation-with-top-one-variable-and-side-as-multiple-variables-tp4708379p4708799.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

[R] Correlation matrix for pearson correlation (r,p,BH(FDR))

2015-06-18 Thread Sarah Bazzocco
This post was called help before, I changed the Subject.
Thanks for the comments.
Here the example: (I have the two lists saved as .csv and I can open them in R)

Sheet one- Genes (10 genes expression, not binary, meaured in 10 cell lines)
 genes
 Genes  Cell.line1 Cell.line2  Cell.line3  Cell.line4  Cell.line5
1   KCNAB3 12.02005181 11.1400910 15.60381163 13.44151596 25.37161030
2KCNB1  0.02457449  1.3028535  0.81538294  0.59318327  0.15332321
3KCNB2  0.44791862  0.1060137  0.09864136  0.  0.
4 KERA  0.06090217  0.000  0.03352993  0.03634781  0.04190912
5   KGFLP1  0.02450101  0.000  0.  0.  0.
6   KGFLP2  0.  0.000  0.  0.  0.
7KHDC1  0.  0.000  0.  0.  0.
8   KHDC1L  2.31894450  2.8252262  5.29099724  7.44183228  1.94629741
9   KHDC3L  0.  0.000  0.  0.  0.
10 KHDRBS1  0.  0.000  0.  0.  0.
   Cell.line6 Cell.line7  Cell.line8  Cell.line9 Cell.line10
1  8.12373424 7.67506261 24.43776341 18.332448189.224225
2  4.18181234 1.65268403  5.98346320  1.514238070.00
3  0.05857207 0.05945414  0.20733924  0.058309820.00
4  0. 0.  0.07752608  0.01585643   16.664245
5  0.02563099 0.03902548  0.  0.0.00
6  0. 0.  0.  0.0.00
7  0. 0.  0.  0.0.00
8  8.56022436 7.50838343  7.17964645  3.286027290.00
9  0. 0.  0.  0.3.598534
10 0. 0.03081180  0.  0.2.600173

Sheet two - features (2 features(Growth rate,drug sensitivity for 10 cell lines)
 features
 Cell.line Cell.line1 Cell.line2 Cell.line3 Cell.line4 Cell.line5
1  Growth rate NA NA NA  51.41 NA
2 Drug sensitivity   5.03   6.57  8   1.26  3
  Cell.line6 Cell.line7 Cell.line8 Cell.line9 Cell.line10
1  41.33  26.76  24.19 NA  NA
2   1.40   1.88   1.33   5.059.12

What I found:
corr.test {psych}
corr.test(x, y = NULL, use = pairwise,method=pearson,adjust=BH,alpha=.01)
-- I adjusted the original command to what I need (BH insted og holm) and 
alpha=.01 insted of 0.05.

I would be very happy, if someone could show me how to use this command, in 
particular how to refer as x and y to the two sheets I have (Genes and 
Features). I would take it from there.

Thanks a lot in advance.

Sarah






- Original Message -
From: Rainer Schuermann rainer.schuerm...@gmx.net
To: Sarah Bazzocco sarah.bazzo...@vhir.org
Sent: Thursday, 18 June, 2015 8:14:56 AM
Subject: Re: [R] help



Hi Sarah, 

  

Not an answer to our question but a piece of well intended advice: 

  

1. Don't post HTML but plain text. Not only that people will tell you this in a 
sometimes not very friendly manner - using HTML actually does make posts 
illegible in this mailing list. Code, and R _is_ code, is always plain text. 

  

2. Don't pose an abstract problem - this looks too much like Can you please do 
my work for me. Show us what you have tried already, and people will happily 
jump in and provide their thoughts and advice. 

  

3. Always make sure that you ave a reproducible example in your mail, and a set 
of data of the same type and structure you are using - ideally using dput(). 

  

See further advice here 

  

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

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

  

and here: 

  

http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
 

  

For your problem, R has an immense wealth of ideas and solutions. 

  

Rgds, 

Rainer 

  

  

  

On Wed June 17 2015 16:57:24 Sarah Bazzocco wrote: 

 

 Hello, 

 

 � 

 

 I am a R-beginner and I need some help.�The question is very simple: I need 
 to do a pearson correlations (r,p-value and FDR with BH) from an Expression 
 array (with several thousand genes for lets say 20 cell lines)�with some 
 features of those cell lines. 

 

 

 

 My problem I have is the organization of the excel sheets and how to 
 introduce the data into R and run the script. I though the easiest and more 
 organized for me would be two expcel sheets: 

 

 1- Only Expression data (in rows the�genes and in colums cell lines) 

 

 2- Only the features (In row the features (e.g. a) growth rate, b) 
 sensitivity to some drugs) and in columns the cell lines). 

 

 

 

 --That would creat both sheets with 20 colums. 

 

 

 

 Now I would like to get a correlation of the gene 1: the expression of all 
 lines with the growth rate. 

 

 the same for gene2... and soforth. I sould obtain as many r,p and BH(FDR) as 
 genes there are. 

 

 the same I would need to do for the sensitivity... and so on. 

 

[R] Completing Unordered Categorical missing variables using package mi

2015-06-18 Thread IOANNA IOANNOU
Hello all, 

 

A perhaps simple question. I am trying to complete unordered categorical
missing data using mi package. There are two variables with missing data:
Mat and Use. The problem is that the Use has several categories and somehow
this means I can't plot the results as I get this error. Any idea how to fix
the problem?

Any help much appreciated, 

Best, 

Ioanna

 

new-read(Sample.csv)

new$Use-factor(new$Use)

MissingData - missing_data.frame(new)

MissingData - change(MissingData, y = DS, what = type, to =
ordered-categorical)

 

# STEP 3: look deeper

summary(MissingData)

summary(MissingData@patterns)

show(MissingData)

hist(MissingData)

 

 

# STEP 4: impute

## Not run: 

IMPsample - mi(MissingData)

 

 

#STEP5: diagnostics

Plot(IMPsample)

 

Error in `rownames-`(`*tmp*`, value = c(Oc11, Oc12, Oc13, Oc14,  : 

  length of 'dimnames' [1] not equal to array extent

 

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.