[R] pass nrow(x) to dots in function(x){plot(x,...)}

2011-02-02 Thread Marianne Promberger
x , ... ) } myfun(m1, main=paste("n = ",ns) ) ns is not found So, basically, how do I assign an object inside a function that I can then access in the dots when executing the function? Many thanks Marianne -- Marianne Promberger PhD, King'

[R] cross tabulate variables by subject id

2010-11-29 Thread Marianne Promberger
variable: dat1$condnew <- paste(dat1$cond1,dat1$cond2,sep="") although I am sure there are more elegant ways, and especially, I am stumped how to fill in the cells of the table. Thanks, Marianne -- Marianne Promberger PhD, King's College London http://promberger.info R version

Re: [R] Number above the bar?

2010-11-11 Thread Marianne Promberger
Hi Joel, > I got an barplot, and I would like to have the exact number of the bars just > above the bars anyone know how to do this? Google "r number above bars barplot" for threads on this list how to do it and why you might not want to. ?text Marianne -- Marianne Prombe

Re: [R] help to add a new column filled with value 1

2010-11-09 Thread Marianne Promberger
name id memory storage newcol 1 mohan 1 100.2 1.1 1 2 ram 1 200.0 100.0 1 3 kumar 1 400.050.0 1 4 xxx 1 100.040.0 1 5 aaa 1 800.045.0 1 6 mount 1 200.080.0 1 main[,c(1,5,2,3,4)] # order columns by indexing -- Marianne Pro

Re: [R] help to merge two data frame if name matches

2010-11-09 Thread Marianne Promberger
1.1 112 0.01 4 mount 1 200.080.0 0 0 0.00 5 ram 1 200.0 100.0 0 0 0.00 6 xxx 1 100.040.0 1 0 1.11 Marianne -- Marianne Promberger PhD, King's College London http://promberger.info R version 2.12.0 (2010-10-15) Ubuntu 9.04 ___

Re: [R] How to extract Friday data from daily data.

2010-11-09 Thread Marianne Promberger
here. You could work on a solution along the same lines except have the days ordered in the order of your "top choice" above (or inverse), then pick the first (or last) entry that exists for that week. Of course, since your choice order is not chronologlical you probably can't use

Re: [R] new column from column in another df

2010-11-09 Thread Marianne Promberger
fugelpitch 09-Nov-10 12:28: > ...how can I create a new column in the first data frame where growth form > is picked up from the second data frame (also factors) and entered into all > rows for a species as follows: ?merge eg dat1 <- merge(dat1,dat2) Marianne -- Marianne Pr

Re: [R] R Founding

2010-09-17 Thread Marianne Promberger
d a few days ago. You can say I'm stupid and didn't look hard enough, but from a usability/ marketing perspective this means even this cumbersome possibility is not salient enough at the moment. -- Marianne Promberger PhD, King's College London http://promberger.info R version 2.11.

[R] Index list by other list (w/ logical elements)?

2010-08-24 Thread Marianne Promberger
; y, that is, the result in this case should be: z [[1]] [1] "one" [[2]] [1] "four" "five" I was hoping sapply(x,"[",y) would work, but it doesn't. I guess I need to sapply twice, like sapply(x, function() { sapply(y ... but I can't figure it ou

Re: [R] deleting column from data frame

2010-02-23 Thread Marianne Promberger
test[,!colnames(test)%in%"Y"] test[,-grep("Y",colnames(test))] bw, Marianne -- Marianne Promberger PhD, King's College London http://promberger.info R version 2.10.1 (2009-12-14) Ubuntu 9.10 __ R-help@r-project.org mailing li

Re: [R] env() for lme4

2010-02-22 Thread Marianne Promberger
all.packages("lme4a",repos="http://R-Forge.R-project.org";) (But then something didn't work with profile() on my particular model but I forgot what it was -- haven't had time to pursue this yet) -- Marianne Promberger PhD, King's College

Re: [R] gsub patterns from vector elements w/out loop?

2010-02-22 Thread Marianne Promberger
> > gsub(paste(x, collapse = "|"), "something else", y) > [1] "something else blah" "something else blah" "something else blah" > [4] "something else blah" Many thanks! I didn't know about "collapse". Should

[R] gsub patterns from vector elements w/out loop?

2010-02-22 Thread Marianne Promberger
because I lack the mental flexibility to combine the fact that I am applying gsub() to y but now want to apply that to x ... erm. :/ Marianne -- Marianne Promberger PhD, King's College London http://promberger.info R version 2.10.1 (2009-12-14) Ubuntu 9.10 ___

Re: [R] Help with R in ubuntu

2010-02-01 Thread Marianne Promberger
project.org/bin/linux/ubuntu/ Marianne -- Marianne Promberger PhD, King's College London http://promberger.info R version 2.10.1 (2009-12-14) Ubuntu 9.04 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

Re: [R] read.csv to read output of system()?

2009-12-12 Thread Marianne Promberger
2 one this is a comment;with commas. three Wonderful, thanks a lot! Marianne -- Marianne Promberger PhD, King's College London http://promberger.info R version 2.10.0 (2009-10-26) Ubuntu 9.04 __ R-help@r-project.org mailing list https://stat.ethz.

