Re: [R] multiplication question

2008-07-02 Thread Kenn Konstabel
for example ... x - 1:5 ; y- 6:8 (m - x %o% y) # is this what you mean by product of two vectors? sum(m[row(m)!=col(m)]) # or ... sum(m)-sum(diag(m)) On Wed, Jul 2, 2008 at 7:30 PM, Murali Menon [EMAIL PROTECTED] wrote: folks, is there a clever way to compute the sum of the product of

Re: [R] Reading CSV file with unequal record length

2008-07-02 Thread Marc Schwartz
on 07/02/2008 01:55 PM Viswanathan Shankar wrote: Hello , I am having some difficulty reading a CSV file of unequal record length in R . The data has 26 columns and do not have header and is generated from a R syntax - write.table(schat,schat.csv, sep=,, col.names=FALSE, append = TRUE)

Re: [R] Insert text in data.frame

2008-07-02 Thread jim holtman
Try this: x - read.table(textConnection(Conc Lat LonDepth Point 56.25-5.65 70 Point0001 56.55-5.35 85 Point0002 56.25-5.65 65 Point0003 56.37-5.21 80 Point0004 56.45-5.23 30 Point 56.25-5.55 75

Re: [R] Accessing a field in a data fram

2008-07-02 Thread jim holtman
?[[ decision - one raw[[decision]] On Wed, Jul 2, 2008 at 3:10 PM, R_Learner [EMAIL PROTECTED] wrote: raw - read.csv(file=filename, head=TRUE,sep=,) I've read in a csv file, and I'm looking to access a column whose name is held in a string. For example, I want to access raw$one or

Re: [R] flow map lines between point pairs (latitude/longitude)

2008-07-02 Thread Ray Brownrigg
Here's one solution, YMMV: library(maps) # Note, plot the map first to get the aspect ratio (or projection) right map(county, xlim=range(df2VisitTrips[, c(5, 7)]), ylim=range(df2VisitTrips[, c(4, 6)]), col=8) map(state, add=T) map.axes() for (i in 1:length(df2VisitTrips[, 1])) {

Re: [R] help on list comparison

2008-07-02 Thread Jorge Ivan Velez
Dear Ramya, Try # Gene list with 3 genes genelist=list(gene1=rnorm(100),gene2=rnorm(100),gene3=rnorm(100)) genelist # Map file with 50 genes mapfile=data.frame(gene=paste(gene,1:50,sep=),coordinate=runif(50,6180,6300)) mapfile # Genes in genelist (names) NAMES=names(genelist) NAMES #

Re: [R] flow map lines between point pairs (latitude/longitude)

2008-07-02 Thread Richard and Barbara Males
made my day, thanks, worked just fine with a little bit of tweaking (flipping x and y around, basically). rapid response much appreciated Dick On Wed, Jul 2, 2008 at 5:25 PM, Ray Brownrigg [EMAIL PROTECTED] wrote: Here's one solution, YMMV: library(maps) # Note, plot the map first to get the

Re: [R] NLME questions -- interpretation of results

2008-07-02 Thread ctu
Hi Jenny, I try your code but I did not get in converge in fm3 (see the below). For the first question, you could use fm1 to interpret the result without bothering fm2 and fm3. It means that R0 and lrc can be treated as pure fixed effects (Pinherir and Bates, 2000 Book). For the second

Re: [R] auto.key in xyplot in conjunction with panel.text

2008-07-02 Thread Deepayan Sarkar
On 7/2/08, David Afshartous [EMAIL PROTECTED] wrote: All, I can't seem to get auto.key to work properly in an xyplot that is employing panel.text. Specifically, I often change the default grouping colors then use auto.key accordingly, but for some reason the same functionality isn't

Re: [R] plot.zoo labels

2008-07-02 Thread Gabor Grothendieck
xlab = and ylab = suppress the labels but that won't change the margins. For that you need to set mar= . If z is a zoo object: plot(z, xlab = , ylab = , mar=...) See ?par for description of mar. On Wed, Jul 2, 2008 at 12:59 PM, [EMAIL PROTECTED] wrote: Thank you for your time to help.

[R] neural networks

2008-07-02 Thread Donna Tucker
Hello all, I am trying to use the neuralnet function from the neural package to train neural networks. I am finishing my thesis over statistical learning in which I am comparring the MSE values for various algorithms with random data sets, so I do not have a specific application. I have two

[R] Removing or overwriting an XML node

2008-07-02 Thread Steffen Neumann
Hi, I have an existing XML document on disk, which I'd like to use as a template, and exchange a subnode with my own newly created subtree: ?xml version=1.0? Duncan name a=1 b=xyz firstDuncan/first lastTemple Lang/last /name

Re: [R] A regression problem using dummy variables

2008-07-02 Thread rlearner309
I think it is zero, because you have lots of zeros there. It is not like continous variables. Thomas Lumley wrote: On Wed, 2 Jul 2008, rlearner309 wrote: I think the covariance between dummy variables or between dummy variables and intercept should always be zero. meaning: no

Re: [R] Migrating from S-Plus to R - Exporting Tables

2008-07-02 Thread jim holtman
Does something like this get you close: x - list() keys - LETTERS[1:6] # create for (i in keys){ x[[i]] - data.frame(a=1:5, b=1:5, c=1:5) } # output output - file('tempxx.txt', 'w') for (i in keys){ write.table(i, row.names=FALSE, col.names=FALSE, file=output, quote=FALSE)

[R] what can we do when R gives no response

2008-07-02 Thread Peng Jiang
Hi, dear R experts , I am new. I met this problem when I am trying to learn how to use the nlminb() function. I tried the example which the document provides ( as the following code ) and R gives no response . I don't know whether it is running or not and it takes a very long time but

[R] Plotting Prediction Surface with persp()

2008-07-02 Thread Rory Winston
Hi all I have a question about correct usage of persp(). I have a simple neural net-based XOR example, as follows: library(nnet) xor.data - data.frame(cbind(expand.grid(c(0,1),c(0,1)), c(0,1,1,0))) names(xor.data) - c(x,y,o) xor.nn - nnet(o ~ x + y, data=xor.data, linout=FALSE, size=1) # Create

[R] How do I paste double quotes arround a character string?

2008-07-02 Thread Philip James Smith
Hi R Community: I've got a character string that looks like: New Mexico How to I create the new character string that looks like: New Mexico That is, it is the original string (New Mexico) with double quotes infront and behind it? Thanks, Phil Smith

[R] how to capture matching words in a string ?

2008-07-02 Thread Daren Tan
I need to capture matching words in a string, any ideas ? I tried using gregexpr, but it was no help. In this example, I need to capture ID23423424 and ID324234325 s - sID23423424 apple pID324234325 orange gregexpr(ID[0-9]+, s)[[1]][1] 2 20attr(,match.length)[1] 10 11

Re: [R] How do I paste double quotes arround a character string?

2008-07-02 Thread Erik Iverson
Philip James Smith wrote: Hi R Community: I've got a character string that looks like: New Mexico What does this mean? I do not think I understand. Do you have a vector with one element (New Mexico) in it? I think we need a few more details, like what it is exactly you have (class of

[R] problem with lm and predict - no predictions made

2008-07-02 Thread Keld Jørn Simonsen
Hi I have a problem with lm and predict I have us [1] 2789.53 3128.43 3255.03 3536.68 3933.18 4220.25 4462.83 4739.48 [9] 5103.75 5484.35 5803.08 5995.93 6337.75 6657.40 7072.23 7397.65 [17] 7816.83 8304.33 8746.98 9268.43 9816.98 10127.95 10469.60 10960.75 [25] 11685.93

Re: [R] how to capture matching words in a string ?

2008-07-02 Thread Gabor Grothendieck
Try this and see the gsubfn home page for more info: http://gsubfn.googlecode.com library(gsubfn) Loading required package: proto s - sID23423424 apple pID324234325 orange strapply(s, ID[0-9]+)[[1]] [1] ID23423424 ID324234325 On Wed, Jul 2, 2008 at 9:33 PM, Daren Tan [EMAIL PROTECTED]

Re: [R] problem with lm and predict - no predictions made

2008-07-02 Thread Erik Iverson
Hello - Keld Jørn Simonsen wrote: Hi I have a problem with lm and predict I have us [1] 2789.53 3128.43 3255.03 3536.68 3933.18 4220.25 4462.83 4739.48 [9] 5103.75 5484.35 5803.08 5995.93 6337.75 6657.40 7072.23 7397.65 [17] 7816.83 8304.33 8746.98 9268.43 9816.98

Re: [R] problem with lm and predict - no predictions made

2008-07-02 Thread Jorge Ivan Velez
Dear Keld, See ?predict.lm and its examples. HTH, Jorge On Wed, Jul 2, 2008 at 9:40 PM, Keld Jørn Simonsen [EMAIL PROTECTED] wrote: Hi I have a problem with lm and predict I have us [1] 2789.53 3128.43 3255.03 3536.68 3933.18 4220.25 4462.83 4739.48 [9] 5103.75 5484.35

Re: [R] NLME questions -- interpretation of results

2008-07-02 Thread Jenny Sun
Thank you for your reply Chunhao! I attached only part of the test data and that is why you might not be able to get convergence. Sorry. I have a couple more questions: For the second question you answered, how to specify the correct length of starting values. I tried using the length of

Re: [R] what can we do when R gives no response

2008-07-02 Thread jim holtman
I ran you script and it came back in less than 1 second: x - rnbinom(100, mu = 10, size = 10) hdev - function(par) { + -sum(dnbinom(x, mu = par[1], size = par[2], log = TRUE)) + } nlminb(c(9, 12), hdev) $par [1] 9.760001 13.802305 $objective [1] 278.9434 $convergence [1] 0 $message [1]

[R] lm() question

2008-07-02 Thread Ranney, Steven
I have data that looks like YC Age Num 82 11 2 83 10 0 84 9 8 85 8 21 86 7 49 87 6 18 88 5 79 89 4 28 90 3 273 91 2 175 with a program mod1=lm(log(Num+1)~YC, data=box44)

[R] Processing 10^8 rows and 1^3 columns

2008-07-02 Thread Daren Tan
With smaller tab-limited files, I could load them using read.table and the likes. Now I have a gigantic 10^8 rows and 1^3 columns tab-limited file for processsing, please throw some ideas how to handle it. Thanks _ Publish your

Re: [R] Plotting Prediction Surface with persp()

2008-07-02 Thread Duncan Murdoch
On 02/07/2008 8:47 PM, Rory Winston wrote: Hi all I have a question about correct usage of persp(). I have a simple neural net-based XOR example, as follows: library(nnet) xor.data - data.frame(cbind(expand.grid(c(0,1),c(0,1)), c(0,1,1,0))) names(xor.data) - c(x,y,o) xor.nn - nnet(o ~ x + y,

Re: [R] NLME questions -- interpretation of results

2008-07-02 Thread ctu
Hi Jenny, (I use the data you provide in the previous e-mail) For the 1st question, let me assume you only want to compare loc: A vs. B So you could specified your code like this: fmAB - nlme(Y ~ SSlogis(X, Asym, R0, lrc),data = LAST, random = Asym ~1, fixed = Asym+R0+lrc

Re: [R] what can we do when R gives no response

2008-07-02 Thread Peng Jiang
Hi, Jim thanks for your reply, I tried the scripts it still does not give any response on my mac. I have to stop in manually. what is your sessionInfo ? Thanks again. On 2008-7-3, at 上午10:10, jim holtman wrote: I ran you script and it came back in less than 1 second: x - rnbinom(100,

<    1   2