[R] uncoerce.... to get real number instead of integer?

2012-06-24 Thread Nicole Barberis
Dear R community, #I'm using scan() to extract a real number from a file with a complex structure: 156689504.378. #My problem is that the number is coerced into an integer.  #Do you have any ideas for me on how to uncoerce?  Here is my code and the output: #I'm using R version 2.15.0

Re: [R] matching a string with multiple conditions using grep

2012-06-24 Thread arun
Hi, Try this: vec1-c(A_cont_1, A_cont_12, B_treat_8, AB_cont_22, cont_21_Aa) vec2-grep((A){0,1}.*cont.*2,vec1) vec1[vec2] [1] A_cont_12  AB_cont_22 cont_21_Aa A.K. - Original Message - From: Zhipeng Wang wa...@kuhp.kyoto-u.ac.jp To: r-help@r-project.org Cc: Sent: Saturday, June

[R] mgcv

2012-06-24 Thread ywh123
Hi,Dear Professor Wood, I am studying the generalized additive model(GAM) and I have read your related papers,especially the book named Generalized Additive Models:An Introduction with R.I am benefit a lots.However,I also have some questions about GAM models. First,Is there some restrictions

Re: [R] uncoerce.... to get real number instead of integer?

2012-06-24 Thread Rui Barradas
Hello, Don't worry, it's just a print thing. Just check this example: x - 123456789.0378 x [1] 123456789 x - 123456789 [1] 0.0378 As you can see, it is a real. And as.numeric does NOT coerce to integer, 'numeric' is identical to 'double'. See the help page, ?as.numeric. And for your

Re: [R] uncoerce.... to get real number instead of integer?