Re: [R] read.csv to read output of system()?

2009-12-12 Thread Marianne Promberger
tried was pipe( ... file.csv |") (with a Unix pipe symbol a the end) Thanks! Jon Baron 12-Dec-09 16:21: > gsub(readLines("file.csv"),",",";") Using gsub would be even neater, as it would really be self-contained in R. gsub("( [A-Za-z]+),","\\

[R] read.csv to read output of system()?

2009-12-12 Thread Marianne Promberger
/,/;/' file.csv")) # this does not work I think the answer must be in ?connections, maybe pipe() but I have fiddled with these and cannot figure it out. Marianne -- Marianne Promberger PhD, King's College London http://promberger.info R version 2.10.0 (2009-10-26) Ubuntu 9.0

Re: [R] R script From PHP

2009-12-01 Thread Marianne Promberger
elbuettel.com/code/littler.html might come in handy as well. -- Marianne Promberger PhD, King's College London http://promberger.info R version 2.10.0 (2009-10-26) Ubuntu 9.04 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinf

[R] "Use R" -- term and logo copyright?

2009-10-09 Thread Marianne Promberger
available -- sorry if I overlooked the information online somewhere. Marianne -- Marianne Promberger PhD, King's College London http://promberger.info R version 2.9.2 (2009-08-24) Ubuntu 9.04 __ R-help@r-project.org mailing list https://stat.eth

Re: [R] add lines() to 1st plot in layout() after calling 2nd plot()?

2009-10-04 Thread Marianne Promberger
ut. Instead, I found a warning that suggests > incompatibility (since mpg is explicitly tied to mfrow in ?par and > layout is said incompatible with par(mfrow)). Indeed. I did look around ?par, but due to this warning thought anything relating to mfrow() and mfcol() would not work anyway.

Re: [R] add lines() to 1st plot in layout() after calling 2nd plot()?

2009-10-04 Thread Marianne Promberger
es() still go to the "right plot" plot (now on the left hand side) which gets called last. The par(mar ... of the "scatterplot with marginal histograms" example just set the margins of the histogram plots, then they get plotted to the region with the next number given in the layou

Re: [R] if else statement error

2009-10-03 Thread Marianne Promberger
https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Marianne Promberger PhD, King's College London http://promberger.info R version 2.9.2 (2009-

[R] add lines() to 1st plot in layout() after calling 2nd plot()?

2009-10-03 Thread Marianne Promberger
ands in this order: layout(matrix(c(1,2),1)) plot(1:10,main="left plot") plot(10:1,main="right plot") lines(c(3:7,7:3),col="red") but of course now lines() gets added to the "right plot". I Is there any way to make the lines() go to the fist plot ("left

Re: [R] .Rprofile file

2009-10-02 Thread Marianne Promberger
stle.edu.au/R/devel/05/12/3454.html Marianne -- Marianne Promberger PhD King's College London London SE1 9RT Phone: 020 7188 2590 GnuPG/PGP public key ID 80AD9916 .tex .bib .R .Rnw files welcome __ R-help@r-project.org mailing list https://stat.e

[R] get function to return object "name"?

2009-09-02 Thread Marianne Promberger
, and the plot should have the title "s1" if I've called myplot(s1), "s2" if myplot(s2), etc. I'm sure I'll be really embarrassed that this is so trivial but I cannot figure it out. Marianne -- Marianne Promberger PhD King's College London __

Re: [R] ggplot, qplot: alpha channel for colors corresponding to factor

2009-06-10 Thread Marianne Promberger
answer does not > ensure that a reasonable answer can be extracted from a given body of > data. > ~ John Tukey > > -Oorspronkelijk bericht- > Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > Namens Marianne Promberger > Verzonden: woensdag 10 juni

[R] ggplot, qplot: alpha channel for colors corresponding to factor

2009-06-10 Thread Marianne Promberger
l),jitter(Better.adapt),colour=I(alpha(Second.adapt,1/5)),data=d1) Thanks for any pointers, Marianne -- Marianne Promberger PhD http://www.psych.upenn.edu/~mpromber PGP/GnuPG public key ID 80AD9916 __ R-help@r-project.org mailing list https://stat.et

[R] ggplot: order of numeric factor levels?

2009-03-31 Thread Marianne Promberger
Hi, I'm having problems with qplot and the order of numeric factor levels. Factors with numeric levels show up in the order in which they appear in the data, not in the order of the levels (as far as I understand factors!) Here is a minimal example: library(ggplot2) y <- c(-1,2,0,0,-2,-1) z <-

Re: [R] Digest setting won't "take"

2008-10-31 Thread Marianne Promberger
okies enabled in my browser. m. -- Marianne Promberger Graduate student in Psychology http://www.psych.upenn.edu/~mpromber __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-pro

Re: [R] [SOLVED] barchart for aggregated (sum) data in lattice?

2008-10-05 Thread Marianne Promberger
"|" factor notation in lattice, like barchart(xtabs(amount~what)|month or so. Sorry for the clutter. m. On Sunday, 05 October 2008, 18:12 (UTC+0100), Marianne Promberger wrote: > Hi list, > > I have data in a dataframe t1, with a column for different amounts > spent, a column wha

[R] barchart for aggregated (sum) data in lattice?

2008-10-05 Thread Marianne Promberger
ies. I figured I can do this with traditional graphics using: barplot(xtabs(amount~what+month, data=t1),beside=T) But I'd like to be able to do this in lattice. I tried: barchart(amount~what|month,t1) But that doesn't sum the data for t1$amount for each month first. How could I

Re: [R] remove multiple elements from vector

2008-09-28 Thread Marianne Promberger
On Saturday, 27 September 2008, 15:30 (UTC+0200), Bastian Offermann wrote: > Hello all, > > one brief question > > I would like to remove double/triple elements from a vector, e.g. > > 0 1 1 1 1 2 2 2 4 5 6 6 > > but keep one of these multiple ones. Should look like this finally: > > 0 1 2 4 5 6

Re: [R] include scripts into main file (the LaTeX way)

2008-09-26 Thread Marianne Promberger
#x27;ve used source() for that. m. -- Marianne Promberger Graduate student in Psychology http://www.psych.upenn.edu/~mpromber __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide ht

Re: [R] axis in a normal plot

2008-09-26 Thread Marianne Promberger
n't print this e-mail unless you really need to > > > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-hel

Re: [R] Pie chart and labels

2008-09-08 Thread Marianne Promberger
),labels=c("what","ever","you","want","duh")) ?pie would have told you this, too. m. -- Marianne Promberger Graduate student in Psychology http://www.psych.upenn.edu/~mpromber __ R-help@r-project.or

