[R] Conditional plot(Lattice)

2010-01-28 Thread Brima
Hi All, I am completely new to R. I have the below data and want to create a conditional variable say Prof.H as such that it equals 1 if Prof is > 50 and 0 otherwise and create a scatter plot of Value and Dim conditional on the new variable. Area Value Dim Prof 1 1 145.1

[R] How to convert timestamps?

2010-01-28 Thread johannes rara
I have timestamps from mysql database: > dput(tstamp) c(1225221868L, 1225221906L, 1225221906L, 1225230997L, 1225231000L, 1225231003L, 1225231152L, 1225231348L, 1225231351L, 1225231400L ) How to convert these into normal dates? Thanks, jrara __ R-help@

Re: [R] ask a question about data replacement

2010-01-28 Thread song song
i got it use function rank can get the result 2010/1/28 song song > the question like this : > > x=c(2,6,8,11,11,11,6,8,2,8,6,11,8,2,6,11) > > x contains values (2, 6, 8, 11) with frequency (3, 4, 4, 5). > > now I want to get the vector by replacing (2, 6, 8, 11) --->>> (1 2 3 4) > > that is

[R] ask a question about data replacement

2010-01-28 Thread song song
the question like this : x=c(2,6,8,11,11,11,6,8,2,8,6,11,8,2,6,11) x contains values (2, 6, 8, 11) with frequency (3, 4, 4, 5). now I want to get the vector by replacing (2, 6, 8, 11) --->>> (1 2 3 4) that is, want to get new x as (1 2 3 4 4 4 2 3 1 3 2 4 3 1 2 4) is there any function in R

[R] R memory issue / quantreg

2010-01-28 Thread Dan Rabosky
Hi - I also posted this on r-sig-ecology to little fanfare, so I'm trying here. I've recently hit an apparent R issue that I cannot resolve (or understand, actually). I am using the quantreg package (quantile regression) to fit a vector of quantiles to a dataset, approx 200-400 observation

[R] plyr / spm issue

2010-01-28 Thread Chuck White
I am not able to get spm function in SemiPar to work with plyr. Here's an example: library(plyr) library(SemiPar) data <- data.frame(id=c(rep("111",100),rep("222",200)), value=c(rnorm(100,2,1),rnorm(200,10,5))) #this works data111 <- data[data$id=="111"

Re: [R] Data.frame manipulation