2012-06-24 Thread Petr Savicky
On Sun, Jun 24, 2012 at 07:29:23AM +0100, Rui Barradas wrote: Hello, Don't worry, it's just a print thing. Just check this example: x - 123456789.0378 x [1] 123456789 x - 123456789 [1] 0.0378 Hello: If you want to see more digits of the number, use one of the following. print(x,

Re: [R] array complexity for the MH test

2012-06-24 Thread francogrex
Thanks for your answer. The answer advertises your VCD package, which by the way is a very nice package that I use and recommend for everyone doing such kind of data analysis. However if you really examine the answer you gave me, it does not really or specifically answer my question. -- View this

[R] Analyzing multiple text files

2012-06-24 Thread iheartfalafel
Hi, I'm new with R and I was wondering if there was a way to open a folder containing multiple text files and go through each file. These files contain protein sequences, however, I wanted to see if there was a way of going through each file without using bio3d, just R Thanks a bunch :). ps if

[R] How to calculate the predicted value by using GAMs?

2012-06-24 Thread pigpigmeow
I really want to know how to calculate the predicted valued when I use gam.predict . my model is: newSO2 ~ s(pressure, bs = cr) + s(maxtemp, bs = cr) + mintemp + RH + solar + s(windspeed, bs = cr) + s(transport, bs = cr) my new dataset is : pressure: -7.056847826 maxtemp: 2.737507877

Re: [R] Analyzing multiple text files

2012-06-24 Thread Rui Barradas
Hello, See the help page for help(list.files) ?list.files # an 'help' alias, short form. You can have any type of combination, folder/file pattern/recursive/etc. Hope this helps, Rui Barradas Em 24-06-2012 07:28, iheartfalafel escreveu: Hi, I'm new with R and I was wondering if there was

Re: [R] Obtaining saving cluster membership via hclust

2012-06-24 Thread Uwe Ligges
On 24.06.2012 06:20, Bob Green wrote: Hello, I want to examine the characteristics of 49 persons in terms of their symptoms and motivations, in a cluster analysis . The data is in a binary format. I was hoping to save and then examine the cluster membership. I would appreciate advice on

Re: [R] Constrained coefficients in lm (correction)

2012-06-24 Thread rgoodman
Hi Jorge, Did you ever figure this out? I want to do the same thing with the additional constraint of the coef for x1 = 2. lm(Y~offset(2*x1)+x2+x3,data=mydata) where b= coeff for x2, c = coeff for x3, b+c=1 and b and c0. I've loaded the systemfit package, but the suggestion R*beta0 = q, where

[R] rgraphviz problem

2012-06-24 Thread Anton Gerostathos
Hello I desperately need help with installing the Rgraphviz package under windows 7. Please forget my ignorance of basic topics, I’m a psychiatrist trying to use text mining to analyse psychiatric reports for criminal courts, statistics and machine learning are within my reach but R

[R] grofit

2012-06-24 Thread Labas
Hi, I'm a new user of R I'm using grofit package to fit the grouth curve, but what I actually need is parameters: maximum slope (µ) and the maximum cell growth (A). Can you please explain , how can I get them (for all curves)? Thees parameters are objects from gcFitModel, but i didn't managed

[R] subsetting a dataset

2012-06-24 Thread bdossman
Hi I am a beginner R user and need a little help with the subset function. I have a dataset with columns; TOWER,TAG.ID, DATETIME (POSIXct class) and I would like to subset my data by specific TAG.ID (e.g TAG.IDs 12:20 and 192:212). Is there an easy way to preform this operation? Thanks Bryant

Re: [R] rgraphviz problem

2012-06-24 Thread Søren Højsgaard
Dear Anton, You may find the description on http://people.math.aau.dk/~sorenh/software/gR/index.html helpful. Regards -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Anton Gerostathos Sent: 24. juni 2012 14:28 To:

Re: [R] subsetting a dataset

2012-06-24 Thread Rui Barradas
Hello, Try the following. ix - with(dataset, TAG.ID %in% 12:20 | TAG.ID %in% 192:212) dataset[ix, ] or ix - with(dataset, (12 = TAG.ID TAG.ID =20) | (192 = TAG.ID TAG.ID = 212)) if the variable is not integer. Also, read the manual, this, index vectors, is there. (R-intro.pdf). Hope

Re: [R] array complexity for the MH test

2012-06-24 Thread David Winsemius
On Jun 24, 2012, at 5:30 AM, francogrex wrote: Thanks for your answer. The answer advertises your VCD package, which by the way is a very nice package that I use and recommend for everyone doing such kind of data analysis. However if you really examine the answer you gave me, it does not

[R] Large Test Datasets in R

2012-06-24 Thread vioravis
I am looking for some large datasets (10,000 rows 100,000 columns or vice versa) to create some test sets. I am not concerned about the invidividual elements since I will be converting them to binary (0/1) by using arbitrary thresholds. Does any R package provide such big datasets? Also, what

Re: [R] Fwd: Rgraphviz installation problem

2012-06-24 Thread gerostathos
Dear Martin thanks for your comprehensive instructions, had I found them earlier I would have saved at least 3 hours of problems... Everyone copies: your Windows system 'PATH' variable needs to be adjusted once you've installed graphviz and before installing Rgraphviz What if Rgraphviz is

Re: [R] Fwd: Rgraphviz installation problem

2012-06-24 Thread Uwe Ligges
On 24.06.2012 16:54, gerostathos wrote: Dear Martin thanks for your comprehensive instructions, had I found them earlier I would have saved at least 3 hours of problems... Everyone copies: your Windows system 'PATH' variable needs to be adjusted once you've installed graphviz and before

[R] Power calculation using pwr.t.test()

2012-06-24 Thread Jokel Meyer
Dear R experts, I have conducted a power calculation in order to estimate the number of subjects needed to detect an effect size of d=0.28 (cohen's d) for a difference between two independent groups (alpha level should be 0.05 and the effect should be detected with 80% probability). The results

[R] p-value for the fitted parameters in linear models

2012-06-24 Thread Li SUN
Hi All, when using the linear model lm() to fit data of the form y = k * x + b, is it possible to know the p-value for the parameters k and b? i.e. can we find the result of the form (k, Δk; b, Δb)? Thanks in advance! Li Sun __ R-help@r-project.org

Re: [R] Help with a repeating process

2012-06-24 Thread tbowlo
Perhaps an easier coding that shows what I want would be this: for(i in 1:nrow(ret)) { + retT=ret[1+i:252+i,]} Thank you so much for your time and help! -- View this message in context: http://r.789695.n4.nabble.com/Help-with-a-repeating-process-tp4634336p4634339.html Sent from the R help

[R] Help with a repeating process

2012-06-24 Thread tbowlo
I am trying to create a looping function that takes 252 rows of a matrix from 1, then the next 252 rows of a matrix from 1+1, so on and so forth until nrow of the matrix. I am using the for + if loop combo but I seem to be stuck on the if portion. I'm trying to code if so that if the row is less

Re: [R] Power calculation using pwr.t.test()

2012-06-24 Thread Uwe Ligges
On 24.06.2012 17:41, Jokel Meyer wrote: Dear R experts, I have conducted a power calculation in order to estimate the number of subjects needed to detect an effect size of d=0.28 (cohen's d) for a difference between two independent groups (alpha level should be 0.05 and the effect should be

Re: [R] p-value for the fitted parameters in linear models

2012-06-24 Thread Uwe Ligges
On 24.06.2012 17:47, Li SUN wrote: Hi All, when using the linear model lm() to fit data of the form y = k * x + b, is it possible to know the p-value for the parameters k and b? i.e. can we find the result of the form (k, Δk; b, Δb)? If you explain what Δk means in a linear model, we may be

Re: [R] Help with a repeating process

2012-06-24 Thread David Winsemius
On Jun 24, 2012, at 11:37 AM, tbowlo wrote: Perhaps an easier coding that shows what I want would be this: for(i in 1:nrow(ret)) { + retT=ret[1+i:252+i,]} You should be thinking about what will happen in that indexing operation when the loop pushes 'i' above nrow(ret)-251 (You may

Re: [R] rgraphviz problem

2012-06-24 Thread Anton Gerostathos
Dear Søren, thank you for the additional description. Through the link provided I got the idea to try the zip packages of Rgraphviz for installation. After an additional problem with the x64 version, finally resolved, I am now getting stuck with the following message when trying to load

Re: [R] Fwd: Rgraphviz installation problem

2012-06-24 Thread Anton Gerostathos
Thank you removing everything and reinstalling while respecting every instruction did not change anything... evidently, I was too optimistic when thinking that the problem was caused by something so simple... I continue to strive with it but, at least, I know where not to look for the

Re: [R] rgraphviz problem

2012-06-24 Thread Søren Højsgaard
Perhaps you could try to see if you can get the 32 bit version to work AND you could also report the result of running sessionInfo() in your mail. Regards Søren -Original Message- From: Anton Gerostathos [mailto:antonios.gerostat...@windowslive.com] Sent: 24. juni 2012 18:43 To: Søren

Re: [R] p-value for the fitted parameters in linear models

2012-06-24 Thread Li SUN
Sorry for the confusion. Let me state the question again. I missed something in my original statement. When using the linear model lm() to fit data of the form y = k * x + b, where k, b are the coefficients to be found, and x is the variable and has an error bar (uncertainty) Δx of the same

Re: [R] Power calculation using pwr.t.test()

2012-06-24 Thread David Winsemius
On Jun 24, 2012, at 11:41 AM, Jokel Meyer wrote: Dear R experts, I have conducted a power calculation in order to estimate the number of subjects needed to detect an effect size of d=0.28 (cohen's d) for a difference between two independent groups (alpha level should be 0.05 and the

Re: [R] p-value for the fitted parameters in linear models

2012-06-24 Thread David Winsemius
On Jun 24, 2012, at 1:21 PM, Li SUN wrote: Sorry for the confusion. Let me state the question again. I missed something in my original statement. When using the linear model lm() to fit data of the form y = k * x + b, where k, b are the coefficients to be found, and x is the variable and

Re: [R] p-value for the fitted parameters in linear models

2012-06-24 Thread Prof Brian Ripley
On 24/06/2012 18:39, David Winsemius wrote: On Jun 24, 2012, at 1:21 PM, Li SUN wrote: Sorry for the confusion. Let me state the question again. I missed something in my original statement. When using the linear model lm() to fit data of the form y = k * x + b, where k, b are the

Re: [R] Help with a repeating process

2012-06-24 Thread Petr Savicky
On Sun, Jun 24, 2012 at 08:37:23AM -0700, tbowlo wrote: Perhaps an easier coding that shows what I want would be this: for(i in 1:nrow(ret)) { + retT=ret[1+i:252+i,]} Hi. Using your previous description, i think, you mean (1+i):(252+i). Note that this is quite different from 1+i:252+i,

Re: [R] p-value for the fitted parameters in linear models

2012-06-24 Thread Li SUN
Thanks David and Brian. But what if x is exact while y has some uncertainty Δy, in the relation y = k * x + b? Now I need to fit some data like x = 1, 2, 3, 4, 5 y±Δy = 1.1±0.1, 2.0±0.2, 3.1±0.2, 4.1±0.1, 5.0±0.2 Is there any mechanism to pass x, y and

Re: [R] p-value for the fitted parameters in linear models

2012-06-24 Thread Uwe Ligges
On 24.06.2012 20:35, Li SUN wrote: Thanks David and Brian. But what if x is exact while y has some uncertainty Δy, in the relation y = k * x + b? Now I need to fit some data like x = 1, 2, 3, 4, 5 y±Δy = 1.1±0.1, 2.0±0.2, 3.1±0.2, 4.1±0.1, 5.0±0.2

Re: [R] p-value for the fitted parameters in linear models

2012-06-24 Thread Li SUN
2012/6/24 Uwe Ligges lig...@statistik.tu-dortmund.de: On 24.06.2012 20:35, Li SUN wrote: Thanks David and Brian. But what if x is exact while y has some uncertainty Δy, in the relation y = k * x + b? Now I need to fit some data like x       = 1,          2,          3,          4,      

[R] Indexing matrices from the Matrix package with [i, j] seems to be very slow. Are there faster alternatives?

2012-06-24 Thread Søren Højsgaard
Dear all, Indexing matrices from the Matrix package with [i,j] seems to be very slow. For example: library(rbenchmark) library(Matrix) mm - matrix(c(1,0,0,0,0,0,0,0), nr=20, nc=20) MM - as(mm, Matrix) lookup - function(mat){ for (i in 1:nrow(mat)){ for (j in 1:ncol(mat)){

Re: [R] Error using PostScriptTrace()

2012-06-24 Thread Paul Murrell
Hi On 24/06/2012 5:54 p.m., M. Ndiaye wrote: I couldn't run PostScriptTrace() from the package grImport without an error. At first the postscript program couldn't be found. however the problem persisted after the full path the postscript program was indicated. I read earlier post on the subject

Re: [R] p-value for the fitted parameters in linear models

2012-06-24 Thread Bert Gunter
Dear Li Sun: You appear to have a good deal of statistical confusion. R-help is not a statistical consulting service. You should consult a local statistician or, if that's not possible,post on a statistical help list like stats.stackexchange.com -- Bert On Sun, Jun 24, 2012 at 12:04 PM, Li SUN

[R] Defining multiple variables in a loop

2012-06-24 Thread Taylor White
Good day, For lack of a better solution (or perhaps I am ignorant to something more elegant), I have been bootstrapping panel data by hand so to speak and I would like to know if there is a way to define multiple variables in a loop using the loop variable. I found a post (here:

[R] equality of values

2012-06-24 Thread Andreia Leite
Dear list, I'm trying to do a loop where I should choose a cell of a data frame comparing it with another. The code actually works for the majority of the loop but for some reason it doesn't and I can't figure out why. When I tried to understand why I've noticed this: dif[11] [1] 118.8333

Re: [R] Help with a repeating process

2012-06-24 Thread tbowlo
That certainly helps Petr. In terms of the overall question, perhaps it is better to show the code and reexplain what exactly I am trying to do: 1. I have logetf values in a [3300,9] matrix 2. I am trying to find the w value in the function: sum(abs(retT-w*prcomp(ret[(1+i):(252+i),]$rotation[,1])

[R] MuMIn for GLM Negative Binomial Model

2012-06-24 Thread Rhodes, Christopher J.
Hello I am not able to use the MuMIn package (version 1.7.7) for multimodel inference with a GLM Negative Binomial model (It does work when I use GLM Poisson). The GLM Negative Binomial gives the following error statement: Error in get.models(NBModel, subset = delta 4) : object has no

Re: [R] equality of values

2012-06-24 Thread Bert Gunter
Sigh R Faq 7.31. ?options ## The digits option. Also ?print.default ## and digits option -- Bert On Sun, Jun 24, 2012 at 10:58 AM, Andreia Leite andreiaheitorle...@gmail.com wrote: Dear list, I'm trying to do a loop where I should choose a cell of a data frame comparing it with

Re: [R] equality of values

2012-06-24 Thread Sarah Goslee
Please read R FAQ 7.31, Why doesn't R think these numbers are equal? Sarah On Sun, Jun 24, 2012 at 1:58 PM, Andreia Leite andreiaheitorle...@gmail.com wrote: Dear list, I'm trying to do a loop where I should choose a cell of a data frame comparing it with another. The code actually works for

Re: [R] Defining multiple variables in a loop

2012-06-24 Thread Bert Gunter
Standard response: Use lists instead. Read An Intro to R to learn about lists. In fact,read an An Intro to R, full stop ( if you have not already done so). Cheers, Bert On Sun, Jun 24, 2012 at 2:15 PM, Taylor White taylorgentrywh...@gmail.comwrote: Good day, For lack of a better solution

Re: [R] Error using PostScriptTrace()

2012-06-24 Thread M. Ndiaye
Paul, Adding the single quotes fixed the problem! Very appreciative. Modou On Sun, Jun 24, 2012 at 3:52 PM, Paul Murrell p.murr...@auckland.ac.nzwrote: Hi On 24/06/2012 5:54 p.m., M. Ndiaye wrote: I couldn't run PostScriptTrace() from the package grImport without an error. At first the

Re: [R] p-value for the fitted parameters in linear models

2012-06-24 Thread S Ellison
But what if x is exact while y has some uncertainty Δy, in the relation y = k * x + b? Again, no: this is not a linear model. Assumption in a linear model is that the errors are identically distributed. Surely not; errors in a linear model do not need to be homoscedastic. lm handles

Re: [R] equality of values

2012-06-24 Thread Oliver Ruebenacker
Hello, The FAQ answer 7.31 may be confusing to noobs and the referenced paper is long. The essence is: (1) It's not an R issue, it is a floating point (flop) arithmetic issue. (2) The issue is that flop arithmetic is almost always only approximate. (3) Therefore, asking for exact

[R] FW: R help - shell() in Linux

2012-06-24 Thread 蓁蓁 李
Hi, I have a question. When I run R script in Windows, I can use shell() function. But there is no such a function in Linux machine, what I should do in the Linux machine? Thanks a lot! Jess [[alternative HTML version deleted]]

Re: [R] FW: R help - shell() in Linux

2012-06-24 Thread Sarah Goslee
You don't tell us what you're trying to do, but system() might be useful. Sarah On Sun, Jun 24, 2012 at 5:19 PM, 蓁蓁 李 tszhenzh...@hotmail.com wrote: Hi, I have a question. When I run R script in Windows, I can use shell() function. But there is no such a function in Linux machine, what I

Re: [R] Defining multiple variables in a loop

2012-06-24 Thread R. Michael Weylandt
To elaborate on what Bert said: Lists are a variable length data structure which can hold most anything (even other lists) in them and are a great way to organize the sort of data you're working with. You can think of them as generic vectors. You can assign them names and access/subset them by

Re: [R] equality of values

2012-06-24 Thread Andreia Leite
Thanks a lot for your explanation! I see the point and I think I'll solve my question using a different method! Andreia Leite On Sun, Jun 24, 2012 at 10:53 PM, Oliver Ruebenacker cur...@gmail.comwrote: Hello, The FAQ answer 7.31 may be confusing to noobs and the referenced paper is

Re: [R] p-value for the fitted parameters in linear models

2012-06-24 Thread Li SUN
Dear All, Thanks for all your explanations and sorry for the confusion. I will need to consult some statistician for help. Sincerely, Li Sun 2012/6/24 S Ellison s.elli...@lgcgroup.com: But what if x is exact while y has some uncertainty Δy, in the relation y = k * x + b? Again, no: this

Re: [R] MuMIn for GLM Negative Binomial Model

2012-06-24 Thread Peter Ehlers
On 2012-06-24 12:40, Rhodes, Christopher J. wrote: Hello I am not able to use the MuMIn package (version 1.7.7) for multimodel inference with a GLM Negative Binomial model (It does work when I use GLM Poisson). The GLM Negative Binomial gives the following error statement: Error in

Re: [R] error in mlogit

2012-06-24 Thread Kazu Nada
Thank you so much for the suggestion. I should simplify my formula. Kazz 2012/6/22 Achim Zeileis achim.zeil...@uibk.ac.at On Fri, 22 Jun 2012, Kazu Nada wrote: Thank you so much for the suggestion. I want to estimate interactions between the attributes of the choice set and

Re: [R] Boxplot with Log10 and base-exponent axis

2012-06-24 Thread Steve Taylor
This (and William's solution) is so good, I must ask: Is there a good reason why this is not the default functionality in the graphics package? The default displays the number 1 as 1+e00 which is hideous! -Original Message- From: r-help-boun...@r-project.org

Re: [R] Defining multiple variables in a loop

2012-06-24 Thread Taylor White
Thank you gentlemen for pointing me in the right direction. This code worked nicely: countries - list() for (i in 1:20) { countries[[i]] = as.matrix(subset(OECDFiscal2, Country == i)) } Take care, Taylor On Sun, Jun 24, 2012 at 3:01 PM, R. Michael Weylandt michael.weyla...@gmail.com wrote:

Re: [R] Defining multiple variables in a loop

2012-06-24 Thread Joshua Wiley
Hi Taylor, Even clearner would be: countries - lapply(1:20, function(i) as.matrix(subset(OECDFiscal2, Country == i))) if you prefer to stick with the loop (up to you), I would instantiate the list at size: countries - vector(list, 20) for (i in 1:20) { countries[[i]] =

Re: [R] Defining multiple variables in a loop

2012-06-24 Thread Jorge I Velez
Dear Taylor, You might also try with(OECDFiscal2, strsplit(OECDFical2, Country)) HTH, Jorge.- On Sun, Jun 24, 2012 at 11:31 PM, Taylor White wrote: Thank you gentlemen for pointing me in the right direction. This code worked nicely: countries - list() for (i in 1:20) {

Re: [R] Large Test Datasets in R

2012-06-24 Thread Joshua Wiley
Hi Ravi, My hunch would be no because it seems awfully inefficient. Packages are mirrored all over the world, and it seems rather silly to be mirroring, updating, etc. large datasets. The good news is that if you just want a 10,000 x 100,000 matrix of 0/1s, it is trivial to generate: X -

Re: [R] How to calculate the predicted value by using GAMs?

2012-06-24 Thread Özgür Asar
See ?predict.gam Best Ozgur -- View this message in context: http://r.789695.n4.nabble.com/How-to-calculate-the-predicted-value-by-using-GAMs-tp4634317p4634384.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org

Re: [R] axis in r plot

2012-06-24 Thread sathya7priya
I need to increase the size of the graph by increasing the spacing between each tickmarks. -- View this message in context: http://r.789695.n4.nabble.com/axis-in-r-plot-tp4634199p4634383.html Sent from the R help mailing list archive at Nabble.com. __

[R] x12 ARIMA Moving Seasonality F Test Issue

2012-06-24 Thread oosw1oo
I'm having a great deal of trouble replicating x12 ARIMA's F-test used to detect moving seasonality. According to all literature I could find, the test is apparently a 2-way ANOVA with year and month as factors for the SI ratios determined by x12's smoothing algorithm. Note the SI ratio is simply

Re: [R] Defining multiple variables in a loop

2012-06-24 Thread Jorge I Velez
Please use split() instead of strsplit(). Apologies to all. --JIV On Sun, Jun 24, 2012 at 11:38 PM, Jorge I Velez wrote: Dear Taylor, You might also try with(OECDFiscal2, strsplit(OECDFical2, Country)) HTH, Jorge.- On Sun, Jun 24, 2012 at 11:31 PM, Taylor White wrote: Thank