Re: [R] Beginner graphics device questions.

2008-09-08 Thread Marianne Promberger
pen another plotting more plots with bmp() or maybe x11() or whatnot and close them explicitly by giving hte number from dev.list() for full info ?dev.off HTH m. -- Marianne Promberger Graduate student in Psychology http://www.psych.upenn.edu/~mpromber __

Re: [R] Saving functions

2008-09-08 Thread Marianne Promberger
OSes. Maybe google "Rprofile". HTH m. -- Marianne Promberger Graduate student in Psychology http://www.psych.upenn.edu/~mpromber __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

Re: [R] I don't know how to run a r-code written in emacs

2008-09-06 Thread Marianne Promberger
ernatively there are special commands available, look at the menu in Emacs. If you have Emacs anyway, ESS is much more convenient than running from the console. m. -- Marianne Promberger Graduate student in Psychology http://www.psych.upenn.edu/~mpromber __

Re: [R] another histogram question

2008-09-01 Thread Marianne Promberger
; http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Marianne Promberger Graduate student in Psychology http://www.psych.upenn.edu/~mpromber __ R-help@r-project.org mailing list https://st

Re: [R] need help for building R in Ubuntu 8.04

2008-05-25 Thread Marianne Promberger
ling-and-updating-r-with-aptitude/ I'm currently using 7.10 so not 100 percent sure if this works in 8.04. m. -- Marianne Promberger Graduate student in Psychology http://www.psych.upenn.edu/~mpromber __ R-help@r-project.org mailing list https://st

Re: [R] dividing the data

2008-05-23 Thread Marianne Promberger
t; and the other with people more than 50 years of age. Assuming you have your data in a dataframe x with one column called "age" (get the data into R e.g. with read.csv) young <- x[x$age < 50,] write.table(young,file="young.txt") etc. m. -- Marianne

Re: [R] Rank Values in a Matrix

2008-05-21 Thread Marianne Promberger
> > 0->0 > 0.1->1 > 2->2 > 3->3 > 50->4 > 100->5 (X=5) > Does this do what you want? x <- matrix(c(3,100,0.1,3,100,2,5,0,0,50),5) y <- as.data.frame(table(x)) y$Rank <- rank(y$x) m. -- Marianne Promberger Graduate student in Psychology http:/

Re: [R] Starting R from .RData in linux

2008-05-20 Thread Marianne Promberger
ssible to start R by clicking >> the .RData file in linux as in Windows? >> I've tried with ubuntu hardy using >> the right button and selecting R, but does >> not work. Is there any way to set it up? > > Marianne Promberger Wrote: >> You presumably need to associ

Re: [R] Startin R from .RData in linux

2008-05-19 Thread Marianne Promberger
this works. On Ubuntu, your terminal is probably something else and may have different syntax. (gnome-terminal maybe? then man gnome-terminal in case the -e option doesn't work for you). m. -- Marianne Promberger Graduate student in Psychology http://www.psych.upenn.edu/~mpromber ___

Re: [R] help for the first poster- a simple question

2008-03-03 Thread Marianne Promberger
On 03/03/08 12:52, Xuejun Qin wrote: > Hi, there, > I cannot get accurate value for calculation. > for example: > ld<-sqrt(1*0.05*0.95*0.05*0.95) > 0.05*0.95-ld=-6.938894e-18 > 0.05*0.95-ld==0 is False. > > I met this problem in my program, how can I handle it. Thanks. I think what you are ex