[R] Filling Empty Column with String in read.table

2009-09-16 Thread Gundala Viswanath
I have a data file that looks like this. __DATA__ D7KAR5Z02F447V 176 G 0.22 D7KAR5Z02J3WLG 94 A 1.0529 D7KAR5Z02F4K6L 198 a 0.13 D7KAR5Z02J4SYO 67 C 0.9528 D7KAR5Z02J4SYO 83 C 1.0129 D7KAR5Z02J4SYO 97 T 0.13 D7KAR5Z02J4SYO 166 A 0.9427 I want the rows whe

[R] inline error message

2009-09-16 Thread _
Hi all, I installed the library inline to my default R-enviroment (c:\Programme\R.. ) downloaded and installed RTools from http://www.murdoch-sutherland.com/Rtools/ to c:\Rtools. Path variable is set right (with respect to order) but I get still the error message from my R Error in compileCod

[R] boxplot

2009-09-16 Thread Sukhbir Rattan
Hi, I m not able to plot normalized data(normalization by rma) using boxplot. I don't know why? basically, object(formed of normalized data) belong to ExpressionSet class. It is showing error Error in x[!xna] : object of type 'S4' is not subsettable In addition: Warning messages: 1: In is.na(x)

Re: [R] Fastest Way to Divide Elements of Row With Its RowSum