2010-01-28 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 28.01.2010 17:40:01: > Thank you, Dennis and Petr. > > One more question: when aggregating to one es per id, how would I go about > keeping the other variables in the data.frame (e.g., keeping the value for > the first row of the other variables, suc

[R] Barplot/Histogram (lattice)

2010-01-28 Thread Santosh
Dear Rxperts.. what settings in barplot and histogram do I use, to show bars in an monotonously increasing or decreasing order of the frequency of a categorical variable? an example is provided below.. histogram(~factor(sample(letters,200,rep=T))) I was able to get it in 3 - 4 steps.. l a1 <- s

[R] R on Hard drive memory

2010-01-28 Thread prem_R
I heard form my friend there is a way to run R in system hard disk space not in the RAM .By that we may not run out of memory and have problem attached with the same.Someone could help me in this.Thanks. -- View this message in context: http://n4.nabble.com/R-on-Hard-drive-memory-tp1401528p14015

Re: [R] RV: Rattle not reading files on windows 7

2010-01-28 Thread RICHARD M. HEIBERGER
The message you are getting is unrelated to reading files. That probably means you have loaded a previous work file that is masking something. Type conflicts(detail=TRUE) If that doesn't give you the answer, then try closing R entirely and start a new session from START > Run > c:\Progra~1\

Re: [R] Rattle not reading files on windows 7

2010-01-28 Thread Graham Williams
IGNACIO PEREZ VELEZ escuelaing.edu.co> writes: > > Hi, > > I migrated to Windows 7 and now rattle does not read files whenever I try to read a file I get the following error: > > "Error en sqrt(ncol(crs$dataset)) : > Argumento no numérico para función matemática" > > In english: > > "Err

[R] apply function with grouped columns

2010-01-28 Thread Jack Siegrist
I have a data set of many rows and many columns in which both the rows and the columns have associated grouping factors. Is there a way to do what 'aggregate' does but in the other dimension? The way I have been doing this is to use 'aggregate' on the data in the usual way and then rotate the res

Re: [R] Problems with fitdistr

2010-01-28 Thread vikrant
Yes I do have zeros in my data. But I m not able to understand y inclusion of zeros results in error messages, because range for x in weibull distribution is x>=0. Can you please clarify this doubt? -- View this message in context: http://n4.nabble.com/Problems-with-fitdistr-tp1334772p1401513.h

Re: [R] how to create a histogram from a matrix?

2010-01-28 Thread Peter Alspach
Tena koe Gabriele read.table() creates a data frame not a matrix. The distinction is important. A data frame is a special kind of list: it is a list of column vectors all of the same length. Because it is a list, each column can be of a different type (i.e., integer, numeric, character, factor

[R] how to create a histogram from a matrix?

2010-01-28 Thread Zoppoli, Gabriele (NIH/NCI) [G]
Hi, I'm trying to create a frequency histogram for all the values in a table, but when I try to do so, an error is returned, saying that I cannot create a histogram with an obkect of that class. Here's what I do: >library(lattice) >table<-read.table("C:/.../table",header=TRUE,sep="\t") >histog

Re: [R] random permuted block randomization

2010-01-28 Thread Greg Snow
you might want to look at the rollmean function in the zoo package if you want a fixed window. If you want a cumulative mean then you can do something like > cumsum(x)/seq_along(x) If neither of those work, then give us some more detail. From: r-help-bo

Re: [R] random permuted block randomization

2010-01-28 Thread Ayesha
oki :D and do you know if there is an inbuilt R pacakage that calculate moving averages over time? i found this , "Calculate various moving averages (MA) of a series." Usage SMA(x, n=10) EMA(x, n=10, wilder=FALSE) but when i tried SMA , R wouldnt recognize it! and there isnt such a packa

Re: [R] random permuted block randomization

2010-01-28 Thread Greg Snow
Sorry, that is a stupid bug in the blockrand function. I will hunt down the author and slap him upside the head until he fixes it (actually I will probably just raid his freezer and eat his ice cream). In the mean time there is a simple work around, if you run blockrand like: > blockrand(40, b

Re: [R] random permuted block randomization

2010-01-28 Thread Ayesha
I have tried blockrand but it works in a way that it keeps altering the block size.. like it alternates between 8,6,12. I want a constant block size of 8 :( -- View this message in context: http://n4.nabble.com/random-permuted-block-randomization-tp1401407p1401496.html Sent from the R help maili

Re: [R] Fwd: Re: Graph color

2010-01-28 Thread Greg Snow
the command: > axis(4) will put tickmarks and labels on the right, you may want to preceed the plot with something like: > par(mar=c(5,4,4,4)+0.1) see ?axis and ?par for details. From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Beha

Re: [R] random permuted block randomization

2010-01-28 Thread Greg Snow
Take a look at the blockrand package, it may do what you want. > library(blockrand) #after installing > myrand <- blockrand(40, block.sizes=4) > myrand hope this helps, From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf Of Ayesha

[R] how to express time series linear model Q(t) ~ Q(t-1)+.. Q(t-n) as a formula

2010-01-28 Thread CJ Rubio
For example I have a time series Q(t) ~ Q(t-1) + Q(t-2) + Q(t-3) meaning that my current value is dependent to the 3 previous values. Can anybody help me express this in a formula that I can use for my neural network model (I am planning to use packages "nnet" and "MASS") -- View this message

Re: [R] Using tcltk or other graphical widgets to view zoo time series objects

2010-01-28 Thread j verzani
manipulated > (by some algorithm or be saved individually etc. etc.)... > > I am trying to modify the code at the above link but somehow I can not > make it to work with zoo time series objects. > > Any help would be greatly appreciated. > > Thanks in advance, > Costas >

[R] help in identifying the argument "formula" in the package nnet

2010-01-28 Thread CJ Rubio
hi everyone! I have a 40-year monthy streamflow record. And i want to fit a neural network. I already fitted an autoregressive model and found out that an AR(3) model fits my time series (time.series) the best. I am currently having problems on how to express the argument "formula" for my neura

[R] Problem to install Tinn-R_2.3.4.4

2010-01-28 Thread Roslina Zakaria
Hi r-users,   I manage to install the Tinn-R_2.3.4.4 successfully.  However, I cannot the execute my code and cannot open that window and get this message:   "The preferred Rterm was not defined "   and it suggest 'Options/main/R//path/Gui'.  What that mean and how to do it.   Thank you so mcuh f

Re: [R] Large integers in R

2010-01-28 Thread Bert Gunter
No it isn't strange. Please read: ?options digits ?print.default and then print the results with more digits. Bert Gunter Genentech Nonclinical Biostatistics -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Len Vir Sent: Th

Re: [R] Large integers in R

2010-01-28 Thread Len Vir
Hi! That is somewhat strange. §R>2^100 [1] 1.267651e+30 §R> x <- 2^50 §R> y <- x + 1 §R> y-x [1] 1 §R>x [1] 1.1259e+15 §R>x+1 [1] 1.1259e+15 len From: Duncan Murdoch [murd...@stats.uwo.ca] Sent: Tuesday, January 26, 2010 4:09 PM To: Blanford, Glenn Cc: r-help@R-project.o

[R] random permuted block randomization

2010-01-28 Thread Ayesha Khan
Hi, I am very new to R. Just started yesterday. I have to generate a sequence of 40 random treatments using permuted block randomization with a block size of 8. Then I have to plot moving averages for the resulting sequence. I have tried the sample function but I dont know if wht i did is right or

Re: [R] Error on using lag function

2010-01-28 Thread Peter Ehlers
Did you try it? I said library(zoo) na.locf(P, fromLast=TRUE) Note the 'fromLast=TRUE'; that tells na.locf() to use the reverse of your vector. What I meant by "You'll have to decide what to do if the last value is NA" is that you'll need to decide what to do if your vector ends with a NA, say

[R] Rattle not reading files on windows 7

2010-01-28 Thread IGNACIO PEREZ VELEZ
Hi, I migrated to Windows 7 and now rattle does not read files whenever I try to read a file I get the following error: "Error en sqrt(ncol(crs$dataset)) : Argumento no numérico para función matemática" In english: "Error on sqrt(ncol(crs$dataset)) : Non numeric argument for a mathematic

Re: [R] Constrained vector permutation

2010-01-28 Thread Thomas Lumley
On Thu, 28 Jan 2010, Jason Smith wrote: It wouldn't be guaranteed to produce any usable permutation, but it seems like it would be much faster and so could be repeated until an acceptable vector is found.  What do you think? Thanks-- Andy I think I am not understanding what your ultimate goa

Re: [R] Fwd: Re: Graph color

2010-01-28 Thread Jose Narillos de Santos
Hi Jim your suggestion doesn´t work properly. I have find some documents on graphs so let me think till monday and if not I will detail where it fails. Sorry again...I feel very silly, really, it is not a joke but I will continue trying... I have a question also, in a general plot (please if you

[R] RV: Rattle not reading files on windows 7

2010-01-28 Thread IGNACIO PEREZ VELEZ
Hi, I migrated to Windows 7 and now rattle does not read files whenever I try to read a file I get the following error: "Error en sqrt(ncol(crs$dataset)) : Argumento no numérico para función matemática" In english: "Error on sqrt(ncol(crs$dataset)) : Non numeric argument for a mathematic

Re: [R] Error on using lag function

2010-01-28 Thread anna
Hi Peter, thank you for helping. The thing is don't want to it replace it with the last value but with the next value - Anna Lippel -- View this message in context: http://n4.nabble.com/Error-on-using-lag-function-tp1399935p1401319.html Sent from the R help mailing list archive at Nabble.co

Re: [R] hist - unevenly spaced bars

2010-01-28 Thread Peter Ehlers
Well, your bars are not unevenly spaced; you just have some zero-count intervals. Time to learn about the str() function which will tell you what's going on. zh <- hist(your_code) str(zh) zh$breaks zh$counts You could set breaks with hist(..., breaks=0:5 + .5) But a histogram doesn't seem like

Re: [R] Error on using lag function

2010-01-28 Thread Peter Ehlers
Does this help: library(zoo) na.locf(P, fromLast=TRUE) You'll have to decide what to do if the last value is NA. -Peter Ehlers anna wrote: Hello everyone, I have a vector P and I want to replace each of its missing values by its next element, for example: P[i] = NA --> P[i] = P[i+1] To do th

Re: [R] optimization challenge

2010-01-28 Thread Greg Snow
Well, Albyn Jones gave a great solution to my challenge that found the best reading schedule. My original thought was that doing an exhaustive search would take too much time, but Albyn showed that there are ways to do it efficiently. My approach (as mentioned before) was to use optim with meth

[R] hist - unevenly spaced bars

2010-01-28 Thread Worik R
I am sure this is trivial, but I cannot solve it. I make a histogram. There are 5 categories "1",...,"5" and 80 values and the histogram does not evenly space the bars. Bars "1" and "2" have no space between them and the rest are evenly spaced. How can I get all bars evenly spaced? The code:

[R] Error on using lag function

2010-01-28 Thread anna
Hello everyone, I have a vector P and I want to replace each of its missing values by its next element, for example: P[i] = NA --> P[i] = P[i+1] To do this I am using the replace() and lag() functions like this: P <- replace(as.ts(P),is.na(as.ts(P)),as.ts(lag(P,1))) but here is the error that I ge

Re: [R] Data frame of different sized lists in a function call

2010-01-28 Thread Greg Snow
If you understand the differences between R lists and R vectors then this should be easy: > vec1 <- 1:10 > vec2 <- 2:4 > myListOfVectors <- list( vec1, vec2 ) Now you can pass the single list of 2 different sized vectors to your function. For more details on working with lists (and vectors an

Re: [R] Data frame of different sized lists in a function call

2010-01-28 Thread David Winsemius
On Jan 28, 2010, at 4:03 PM, Jonathan Greenberg wrote: list1=c(1:10) # neither of which really are lists list2=c(2:4) lists = list(list1,list2) $ a list of two vectors. David Winsemius, MD Heritage Laboratories West Hartford, CT __ R-help@r-proj

Re: [R] weighted least squares vs linear regression

2010-01-28 Thread David Winsemius
On Jan 28, 2010, at 2:14 PM, DispersionMap wrote: sorry, i ommited some important information. this is a documentation question! i meant to ask how to find out how R calculates the standard error and how it differs between the two models Luke, Use the Code!. -- View this message

[R] Data frame of different sized lists in a function call

2010-01-28 Thread Jonathan Greenberg
I'm hoping to get some "best practice" feedback for constructing a function call which takes an undefined set of DIFFERENT length vectors -- e.g. say we have two lists: list1=c(1:10) list2=c(2:4) lists = data.frame(list1,list2) coerces those two to be the same length (recycling list2 to fill

Re: [R] color palette for points, lines, text / interactive Rcolorpicker?

2010-01-28 Thread Greg Snow
I don't know of any existing palettes that meet your conditions, but here are a couple of options for interactive exploration of colorsets (this is quick and dirty, there are probably some better orderings, base colors, etc.): colpicker <- function( cols=colors() ) { n <- length(cols)

Re: [R] Constrained vector permutation

2010-01-28 Thread Jason Smith
> It wouldn't be guaranteed to produce any usable permutation, but it seems > like it would be much faster and so could be repeated until an acceptable > vector is found.  What do you think? > > Thanks-- > Andy > I think I am not understanding what your ultimate goal is so I'm not sure I can give

Re: [R] navigation panel with help

2010-01-28 Thread Duncan Murdoch
On 28/01/2010 3:22 PM, Changyou Sun wrote: Duncan, Thank you for your quick reply. Do we users have any options to change that? I personally become addicted to the navigation panel and feel it is kind of table of contents. You could downgrade to 2.9.2, but you'd lose all the other new stuff

Re: [R] navigation panel with help

2010-01-28 Thread Changyou Sun
Duncan, Thank you for your quick reply. Do we users have any options to change that? I personally become addicted to the navigation panel and feel it is kind of table of contents. Regards, Edwin Sun -Original Message- From: Duncan Murdoch [mailto:murd...@stats.uwo.ca] Sent: Thursday,

Re: [R] navigation panel with help

2010-01-28 Thread Duncan Murdoch
On 28/01/2010 3:15 PM, Edwin Sun wrote: All, I installed the lastest version of R 2.10.1. On the help page for a specific function, it turns out that the vertical navigation panel on the left does not appear anymore. For example, ?lm The help page from this command is a page without navigati

Re: [R] question about reshape

2010-01-28 Thread Dana TUDORASCU
Thank you very much everybody. That worked. Dana On Thu, Jan 28, 2010 at 12:23 PM, Henrique Dallazuanna wrote: > Try this: > > ong<-reshape(as.data.frame(dataset), idvar="subject", > v.names="response", varying=list(2:5), direction="long") > or > dataset <- cbind.data.frame(y1, y2, y3, y4) > >

[R] navigation panel with help

2010-01-28 Thread Edwin Sun
All, I installed the lastest version of R 2.10.1. On the help page for a specific function, it turns out that the vertical navigation panel on the left does not appear anymore. For example, ?lm The help page from this command is a page without navigation panel (which I prefer to use). I notice

Re: [R] selecting significant predictors from ANOVA result

2010-01-28 Thread Ista Zahn
Hi Ram, As others have pointed out, writing the code is the least of your problems. In case this isn't sinking in, try the following exercise: set.seed(10) P <- vector() DF <- as.data.frame(matrix(rep(NA, 10), nrow=100)) names(DF) <- c(paste("x",1:999, sep=""), "y") for(i in 1:1000) { DF[,i

Re: [R] using functions with multiple arguments in the "apply" family

2010-01-28 Thread Peter Ehlers
chipmaney wrote: typically, the apply family wants you to use vectors to run functions on. However, I have a function, kruskal.test, that requires 2 arguments. kruskal.test(Herb.df$Score,Herb.df$Year) This easily computes the KW ANOVA statistic for any difference across years However, my

Re: [R] Constrained vector permutation

2010-01-28 Thread Andrew Rominger
Hi Jason, Thanks for you suggestions, I think that's pretty close to what I'd need. The only glitch is that I'd be working with a vector of ~30 elements, so permutations(...) would take quite a long time. I only need one permutation per vector (the whole routine will be within a loop that generat

Re: [R] RMySQL - Bulk loading data and creating FK links

2010-01-28 Thread Gabor Grothendieck
Regarding the explanation of where the time goes it might be parsing the statement or the development of the query plan. The SQL statement for the more complex query is obviously much longer and its generated query plan involves 95 lines of byte code vs 19 lines of generated code for the simpler q

Re: [R] grid.image(), pckg grid

2010-01-28 Thread Paul Murrell
Hi Markus Loecher wrote: > While I am very happy with and awed by the grid package and its basic > plotting primitives such as grid.points, grid.lines, etc, I was wondering > whether the equivalent of a grid.image() function exists ? No. But a simple implementation based on grid.rect() is not

Re: [R] weighted least squares vs linear regression

2010-01-28 Thread DispersionMap
sorry, i ommited some important information. this is a documentation question! i meant to ask how to find out how R calculates the standard error and how it differs between the two models -- View this message in context: http://n4.nabble.com/weighted-least-squares-vs-linear-regression-tp13879

Re: [R] RMySQL - Bulk loading data and creating FK links

2010-01-28 Thread Matthew Dowle
I'm talking about ease of use to. The first line of the Details section in ?"[.data.table" says : "Builds on base R functionality to reduce 2 types of time : 1. programming time (easier to write, read, debug and maintain) 2. compute time" Once again, I am merely saying that the

Re: [R] Interpolation

2010-01-28 Thread Ravi Varadhan
The warning message simply indicates that you have more than one data point with the same "x" value. So, `approx' collapses over the dulicate x values by averaging the corresponding "y" values. I am not sure if this is your problem - it doesn't seem like it. It is doing what seems reasonable for

Re: [R] question about reshape

2010-01-28 Thread Henrique Dallazuanna
Try this: ong<-reshape(as.data.frame(dataset), idvar="subject", v.names="response", varying=list(2:5), direction="long") or dataset <- cbind.data.frame(y1, y2, y3, y4) On Thu, Jan 28, 2010 at 3:07 PM, Dana TUDORASCU wrote: >  Hello everyone, >  I have a bit of a problem with reshape function in

Re: [R] Interpolation

2010-01-28 Thread stephen sefick
Why not look into the zoo package na.approx? And related functions. On Thu, Jan 28, 2010 at 11:29 AM, ogbos okike wrote: > Happy New Year. > I have a data of four columns - year, month, day and count. The last column, > count, contains some missing data which I have to replace with NA. I tried >

[R] question about reshape

2010-01-28 Thread Dana TUDORASCU
Hello everyone, I have a bit of a problem with reshape function in R. I have simulated some normal data, which I have saved in 4 vectors. y.1,y.2,y.3,y.4 which I combined a dataset: datasethttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/pos

[R] qplot themes

2010-01-28 Thread evgeny55
Hi, I'm having trouble editing the qplot layout. I'm using the geom="tile" option and I want to do a few things: 1. move the vertical and horizontal gridlines so that they appear on the edge of each tile (right now they're in the middle) 2. bring the gridlines to the foreground and change thei

Re: [R] Problems with fitdistr

2010-01-28 Thread J. R. M. Hosking
vikrant wrote: Hi, I want to estimate parameters of weibull distribution. For this, I am using fitdistr() function in MASS package.But when I give fitdistr(c,"weibull") I get a Error as follows:- Error in optim(x = c(4L, 41L, 20L, 6L, 12L, 6L, 7L, 13L, 2L, 8L, 22L, : non-finite valu

Re: [R] Data.frame manipulation

2010-01-28 Thread Dennis Murphy
Hi: On Thu, Jan 28, 2010 at 8:40 AM, AC Del Re wrote: > Thank you, Dennis and Petr. > > One more question: when aggregating to one es per id, how would I go about > keeping the other variables in the data.frame (e.g., keeping the value for > the first row of the other variables, such as mod2)

Re: [R] weighted least squares vs linear regression

2010-01-28 Thread Bert Gunter
You'll probably need to consult a suitable text on linear models/applied regression, as this is a statistics, not an R question -- or look for a suitable tutorial on the web. You might also try one of the statistics mailing lists or Google on some suitable phrase. Bert Gunter Genentech Nonclinica

Re: [R] number of decimal

2010-01-28 Thread David Winsemius
On Jan 28, 2010, at 12:08 PM, Marc Schwartz wrote: On Jan 28, 2010, at 10:04 AM, David Winsemius wrote: On Jan 28, 2010, at 10:55 AM, Marc Schwartz wrote: Ivan, The default behavior for print()ing objects to the console in an R session is via the use of the print.* methods. For real nu

Re: [R] exporting multidimensional matrix from R

2010-01-28 Thread David Winsemius
On Jan 28, 2010, at 10:42 AM, Gopikrishna Deshpande wrote: Hi, I have a matrix of size 19x512x20 in R. No, you don't. Matrices are only 2 dimensional in R. You may have an "array", however. I want to export this file into another format which can be imported into MATLAB. write.xls or wr

Re: [R] number of decimal

2010-01-28 Thread Marc Schwartz
On Jan 28, 2010, at 10:04 AM, David Winsemius wrote: > > On Jan 28, 2010, at 10:55 AM, Marc Schwartz wrote: > >> Ivan, >> >> The default behavior for print()ing objects to the console in an R session >> is via the use of the print.* methods. For real numerics, print.default() is >> used and

[R] weighted least squares vs linear regression

2010-01-28 Thread DispersionMap
I need to find out the difference between the way R calculates weighted regression and standard regression. I want to plot a 95% confidence interval around an estimte i got from least squares regression. I cant find he documentation for this ive looked in ?stats ?lm ?predict.lm ?weights ?res

Re: [R] tapply on multiple groups

2010-01-28 Thread Gigi Lipori
Thanks. My mistake was that I used c(dbs.final$Days,dbs.final$Place) instead of list(... when I tried to follow that part of the documentation. >>> David Winsemius 1/28/2010 11:49 AM >>> On Jan 28, 2010, at 10:26 AM, GL wrote: > > Can you make tapply break down groups similar to bwplot or suc

Re: [R] RMySQL - Bulk loading data and creating FK links

2010-01-28 Thread Gabor Grothendieck
I think one would only be concerned about such internals if one were primarily interested in performance; otherwise, one would be more interested in ease of specification and part of that ease is having it independent of implementation and separating implementation from specification activities. A

Re: [R] Recoding Variables in R

2010-01-28 Thread John Fox
Dear Abraham, If I follow correctly what you want to do, the following should do it: > f <- factor(c(1, 1, 5, 5, 8, 8, 9, 9, 0, 0)) > f [1] 1 1 5 5 8 8 9 9 0 0 Levels: 0 1 5 8 9 > recode(f, " '1'=3; '5'=1; '0'=2; else=NA ") [1] 331122 Levels: 1 2 3 I think that your

Re: [R] tapply on multiple groups

2010-01-28 Thread David Winsemius
On Jan 28, 2010, at 10:26 AM, GL wrote: Can you make tapply break down groups similar to bwplot or such? Example: Data frame has one measure (Days) and two Dimensions (MM and Place). All have the same length. length(dbs.final$Days) [1] 3306 length() [1] 3306 length() [1] 3306

[R] Setting base level for contrasts with lme

2010-01-28 Thread Marcin Kozak
Hi all, Note: lm(Yield ~ Block + C(Variety, base = 2), Alfalfa) equals i <- 2; lm(Yield ~ Block + C(Variety, base = i), Alfalfa) However, lme(Yield ~ C(Variety, base = 2), Alfalfa, random=~1|Block) which is fine, does not equal i <- 2; lme(Yield ~ C(Variety, base = i), Alfalfa, random=~1|Block)

Re: [R] Data.frame manipulation

2010-01-28 Thread AC Del Re
Thank you, Dennis and Petr. One more question: when aggregating to one es per id, how would I go about keeping the other variables in the data.frame (e.g., keeping the value for the first row of the other variables, such as mod2) e.g.: # Dennis provided this example (notice how mod2 is removed f

[R] Recoding Variables in R

2010-01-28 Thread Mathew, Abraham T
VAR 980490 Some people have suggested placing new limits on foreign imports in order to protect American jobs. Others say that such limits would raise consumer prices and hurt American exports. Do you FAVOR or OPPOSE placing new limits on imports, or haven't you thought much about this?

Re: [R] number of decimal

2010-01-28 Thread Peter Ehlers
Ivan, Now I'm no longer sure of just what you want. Are you concerned about the *internal* handling of numbers by R or just about the *printing* of numbers? As Marc has pointed out, internally R will use the full precision that your input allows. Perhaps you're using the F-value from the output

[R] RMySQL install

2010-01-28 Thread Robert Schneider
Hi everyone, I am trying to install the RMySQL package under windows xp. I've got the MySQL installed on the computer (MySQL server 5.1). I went through the steps presented on the webpage http://biostat.mc.vanderbilt.edu/wiki/Main/RMySQL and googled around and still can't find the answer. With

Re: [R] number of decimal

2010-01-28 Thread Ivan Calandra
I guess the easiest solution for me would therefore be to set options(digits) to a high number, and then round down if I need to! Thanks you both for your input! Ivan Le 1/28/2010 17:02, Peter Ehlers a écrit : Looks like I didn't read your post carefully enough. If you want some sort of global

Re: [R] number of decimal

2010-01-28 Thread Peter Ehlers
Looks like I didn't read your post carefully enough. If you want some sort of global option to set the display of numbers from any operation performed by R then that's not likely to be possible without capturing all output and formatting it yourself. As the saying goes 'good luck with that'. Note

Re: [R] number of decimal

2010-01-28 Thread David Winsemius
On Jan 28, 2010, at 10:55 AM, Marc Schwartz wrote: Ivan, The default behavior for print()ing objects to the console in an R session is via the use of the print.* methods. For real numerics, print.default() is used and the format is based upon the number of significant digits, not the num

Re: [R] number of decimal

2010-01-28 Thread Ivan Calandra
First things first: thanks for your help! I see where the confusion is. With formatC and sprintf, I have to store the numbers I want to change into x. I would like a way without applying a function on specific numbers because I can shorten the numbers that way, but it won't give me more deci

Re: [R] large integers in R

2010-01-28 Thread Thomas Lumley
On Thu, 28 Jan 2010, Benilton Carvalho wrote: Hi Duncan, On Tue, Jan 26, 2010 at 9:09 PM, Duncan Murdoch wrote: On 26/01/2010 3:25 PM, Blanford, Glenn wrote: Has there been any update on R's handling large integers greater than 10^9 (between 10^9 and 4x10^9) ? as.integer() in R 2.9.2 lists

Re: [R] number of decimal

2010-01-28 Thread Marc Schwartz
Ivan, The default behavior for print()ing objects to the console in an R session is via the use of the print.* methods. For real numerics, print.default() is used and the format is based upon the number of significant digits, not the number of decimal places. There is also an interaction with p

Re: [R] plotting additive ns components

2010-01-28 Thread Thomas Lumley
On Wed, 27 Jan 2010, David Winsemius wrote: On Jan 27, 2010, at 9:09 PM, GlenB wrote: I have an additive model of the following form : zmdlfit <- lm(z~ns(x,df=6)+ns(y,df=6)) I can get the fitted values and plot them against z easily enough, but I also want to both obtain and plot the two

Re: [R] number of decimal

2010-01-28 Thread Peter Ehlers
Ivan Calandra wrote: It looks to me that it does more or less the same as format(). Maybe I didn't explain myself correctly then. I would like to set the number of decimal by default, for the whole R session, like I do with options(digits=6). Except that digits sets up the number of digits (i

[R] exporting multidimensional matrix from R

2010-01-28 Thread Gopikrishna Deshpande
Hi, I have a matrix of size 19x512x20 in R. I want to export this file into another format which can be imported into MATLAB. write.xls or write.table exports only one dimension. please send a code if possible. I am very new to R and have been struggling with this. Thanks ! Gopi [[altern

[R] grid.image(), pckg grid

2010-01-28 Thread Markus Loecher
While I am very happy with and awed by the grid package and its basic plotting primitives such as grid.points, grid.lines, etc, I was wondering whether the equivalent of a grid.image() function exists ? Any pointer would be helpful. Thanks ! Markus [[alternative HTML version deleted]]

[R] color palette for points, lines, text / interactive Rcolorpicker?

2010-01-28 Thread Michael Friendly
I'm looking for a scheme to generate a default color palette for plotting points, lines and text (on a white or transparent background) with from 2 to say 9 colors with the following constraints: - "red" is reserved for another purpose - colors should be highly distinct - avoid light colors (like

Re: [R] Conditional density plot in lattice

2010-01-28 Thread Deepayan Sarkar
On Fri, Jan 22, 2010 at 2:08 AM, Dieter Menne wrote: > > > Deepayan Sarkar wrote: >> >> With a restructuring of the data: >> >> df1 = data.frame(x=0:n, y1=((0:n)/n)^2, y2=1-((0:n)/n)^2, age="young") >> df2 = data.frame(x=0:n, y1=((0:n)/n)^3, y2=1-((0:n)/n)^3, age="old") >> df = rbind(df1, df2) >>

Re: [R] Print lattice output to table?

2010-01-28 Thread GL
That works great. Thanks! -- View this message in context: http://n4.nabble.com/Print-lattice-output-to-table-tp1375040p1380862.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mai

[R] make a grid with longitude, latitude and bathymetry data

2010-01-28 Thread karine heerah
hi, i have a longitude vector (x) a latitude vector (y) and a matrix of bathymetry (z) with the dimensions (x,y). I have already succeeded in plotting it with the image.plot (package 'field') and the contour functions. But now, I want to make a grid in order to extract easily the bathymetry c

[R] tapply on multiple groups

2010-01-28 Thread GL
Can you make tapply break down groups similar to bwplot or such? Example: Data frame has one measure (Days) and two Dimensions (MM and Place). All have the same length. > length(dbs.final$Days) [1] 3306 > length(dbs.final$Place) [1] 3306 > length(dbs.final$MM) [1] 3306 Doing the followi

Re: [R] Print lattice output to table?

2010-01-28 Thread Deepayan Sarkar
On Thu, Jan 28, 2010 at 6:25 AM, GL wrote: > > I have beautiful box and whisker charts formatted with lattice, which is > obviously calculating summary statistics internally in order to draw the > charts. Is there a way to dump the associated summary tables that are being > used to generate the ch

Re: [R] number of decimal

2010-01-28 Thread Ivan Calandra
It looks to me that it does more or less the same as format(). Maybe I didn't explain myself correctly then. I would like to set the number of decimal by default, for the whole R session, like I do with options(digits=6). Except that digits sets up the number of digits (including what is befor

Re: [R] select one row from data-frame by name, indirectly (as string)

2010-01-28 Thread David Winsemius
On Jan 28, 2010, at 10:04 AM, Oliver wrote: OK, now it works... just using [ and ] or [[ and ]] works. I thought have tried it before... why does it workj now and not before? Provide your console session and someone can tell you. Failing that, you are asking us to read your mind.

Re: [R] select one row from data-frame by name, indirectly (as string)

2010-01-28 Thread Oliver
OK, now it works... just using [ and ] or [[ and ]] works. I thought have tried it before... why does it workj now and not before? hmhh sorry for the traffic __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

[R] select one row from data-frame by name, indirectly (as string)

2010-01-28 Thread Oliver
Hello, say I have a dataframe x and it contains rows like "ch_01", "ch_02" and so on. How can I select those channels iundirectly, by name? I tried to select the data with get() but get() seems only to work on simple variables? Or how to do it? I need something like that: name1 <- "ch_01"

[R] Setting breaks for histogram of dates

2010-01-28 Thread Loris Bennett
Hi, I have a list of dates like this: date 2009-12-03 2009-12-11 2009-10-07 2010-01-25 2010-01-05 2009-09-09 2010-01-19 2010-01-25 2009-02-05 2010-01-25 2010-01-27 2010-01-27 ... and am creating a histogram like this t <- read.table("test.dat",header=TRUE) hist(

[R] Print lattice output to table?

2010-01-28 Thread GL
I have beautiful box and whisker charts formatted with lattice, which is obviously calculating summary statistics internally in order to draw the charts. Is there a way to dump the associated summary tables that are being used to generate the charts? Realize I could use tapply or such to get somet

  1   2   >