2009-09-16 Thread William Revelle
At 2:40 PM +0900 9/17/09, Gundala Viswanath wrote: I have a data frame (dat). What I want to do is for each row, divide each row with the sum of its row. The number of row can be large > 1million. Is there a faster way than doing it this way? datnorm; for (rw in 1:length(dat)) { tmp <- dat

[R] Fastest Way to Divide Elements of Row With Its RowSum

2009-09-16 Thread Gundala Viswanath
I have a data frame (dat). What I want to do is for each row, divide each row with the sum of its row. The number of row can be large > 1million. Is there a faster way than doing it this way? datnorm; for (rw in 1:length(dat)) { tmp <- dat[rw,]/sum(dat[rw,]) datnorm <- rbind(datnorm, tmp

[R] Partitioning analysis

2009-09-16 Thread lucacorlatti
Dear all, does anybody know whether it is possible to run a hierarchical partitioning analysis that includes interactions between predictors? And if so, what is the script to be used in R? So far, I've run only partitioning analisys based on additive models (e.g. Y~X+Z), and I couldn't find any

[R] poisson lognormal regression

2009-09-16 Thread hossain zamani
Dear all, I want to directly write the loglike function of poisson- lognormal regression and then estimate the parameters. the response (Y)is count and I have two explanatory variable (x1:nominal) and (x2:continiuouse). which package in R can be used ?.How can input the data and write the loglik

Re: [R] Which one shall I use? '=' or '<-'?

2009-09-16 Thread Cedrick Johnson
I don't have the link off the top of my head, but if you search the archives and look for 'R Google Style Guide' or 'Google R Style' there was quite an interesting conversation thread regarding the use of the two, mostly for readability purposes... -cj Peng Yu wrote: Hi, I was told to use

[R] rJava .jinit() : Cannot create Java virtual machine (-1)

2009-09-16 Thread _
Hi all, when using .jinit() I get the message .jinit() : Cannot create Java virtual machine (-1). I set the classpath variable to jre and to the jdk but nothing works. > Sys.getenv("CLASSPATH") CLASSPATH "C:\\Programme\\Java\\jre6\\bin" > Sys.getenv("CLASSPATH")

Re: [R] Collecting data in a data structure

2009-09-16 Thread Richard M. Heiberger
There are two issues here. The specifics of the error message are because you declared a data.frame with 0 columns and then attempted to change two columns. > data.frame() data frame with 0 columns and 0 rows > q <- data.frame() > q[1,] <- data.frame(a=3, b=6) Warning in `[<-.data.frame`(`*tmp*`

[R] Collecting data in a data structure

2009-09-16 Thread Worik R
Friends I cannot find this documented anyplace. I have a data frame with, say, 2 cols d<-data.frame(x=c(1:5), y=seq(from=2, to=10, by=2)) > d x y 1 1 2 2 2 4 3 3 6 4 4 8 5 5 10 And I want to collect each row where the first col is prime. To this end I have a function is.prime() I want

[R] solve heywood case within R

2009-09-16 Thread Yin Chang
Hello. Sorry to bother you, but this is the email address I got from r-help... I am wondering if R has some similar command like SAS to solve heywood cases. If there some related functions/program, would you give me some help on that? Thank you very much. With regards, Yin Chang _

[R] How to extract data.frame columns using regex?

2009-09-16 Thread Peng Yu
Hi, data.frame(x1=1:11,x2=2:12,x3=3:13,y=4:14) I want to extract all the columns that with the name 'x?'. Is there a general way to do this in R? Regards, Peng __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

[R] Which one shall I use? '=' or '<-'?

2009-09-16 Thread Peng Yu
Hi, I was told to use "<-" instead of "=" in the mailing list. I am wondering what the difference between them? Regards, Peng __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www

Re: [R] What is the best way to get a subset of a data.frame?

2009-09-16 Thread Jorge Ivan Velez
Hi Peng, Take a look at Juliet Hannah's post at http://www.nabble.com/correct-way-to-subset-a-vector-to24412577.html#a24412577 for some alternatives. HTH, Jorge On Wed, Sep 16, 2009 at 10:14 PM, Peng Yu <> wrote: >

Re: [R] R console line-wrapping

2009-09-16 Thread David Winsemius
On Sep 16, 2009, at 9:40 PM, Nick Matzke wrote: David Winsemius wrote: On Sep 15, 2009, at 5:47 PM, Nick Matzke wrote: Hi all, a quick question I couldn't find the answer to in the usual places: Is there a way to turn off line-wrapping in the R console? Or set the line width-before-wra

Re: [R] how to categorize continuous variable when useing regression

2009-09-16 Thread Frank E Harrell Jr
Manli Yan wrote: assume dependent variable y( continuous),independent variable x ( continuous),I try to categorize x with some interval,such that,those intervals would has most significant different effect on y. any one knows which method I should apply,I know it will cause the loss of

[R] What is the best way to get a subset of a data.frame?

2009-09-16 Thread Peng Yu
Hi, I want to construct a data.frame 'y' by using x$x and x$y. I think that there might be better ways to do it (because, for example, we can use a_matrix[3:5,] to extract certain rows, where 'a_matrix' is a matrix). Can somebody let know what the best way is? > a=data.frame(x=1:10,y=rep("abc",10

Re: [R] Generalized cumsum?

2009-09-16 Thread David Winsemius
On Sep 16, 2009, at 9:31 PM, OKB (not okblacke) wrote: David Winsemius wrote: cumapply <- function (FUN, X) { FUN <- match.fun(FUN) answer <- sapply(1:length(X), function(x) { FUN(X[1:x])} ) return(answer)} Cool, thanks. It's still interesting to me that there's no such thing

Re: [R] Why strsplit can be used with matrix but not data.frame?

2009-09-16 Thread David Winsemius
On Sep 16, 2009, at 9:41 PM, Peng Yu wrote: On Wed, Sep 16, 2009 at 8:30 PM, David Winsemius > wrote: On Sep 16, 2009, at 9:22 PM, Peng Yu wrote: Hi, As show in the code below, strsplit can be applied to a matrix but not a data.frame. I don't understand why R is designed in this way. Can

Re: [R] R console line-wrapping

2009-09-16 Thread Nick Matzke
David Winsemius wrote: On Sep 15, 2009, at 5:47 PM, Nick Matzke wrote: Hi all, a quick question I couldn't find the answer to in the usual places: Is there a way to turn off line-wrapping in the R console? Or set the line width-before-wrapping manually? Currently it looks like the conso

Re: [R] how to categorize continuous variable when useing regression

2009-09-16 Thread Wensui Liu
there are so many ways to categorize the continuous variable in practice, such as knowledge-based, percentile-based, or model-based (i.e. regression tree). On Wed, Sep 16, 2009 at 9:41 PM, Manli Yan wrote: > assume dependent variable y( continuous),independent variable x ( > continuous),I t

Re: [R] Generalized cumsum?

2009-09-16 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of OKB (not okblacke) > Sent: Wednesday, September 16, 2009 6:04 PM > To: r-h...@stat.math.ethz.ch > Subject: Re: [R] Generalized cumsum? > > David Winsemius wrote: > > >>

Re: [R] Why strsplit can be used with matrix but not data.frame?

2009-09-16 Thread Peng Yu
On Wed, Sep 16, 2009 at 8:30 PM, David Winsemius wrote: > > On Sep 16, 2009, at 9:22 PM, Peng Yu wrote: > >> Hi, >> >> As show in the code below, strsplit can be applied to a matrix but not >> a data.frame. I don't understand why R is designed in this way. Can >> somebody help me understand it? Ho

[R] how to categorize continuous variable when useing regression

2009-09-16 Thread Manli Yan
assume dependent variable y( continuous),independent variable x ( continuous),I try to categorize x with some interval,such that,those intervals would has most significant different effect on y. any one knows which method I should apply,I know it will cause the loss of information,but can

Re: [R] Generalized cumsum?

2009-09-16 Thread OKB (not okblacke)
David Winsemius wrote: > cumapply <- function (FUN, X) > { FUN <- match.fun(FUN) > answer <- sapply(1:length(X), function(x) { FUN(X[1:x])} ) > return(answer)} Cool, thanks. It's still interesting to me that there's no such thing built-in. Best wishes, -- --OKB (not okbl

Re: [R] Why strsplit can be used with matrix but not data.frame?

2009-09-16 Thread David Winsemius
On Sep 16, 2009, at 9:22 PM, Peng Yu wrote: Hi, As show in the code below, strsplit can be applied to a matrix but not a data.frame. I don't understand why R is designed in this way. Can somebody help me understand it? How to split all the strings in x$y? x=data.frame(x=1:10,y=rep("abc",10))

Re: [R] Why strsplit can be used with matrix but not data.frame?

2009-09-16 Thread Henrik Bengtsson
Hi, have a look at help(str) - the str() function will be your friend for life! ...and 99.9% of the error message in R are indeed correct, on the spot and informative. So, try str(x$y). My $.02 /Henrik On Wed, Sep 16, 2009 at 6:22 PM, Peng Yu wrote: > Hi, > > As show in the code below, strsp

[R] Why strsplit can be used with matrix but not data.frame?

2009-09-16 Thread Peng Yu
Hi, As show in the code below, strsplit can be applied to a matrix but not a data.frame. I don't understand why R is designed in this way. Can somebody help me understand it? How to split all the strings in x$y? x=data.frame(x=1:10,y=rep("abc",10)) strsplit(x$y,'b') #Error in strsplit(x$y, "b") :

Re: [R] Generalized cumsum?

2009-09-16 Thread David Winsemius
On Sep 16, 2009, at 9:04 PM, OKB (not okblacke) wrote: David Winsemius wrote: No, Reduce reduces an entire vector to a single value by repeatedly combining adjacent elements. I'm looking to convert a vector to another vector where each element is some arbitrary aggregating function

Re: [R] Beginner Q- dates in the xrange?

2009-09-16 Thread Gabor Grothendieck
You want to make sure your dates are of Date class, not character class. Since this is evidently an irregular time series you might want to try out plot.zoo: library(zoo) # convert to zoo z <- with(results, zoo(DIFF, as.Date(date))) # plot plot(cbind(z, z), screen = 1, type = c("p", "l"), lwd =

Re: [R] Generalized cumsum?

2009-09-16 Thread OKB (not okblacke)
David Winsemius wrote: >> No, Reduce reduces an entire vector to a single value by >>repeatedly >> combining adjacent elements. I'm looking to convert a vector to >> another vector where each element is some arbitrary aggregating >> function applied to the first n elements of t

Re: [R] Beginner Q- dates in the xrange?

2009-09-16 Thread jim holtman
try this with your data: you had character data in the 'date' field; need to convert to Date # convert the character 'date' to a Date object results$date <- as.Date(results$date) plot(results$date, results$DIFF, type='l') On Wed, Sep 16, 2009 at 8:40 PM, Wells Oliver wrote: > Follow up with ac

Re: [R] Beginner Q- dates in the xrange?

2009-09-16 Thread Wells Oliver
Follow up with actual data and what I'm trying to do. Current R code/script: plot(results$DIFF, xaxt="n", ylab="Differential", xlab="2009") daterange=c(as.POSIXlt(min(results$date)),as.POSIXlt(max(results$date))) axis.POSIXct(1, at=seq(daterange[1], daterange[2], by="month"), format="%b") lines(res

Re: [R] Matching data.

2009-09-16 Thread jim holtman
try this: > set.seed(1) > mat <- matrix(sample(1:2, 30, TRUE), ncol=3) # test data > pat <- c(1, 2, 1) # find matches > mat [,1] [,2] [,3] [1,]112 [2,]111 [3,]222 [4,]211 [5,]121 [6,]211 [7,]221 [8,

[R] Beginner Q- dates in the xrange?

2009-09-16 Thread Wells Oliver
Hi all- terribly beginner question here, but I can't figure out how to put dates as the values for my x range in a plot. Example: xrange <- results$current yrange <- results$DIFF plot(xrange, yrange, type="n", xlab="Date", ylab="Differential") lines(results$DIFF, type="l", lwd=1.5, col="red") Whe

Re: [R] using filter while Reading files -

2009-09-16 Thread jim holtman
Here is one way to create a list of dataframe with the names in TABLE: > x <- readLines('/tempxx.txt') # read in your data > # assume that 'x' was read in with readLines > input <- textConnection(x) > # find the "TABLE" lines and use as the names of the dataframes to read > indx <- c(grep("^TABLE

Re: [R] installation problem

2009-09-16 Thread Michael Bibo
Uwe Ligges statistik.tu-dortmund.de> writes: > or just say > > install.packages("XML") > > as that CRAN extras repository is already a default under Windows. > > Best, > Uwe Ligges > Thanks, Uwe. I had tried that, with no success. It turned out that starting R with the "--internet2" optio

[R] Matching data.

2009-09-16 Thread Ubirajara
Hello. I have a three column matrix named x, each one with a numeric value. Given a three element vector, is there any function that finds the row where the values match? Thanks in advance. Ubirajara Albeton __ R-help@r-proj

Re: [R] using filter while Reading files -

2009-09-16 Thread Gabor Grothendieck
Check out ?read.csv.sql in the sqldf package. A single read.csv.sql statement will: - read the data directly into sqlite without going through R - set up the database for you - filter the data using an sql statement of your choice - read the filtered data into R and - delete the database it create

Re: [R] T-test to check equality, unable to interpret the results.

2009-09-16 Thread Steve Lianoglou
Hi Bert, On Sep 16, 2009, at 4:06 PM, Bert Gunter wrote: Finally, "statistically different" is a meaningless phrase. I'm not sure if you're quoting that to point out something in particular you're taking exception to, but I never said that. I did mention "statistical significance" with r

Re: [R] How not to keep the redundant space when convert a data frame with as.matrix()?

2009-09-16 Thread Daniel Nordlund
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Peng Yu > Sent: Wednesday, September 16, 2009 3:33 PM > To: r-h...@stat.math.ethz.ch > Subject: [R] How not to keep the redundant space when convert > a data frame with as.matrix

Re: [R] Questions on pareto

2009-09-16 Thread TsubasaZero
I've also found that but seems harder to use . Can you also teach me how to use the copula package. Because when I use pinvpareto to do and plot the results seems very strange~ David Winsemius wrote: > > The other package that I can think of that you might want to > investigate if you are a

Re: [R] How not to keep the redundant space when convert a data frame with as.matrix()?

2009-09-16 Thread Don McKenzie
If you want a matrix of strings > x <- data.frame(x=as.character(1:10),y=letters[11:20]) > as.matrix(x) xy [1,] "1" "k" [2,] "2" "l" [3,] "3" "m" [4,] "4" "n" [5,] "5" "o" [6,] "6" "p" [7,] "7" "q" [8,] "8" "r" [9,] "9" "s" [10,] "10" "t" BTW I believe the "=" for ass

[R] How not to keep the redundant space when convert a data frame with as.matrix()?

2009-09-16 Thread Peng Yu
Hi, The first column in as.matrix(x) has extra spaces (" "), which I don't want. Is there a way not to generate those spaces? Regards, Peng > x=data.frame(x=1:10,y=letters[11:20]) > as.matrix(x) xy [1,] " 1" "k" [2,] " 2" "l" [3,] " 3" "m" [4,] " 4" "n" [5,] " 5" "o" [6,] " 6" "p

Re: [R] using filter while Reading files -

2009-09-16 Thread Santosh
Hi R'sians As the experts here suggested, I am using "scan" and "readLines" to read text files. I notice that read.table takes a long time read and process character vectors of 3+ rows. How do I separate out the columns in the resulting character vector? The function "read.fwf" appears to be a

Re: [R] Generalized cumsum?

2009-09-16 Thread Ted Harding
On 16-Sep-09 21:17:10, David Winsemius wrote: > On Sep 16, 2009, at 5:09 PM, OKB (not okblacke) wrote: >> baptiste auguie wrote: >> >>> ?Reduce >>> >>> maybe >> >> No, Reduce reduces an entire vector to a single value by >> repeatedly >> combining adjacent elements. I'm looking to convert a

Re: [R] How to convert a frame to a matrix while maintaining that a number is still a number?

2009-09-16 Thread Henrique Dallazuanna
You can't do this using matrix class, matrix convert all values to same class, in this case, character. On Wed, Sep 16, 2009 at 7:12 PM, Peng Yu wrote: > Hi, > > See the code below. > > 'x' is a frame. x$C1 are all numbers 1, 2 and 3. > > 'as.matrix(x)' convert x$C1 to strings "1", "2" and "3".

[R] T-test to check equality, unable to interpret the results.

2009-09-16 Thread Robert Hall
Hi, I have the precision values of a system on two different data sets. The snippets of these results are as shown: sample1: (total 194 samples) 0.600238 0.800119 0.600238 0.200030 0.600238 ... ... sample2: (total 188 samples) 0.8001 0.2000 0.8001 0. 0.8000

[R] Problem Plotting Production Panel Data

2009-09-16 Thread Rakknar
Hello. I'm kind of new in R so you please forgive me if this is something really easy to but but i still don't find the solution. I want to plot a time series of production of several firms extracted from a panel data structure. I've tried with Stata but the most i achieved it's to plot a single

[R] Windows RGui line editing

2009-09-16 Thread OKB (not okblacke)
I've been using Tinn-R with RGui on Windows for quite some time now, but it's very irritating how the Windows RGui allows only very rudimentary line-editing. I can't even use shift-arrow key to select text! I searched through the archives and found what seemed to be a few peop

[R] How to convert a frame to a matrix while maintaining that a number is still a number?

2009-09-16 Thread Peng Yu
Hi, See the code below. 'x' is a frame. x$C1 are all numbers 1, 2 and 3. 'as.matrix(x)' convert x$C1 to strings "1", "2" and "3". I'm wondering how to maintain that the first column of 'as.matrix(x)' still numbers. Regards, Peng $ cat read.csv "C1","C2" "1","x" "2","y" "3","z" $ Rscript read.c

Re: [R] What is the difference between double quote (") and single quote (')?

2009-09-16 Thread David Winsemius
On Sep 16, 2009, at 6:03 PM, Peng Yu wrote: Hi, According to my understand of the description in R-intro, double quote and single quote are the same. Can somebody confirm if this is the case? Not exactly. It might be more correct to say that matched double quotes are the "same as" matche s

[R] What is the difference between double quote (") and single quote (')?

2009-09-16 Thread Peng Yu
Hi, According to my understand of the description in R-intro, double quote and single quote are the same. Can somebody confirm if this is the case? Regards, Peng __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE d

Re: [R] What does 'collapse' mean in apply()?

2009-09-16 Thread David Winsemius
On Sep 16, 2009, at 5:15 PM, Peng Yu wrote: I can't find 'collapse' in the help of apply. Can somebody let me know where its document is? What is 'collapse' for? x=matrix(1:6,nr=2) apply(x,1,paste,collapse=',') [1] "1,3,5" "2,4,6" collapse is a parameter to paste. apply accepts ... argum

Re: [R] Generalized cumsum?

2009-09-16 Thread David Winsemius
On Sep 16, 2009, at 5:09 PM, OKB (not okblacke) wrote: baptiste auguie wrote: ?Reduce maybe No, Reduce reduces an entire vector to a single value by repeatedly combining adjacent elements. I'm looking to convert a vector to another vector where each element is some arbitrary aggre

[R] What does 'collapse' mean in apply()?

2009-09-16 Thread Peng Yu
Hi, I can't find 'collapse' in the help of apply. Can somebody let me know where its document is? What is 'collapse' for? > x=matrix(1:6,nr=2) > apply(x,1,paste,collapse=',') [1] "1,3,5" "2,4,6" > Regards, Peng __ R-help@r-project.org mailing list htt

Re: [R] Generalized cumsum?

2009-09-16 Thread David Winsemius
On Sep 16, 2009, at 5:00 PM, OKB (not okblacke) wrote: Is there anything like cumsum and cumprod but which allows you to apply an arbitrary function instead of sum and product? In other words, I want a function cumfunc(x, f) that returns a vector, so that for all n up to the lengt

Re: [R] Generalized cumsum?

2009-09-16 Thread OKB (not okblacke)
baptiste auguie wrote: > ?Reduce > > maybe No, Reduce reduces an entire vector to a single value by repeatedly combining adjacent elements. I'm looking to convert a vector to another vector where each element is some arbitrary aggregating function applied to the first n elements of t

Re: [R] Generalized cumsum?

2009-09-16 Thread baptiste auguie
?Reduce maybe HTH, baptiste 2009/9/16 OKB (not okblacke) >Is there anything like cumsum and cumprod but which allows you to > apply an arbitrary function instead of sum and product? In other words, > I want a function cumfunc(x, f) that returns a vector, so that for all n > up to the

[R] changing number of axis

2009-09-16 Thread Dan Kortschak
Hi, I trying to produce a bar chart describing hits to specific bins by chromosome for a large data set (I am asking here because experimentation with options is precluded due to this - generating the figure takes about an hour): barchart(hits~bin|chromosome, data=hits, horizontal=FALSE, origin=0,

[R] Generalized cumsum?

2009-09-16 Thread OKB (not okblacke)
Is there anything like cumsum and cumprod but which allows you to apply an arbitrary function instead of sum and product? In other words, I want a function cumfunc(x, f) that returns a vector, so that for all n up to the length of x cumapply(x,f)[n] = f(x[1:n]) This would give cumsum

Re: [R] T-test to check equality, unable to interpret the results.

2009-09-16 Thread Rolf Turner
On 17/09/2009, at 8:06 AM, Bert Gunter wrote: Furthermore, the null can be other than equality -- e.g. that the mean of the first population is less than the second. QUIBBLE: Some elementary texts will indeed state the null hypothesis as ``mu_1 <= mu_2'' when the alter

Re: [R] T-test to check equality, unable to interpret the results.

2009-09-16 Thread Bert Gunter
I am loathe to expound basic statistics here ... but, at the considerable risk of pedantry, I must note that Steve's reply below contains fundamental errors, which I feel should not be left on this list unremarked: t-tests do **not** test for differences in **sample** means; they test for differe

Re: [R] apply function across two variables by mult factors

2009-09-16 Thread Gabor Grothendieck
Try this: transform(testDF, value = as.numeric(paste(round(abs(x)), round(abs(y)), sep = "."))) On Wed, Sep 16, 2009 at 3:22 PM, Jon Loehrke wrote: > Greetings, > > I am attempting to run a function, which produces a vector and > requires two input variables, across two nested factor levels.  I

Re: [R] apply function across two variables by mult factors

2009-09-16 Thread Jorge Ivan Velez
Hi Jon, Here is a suggestion: foo <- function(x) as.numeric( paste( abs( round( x ) ), collapse = "." ) ) testDF$value <- apply( testDF[,1:2], 1, foo ) testDF HTH, Jorge On Wed, Sep 16, 2009 at 3:22 PM, Jon Loehrke wrote: > Greetings, > > I am attempting to run a function, which produces a ve

Re: [R] apply function across two variables by mult factors

2009-09-16 Thread Erik Iverson
One correction below, ---snip--- > > > > # example data frame > > testDF<-data.frame( > > x=rnorm(12), > > y=rnorm(12), > > f1=gl(3,4), > > f2=gl(2,2,12)) > > > > Try this using lapply, split, mapply? Maybe it is in a nicer output > object for you? > > testFun2 <- function(x,

Re: [R] apply function across two variables by mult factors

2009-09-16 Thread Erik Iverson
Hello, > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Jon Loehrke > Sent: Wednesday, September 16, 2009 2:23 PM > To: r-help@r-project.org > Subject: [R] apply function across two variables by mult factors > > Greetings, >

[R] apply function across two variables by mult factors

2009-09-16 Thread Jon Loehrke
Greetings, I am attempting to run a function, which produces a vector and requires two input variables, across two nested factor levels. I can do this using by(X, list(factor1, factor2), function), however I haven't found a simple way to extract the list output into an organized vector fo

Re: [R] T-test to check equality, unable to interpret the results.

2009-09-16 Thread Steve Lianoglou
Hi, I was just going to send this when I saw Erik's post. He's right -- we can't say anything about your data, but we can say something about using a t-test. I'm not a "real" statistician, so this answer isn't very rigorous, but might be helpful. On Sep 16, 2009, at 2:55 PM, Robert Hall

Re: [R] T-test to check equality, unable to interpret the results.

2009-09-16 Thread Erik Iverson
Robert, We unfortunately do not have enough information to help you interpret the results, and this is not really an R question at all, but general statistical advice. You will probably have much better understanding and confidence in your results by consulting a local statistical consultant

[R] T-test to check equality, unable to interpret the results.

2009-09-16 Thread Robert Hall
Hi, I have the precision values of a system on two different data sets. The snippets of these results are as shown: sample1: (total 194 samples) 0.600238 0.800119 0.600238 0.200030 0.600238 ... ... sample2: (total 188 samples) 0.8001 0.2000 0.8001 0. 0.8000

Re: [R] comma as decimal separator in xtable

2009-09-16 Thread Jakson A. Aquino
On Wed, Sep 16, 2009 at 03:16:12PM -0300, Henrique Dallazuanna wrote: > Try this: > > sapply(x, format, decimal.mark = ',') Yes, this works as I need, regarding the replacement of dots with commas. Thanks! > > On Wed, Sep 16, 2009 at 2:06 PM, Jakson A. Aquino > wrote: > > On Wed, Sep 16, 2009

Re: [R] Turnpoints

2009-09-16 Thread David Winsemius
On Sep 16, 2009, at 1:42 PM, ogbos okike wrote: Good evening to everybody. I have a data of four columns - three of the columns represent date while the fourth is counts. Setting 4000 as my minimum point/value, I wish to find out the number of counts that are less or equal to 4000 You

Re: [R] comma as decimal separator in xtable

2009-09-16 Thread Henrique Dallazuanna
Try this: sapply(x, format, decimal.mark = ',') On Wed, Sep 16, 2009 at 2:06 PM, Jakson A. Aquino wrote: > On Wed, Sep 16, 2009 at 09:14:39AM -0300, Henrique Dallazuanna wrote: >> Try this also; >> >> format(coef(summary(lm.D9)), decimal.mark = ',') >> >> or using gsub: >> >>  apply(coef(summary

Re: [R] Example data for analysis of a highly pseudoreplicate mixed-effects experiment

2009-09-16 Thread Matthias Gralle
There were some wrong NA values in the provided data set, this is now corrected. The data can be read in as small=read.csv("small.csv",colClasses=c("character",rep("integer",2),rep("factor",5))) The high number of residual df can be seen using the nlme package (can it be seen in the lme4 packa

[R] Getting best three dimentions of data after dimentionality reduction (using kpca)

2009-09-16 Thread Abbas R. Ali
Hi   I am using kernlab package and kpca function for dimensionality reduction of my data. Can any body tell me that how can I get best three dimensions from output of kpca function, which are principal component vector, eignvalues, rotated vector, and original matrix. I want to get back my ori

Re: [R] re-code missing value

2009-09-16 Thread Jorge Ivan Velez
Hi Steve, Here is a suggestion using your original df1: # Create a copy -- you can avoid this newdf1 <- df1 # Process newdf1[,2:4] <- apply(newdf1[,2:4], 2, function(x) as.numeric(x)) # Removing df1 rm(df1) # Result newdf1 # str() str(newdf1) # 'data.frame': 18 obs. of 4 variables: # $ s

Re: [R] Turnpoints

2009-09-16 Thread Steve Lianoglou
Hi, On Sep 16, 2009, at 1:42 PM, ogbos okike wrote: Good evening to everybody. I have a data of four columns - three of the columns represent date while the fourth is counts. Setting 4000 as my minimum point/value, I wish to find out the number of counts that are less or equal to 4000 and

Re: [R] How to extract partial predictions, package mgcv

2009-09-16 Thread Staffan Roos
Yes, you're correct David, I used attach(f) earlier. Thanks for clarifying! I should change my own code accordingly. /Staffan David Winsemius wrote: > > Your code minus the extraneous "lines" was: > > #plot the data > plot(pp_s.x0.~x0,type="p",pch=2,cex=0.50) > sequence=order(x0) > lines(x0[

[R] re-code missing value

2009-09-16 Thread Steve Hong
Dear all, I have partial data set with four colums. First column is "site" with three factors (i.e., A, B, and C). From second to fourth columns (v1 ~ v3) are my observations. In the observations of the data set, "." indicates missing value. I replaced "." with NA. To replace "." with NA, I u

Re: [R] Fourier Transform fft help

2009-09-16 Thread delic
After extensive research I found some information hinting at my freq array being wrong. I thought that the data spanned -F/2 to F/2. It seems that I should only plot the first half of the fft vector? Can anyone confirm or shed some light on this? One other thing I thought the magnitude should be

Re: [R] How to extract partial predictions, package mgcv

2009-09-16 Thread David Winsemius
Your code minus the extraneous "lines" was: #plot the data plot(pp_s.x0.~x0,type="p",pch=2,cex=0.50) sequence=order(x0) lines(x0[sequence],pp_s.x0.[sequence]) rug(jitter(x0)) My edition was: plot(pp_s.x0.~x0,type="p",pch=2,cex=0.50, data=f) sequence=order(f$x0) lines(f$x0[sequence],f$pp_s.x0.[

[R] Turnpoints

2009-09-16 Thread ogbos okike
Good evening to everybody. I have a data of four columns - three of the columns represent date while the fourth is counts. Setting 4000 as my minimum point/value, I wish to find out the number of counts that are less or equal to 4000 and the dates they occur. I have installed pastecs and have been

Re: [R] Fourier Transform fft help

2009-09-16 Thread stephen sefick
why not try spectrum (power spectrum) spectrum(y, log="no") the major spike is at 0.1 and 1/0.1 = 10Hz On Wed, Sep 16, 2009 at 12:13 PM, delic wrote: > > I wrote a script that I anticipating seeing a spike at  10Hz with the > function 10* sin(2*pi*10*t). > I can't figure out why my plots  do not

Re: [R] How to extract partial predictions, package mgcv

2009-09-16 Thread Staffan Roos
Hi David, Yes, the strange code "lines" was clearly a mistake from my side. Sorry. What "dataframe references" did you add in your code? /Staffan David Winsemius wrote: > > But removing the extraneous second to last line that says just: > > lines > > ... would leave the console looking le

Re: [R] comma as decimal separator in xtable

2009-09-16 Thread Jakson A. Aquino
On Wed, Sep 16, 2009 at 03:29:44PM +0200, David Hajage wrote: > But, it seems that dcolumn can change the decimal separator too (see the > table on the first page of the pdf document). > > For example: > > \documentclass{article} > > \usepackage{dcolumn} > > \newcolumntype{d}[1]{D{.}{,}{#1}} >

[R] Fourier Transform fft help

2009-09-16 Thread delic
I wrote a script that I anticipating seeing a spike at 10Hz with the function 10* sin(2*pi*10*t). I can't figure out why my plots do not show spikes at the frequencies I expect. Am I doing something wrong or is my expectations wrong? require(stats) layout(matrix(c(1,2,3), 3, 1, byrow = TRUE))

Re: [R] comma as decimal separator in xtable

2009-09-16 Thread Jakson A. Aquino
On Wed, Sep 16, 2009 at 09:14:39AM -0300, Henrique Dallazuanna wrote: > Try this also; > > format(coef(summary(lm.D9)), decimal.mark = ',') > > or using gsub: > > apply(coef(summary(lm.D9)), 2, gsub, pattern = "\\.", replacement = ",") > > using lm.D9 object from ?lm example. Thanks for your

Re: [R] How to extract partial predictions, package mgcv

2009-09-16 Thread David Winsemius
But removing the extraneous second to last line that says just: lines ... would leave the console looking less puzzling. -- David On Sep 16, 2009, at 1:02 PM, David Winsemius wrote: It is nice to see worked examples, but there were some errors that relate to not including dataframe referen

Re: [R] How to extract partial predictions, package mgcv

2009-09-16 Thread David Winsemius
It is nice to see worked examples, but there were some errors that relate to not including dataframe references. I've paste in code that runs without error on my machine: On Sep 16, 2009, at 12:39 PM, Staffan Roos wrote: Thanks Simon, I wasn't aware that "predict.gam" could be used in this si

Re: [R] How to extract partial predictions, package mgcv

2009-09-16 Thread Staffan Roos
Thanks Simon, I wasn't aware that "predict.gam" could be used in this situation. I followed you advice and managed to extract the data I needed. For people interested, I add the code with comments I used here: # # Full code for extracting partial pr

Re: [R] expression

2009-09-16 Thread baptiste auguie
Try this, marco2 = matrix(rnorm(4), nrow=2, ncol=2) marco3 = 2.12 i =1 plot.new() mtext(bquote(R^2*.(round(marco2[1,i],digits=3))*" N° of proteins:"*.(marco3[i])),side=4,cex=.6) HTH, baptiste 2009/9/16 Marco Chiapello > /Dear all,/// > /I am very thankful, if you could tell what is the righ

Re: [R] a sequence that wraps around

2009-09-16 Thread Jack Tanner
Szabolcs Horvát gmail.com> writes: > You could use the modulo operator. > > > > # additional examples of what I want > > seq(from=2, length.out=4, rlimit=3) > > [1] 2 3 1 2 > > seq(from=1, length.out=4) %% 3 + 1 Ah, that's so slick. You're off to a great start! Huge thanks to you and everyone

[R] expression

2009-09-16 Thread Marco Chiapello
/Dear all,/// /I am very thankful, if you could tell what is the right way to write: mtext(paste(expression("R"^2),round(marco2[1,i],digits=3)," N° of proteins:",marco3[i]),side=4,cex=.6) in this case the output is: "R"^2 I tried also in this way: mtext(paste(expression(paste("R"^2)),round

Re: [R] wilcox.test p-value = 0

2009-09-16 Thread Marc Schwartz
Once one gets past the issue of the p value being extremely small, irrespective of the test being used, the OP has asked the question of how to report it. Most communities will have standards for how to report p values, covering things like how many significant digits and a minimum p value

Re: [R] a sequence that wraps around

2009-09-16 Thread Duncan Murdoch
On 9/16/2009 10:08 AM, Jack Tanner wrote: I'd like to have something like seq() where I can pass in a length of the desired sequence and a right limit so that the sequence goes up to the limit and then starts again from 1. # works now seq(from=2, length.out=3) [1] 2 3 4 # what I want seq(from=2

Re: [R] Memory in R on windows running 64bit XP

2009-09-16 Thread michael watson (IAH-C)
Fair enough, thanks for your time. I will wait for my Linux PCs! -Original Message- From: Duncan Murdoch [mailto:murd...@stats.uwo.ca] Sent: 16 September 2009 16:42 To: michael watson (IAH-C) Cc: r-help@r-project.org Subject: Re: [R] Memory in R on windows running 64bit XP On 9/16/2009

Re: [R] a sequence that wraps around

2009-09-16 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Jack Tanner > Sent: Wednesday, September 16, 2009 7:08 AM > To: r-h...@stat.math.ethz.ch > Subject: [R] a sequence that wraps around > > I'd like to have something like seq() whe

Re: [R] Memory in R on windows running 64bit XP

2009-09-16 Thread Duncan Murdoch
On 9/16/2009 10:54 AM, michael watson (IAH-C) wrote: Hi Duncan Many thanks for the reply. Here are the results of the commands: Rprofmem() Error in Rprofmem() : memory profiling is not available on this system memory.size(NA) [1] 3500 memory.size() [1] 16.19 Clearly Rprofmem() is a dea

  1   2   >