[R] Opening excel CSV file in R

2011-11-08 Thread Dan Zhou
Hi, So I have everything written out. I used R-studio (same as R console but with an IDE) and I had no trouble calling upon and opening the csv file for computation. However, when I try to run my code in plain old R, it says that the file could not be located. Heres my code: func <- function(fil

Re: [R] window?

2011-11-08 Thread R. Michael Weylandt
Like Denis said, you are asking ts to do things that don't make sense; in particular, some of your statements suggest you don't fully understand what window does or what its frequency argument does. Specifically, when you set frequency = 1 in window, that doesn't mean take a window and treat it as

Re: [R] from points in Lon/Lat to physical distance in dist class

2011-11-08 Thread Mao Jianfeng
Dear David, Thanks a lot for your kind reply. Unfortunately, distm() can not give me what I want. distm(), output the distance matrix (but not in dist class). Fortunately, I just realized that as.dist() from base R can convert matrix to dist class. Thanks again. Best Jian-Feng, 2011/11/8 Davi

Re: [R] Sorting Panel Data by Time

2011-11-08 Thread economicurtis
Thank you very much DJ MuseR! Curtis K ~ Sent from a PDA. I apologize in advance for any typing errors. On Nov 8, 2011, at 4:36 PM, "djmuseR [via R]" wrote: > Here's another approach using the plyr and data.table packages, where > df is the name I gave to your example data: > > # plyr

Re: [R] plot separate groups with plotmeans()

2011-11-08 Thread Dennis Murphy
Hi: Here are a couple of ways using the plyr and ggplot2 packages: library('plyr') library('ggplot2') # Create a summary data frame that computes the mean # and standard deviation at each time/group combination xsumm <- ddply(x, .(Time, Group), summarise, m = mean(Score), s = sd(Score)) # Creat

Re: [R] multi-line query

2011-11-08 Thread Gabor Grothendieck
On Tue, Nov 8, 2011 at 1:04 PM, Ben quant wrote: > Because I don't know anything about sqldf. :) > > Here is what happens, but I"m sure it is happening because I didn't read > the manual yet: > >> s <- sqldf('create table r.dat("id" int primary key,"val" int)') > Error in ls(envir = envir, all.nam

Re: [R] window?

2011-11-08 Thread Kevin Burton
The problem is when I use the window function an try to extract a subset of the time series an specify the frequency as 1 (not only will ets not take a time series with a frequency greater than 24, now that I am taking a subset there is no frequency so I would like to set it to 1 (which is one of t

Re: [R] multi-line query

2011-11-08 Thread Gabor Grothendieck
On Tue, Nov 8, 2011 at 11:43 AM, Ben quant wrote: > Hello, > > I'm using package RpgSQL. Is there a better way to create a multi-line > query/character string? I'm looking for less to type and readability. > > This is not very readable for large queries: > s <-  'create table r.BOD("id" int primar

Re: [R] download.file

2011-11-08 Thread Henrik Bengtsson
See downloadFile() of the R.utils package (on CRAN); it allows you to download to a file to a given path (without have to "replicate" the filename), and it also have an option (the default) to drop zero-size files that are (sometimes) created when download.file() tries to download a non-existing f

Re: [R] dbWriteTable with field data type

2011-11-08 Thread Gabor Grothendieck
On Tue, Nov 8, 2011 at 12:16 PM, Ben quant wrote: > Hello, > > When I do: > > dbWriteTable(con, "r.BOD", cbind(row_names = rownames(BOD), BOD)) > > ...can I specify the data types such as varchar(12), float, double > precision, etc. for each of the fields/columns? > > If not, what is the best way

Re: [R] Sorting Panel Data by Time

2011-11-08 Thread Dennis Murphy
Here's another approach using the plyr and data.table packages, where df is the name I gave to your example data: # plyr library('plyr') ddply(df, .(TIME), mutate, L1 = sort(S1)) # Another way with the data.table package: library('data.table') dt <- data.table(df, key = 'TIME') dt[, list(X1, S1,

Re: [R] nesting scale_manual caracteristics in ggplot

2011-11-08 Thread Dennis Murphy
As I mentioned earlier, if you use different labels/breaks/titles for the legends, you'll get separate legends in a ggplot. I'm assuming you want to keep your original labels in scale_shape_manual(); there's no problem if you do that. The code I provided showed you how to align all three legends; i

[R] plot separate groups with plotmeans()

2011-11-08 Thread Jon Zadra
Hi, I often use plotmeans() from the gplots package to quickly visualize a pattern of change. I would like to be able to plot separate lines for different groups, but the function gives an error when a grouping variable is included in the formula argument. For instance, > require(gplots) >

Re: [R] window?

2011-11-08 Thread Dennis Murphy
The ets() function in the forecast package requires either a numeric vector or a Time-Series object (produced from ts()). The frequency argument in ts() refers to the time duration between observations; e.g., frequency = 7 means that the data are weekly; frequency = 12 means that the data are month

Re: [R] download.file

2011-11-08 Thread David Winsemius
On Nov 8, 2011, at 6:32 PM, Mary Kindall wrote: I am downloading say 100 files from ucsc website and storing it into dest folder. download.file function create a file in destination folder even if the file is not present which is something I dont want. So I wrote if condition to remove the

[R] download.file

2011-11-08 Thread Mary Kindall
I am downloading say 100 files from ucsc website and storing it into dest folder. download.file function create a file in destination folder even if the file is not present which is something I dont want. So I wrote if condition to remove the file if the download function has non zero value. Now i

Re: [R] Sorting Panel Data by Time

2011-11-08 Thread David Winsemius
On Nov 8, 2011, at 2:58 PM, economicurtis wrote: I have panel data in the following form: TIME X1 S1 1 1 0.99 1 2 0.50 1 3 0.01 2 3 0.99 2 1 0.99 2 2 0.25 3 3 0.75 3 2 0.50 3 1 0.25 ...

Re: [R] nesting scale_manual caracteristics in ggplot

2011-11-08 Thread Sigrid
Hi Dennis, Thank you, it looks much better now the three characteristics are combined in the label. However, I would like to keep two different sets of labels on the side as I want to describe lines for each facet (high and low). Do you think this is possible, without breaking up the characteristi

Re: [R] Help with SEM package: Error message

2011-11-08 Thread Lisa Pham
Dear John, Thank you for your reply. My data is actually simulated under the model X = Lambda*F + E. Since my post, I've simplified the simulation of my data and I still get the error. This is what I've done since my last post. I constructed Lambda apriori (so I know exactly which observed var

Re: [R] Sampling with conditions

2011-11-08 Thread SarahJoyes
Dan Nordlund, Dan (DSHS/RDA) wrote: > >> -Original Message- >> From: r-help-bounces@ [mailto:r-help-bounces@r- >> project.org] On Behalf Of SarahJoyes >> Sent: Tuesday, November 08, 2011 5:57 AM >> To: r-help@ >> Subject: Re: [R] Sampling with conditions >> >> That is exactly what I want

[R] Sorting Panel Data by Time

2011-11-08 Thread economicurtis
I have panel data in the following form: TIME X1 S1 1 1 0.99 1 2 0.50 1 3 0.01 2 3 0.99 2 1 0.99 2 2 0.25 3 3 0.75 3 2 0.50 3 1 0.25 ... ... .. And desire a new vector o

Re: [R] window?

2011-11-08 Thread Kevin Burton
I expect the frequency to be set to what I set it at and the window to return all of the data in the window from the original time series. The error is not because it is prime. I can generate a time series with just 52 values (or 10) and it still occurs. I am building these objects for use with the

Re: [R] Help with SEM package: Error message

2011-11-08 Thread John Fox
Dear Lisa, As I said, I don't have a whole lot of time today. At a quick glance, you simulation seems straightfoward except for > F_i ~ N(mu_i, Phi). > > mu_i is fixed to Phi*z_i, where z_i is a 5x1 vector. Why don't the factors have 0 means? I assumethat Phi is a correlation matrix. John O

Re: [R] passing dataframe col name through cbind()

2011-11-08 Thread Eric Rupley
Thanks! Makes sense now. On Nov 8, 2011, at 1:32 PM, jim holtman wrote: > Try this: > >> cbind(scores[,1,drop = FALSE], scores[,2:3]) > name round1 round2 > 1 Bob 40 5 > 2 Ron 30 6 > 3 Bud 20 4 >> > > Then do ?'[' to learn about 'drop' > > On Tue, Nov 8, 201

Re: [R] nesting scale_manual caracteristics in ggplot

2011-11-08 Thread Dennis Murphy
Hi: The problem is that you use different sets of labels in each scale_*_manual. To get all of the scales to merge into one, you need to have the same title, same breaks and same labels for the legend. This gets you a single legend: ggplot(data = df, aes(x = year, y = total, colour = treatment,

Re: [R] GAM

2011-11-08 Thread Jean V Adams
Gyanendra Pokharel wrote on 11/08/2011 10:57:38 AM: > > Hi R community! > I am analyzing the data set "motorins" in the package "faraway" by using > the generalized additive model. it shows the following error. Can some one > suggest me the right way? > > library(faraway) > data(motorins) > moto

Re: [R] Problem working with dates

2011-11-08 Thread R. Michael Weylandt
Feel free to post again if you need help. If you are comfortable with slightly-heavy-lifting in programming, but are finding "the R way" of getting things done a little counterintuitive, you can do much worse than reading Patrick Burns' two books: S Poetry and the R Inferno, available here: http://

Re: [R] Help with SEM package: Error message

2011-11-08 Thread John Fox
Dear Lisa, There doesn't seem to be anything logically wrong with your model. I don't have much time today to look into it, but trying different optimizers in version 2.0-0 of sem, using the correlation matrix in place of the covariance matrix, and setting the par.size parameter, I was unable t

Re: [R] Sampling with conditions

2011-11-08 Thread Dennis Murphy
In addition to Dan's quite valid concern, the final sample is not truly 'random' - the first k - 1 elements are randomly chosen, but the last is determined so that the constraint is met. Dennis On Tue, Nov 8, 2011 at 9:59 AM, Nordlund, Dan (DSHS/RDA) wrote: >> -Original Message- >> From

Re: [R] Question about R mantissa and number of bits

2011-11-08 Thread Nordlund, Dan (DSHS/RDA)
I am not going through all of your code to understand what you are trying to demonstrate. R uses the IEEE Standard 754 for Floating Point Numbers. There is a sign bit, 11 bits for the exponent, and 52 bits for the mantissa. Because the standard normalizes the mantissa you get an extra bit of

Re: [R] window?

2011-11-08 Thread R. Michael Weylandt
I'm not entirely sure that your request makes sense: what do you expect the frequency to be? It makes sense to me as is...Might your troubles be because 53 is prime? More generally, most people don't like working with the raw ts class and prefer the zoo or xts packages because they are much more p

Re: [R] lapply to list of variables

2011-11-08 Thread Dennis Murphy
Hi: Here's another way of doing this on the simplified version of your example: L <- vector('list', 3) # initialize a list of three components ## populate it for(i in seq_along(L)) L[[i]] <- rnorm(20, 10, 3) ## name the components names(L) <- c('Monday', 'Tuesday', 'Wednesday') ## replace va

[R] window?

2011-11-08 Thread Kevin Burton
This doesn't seem to work: > d <- rnorm(2*53) > ds <- ts(d, frequency=53, start=c(2000,10)) > dswin <- window(ds, start=c(2001,1), end=c(2001,10), frequency=1) > dswin Time Series: Start = 2001 End = 2001 Frequency = 1 [1] 1.779409 > dswin <- window(ds, start=c(2001,1), end=c(200

[R] How to handle empty arguments

2011-11-08 Thread Alaios
Dear all, I am having a data stucture that contains Products and Time Stamps,   I have made also two lists ProductList=list(c('Example1','Example2'...) TimeStamp=list(c("1990-02-03 12:57:60"),c("1990-02-03 12:57:60"),   then I have made few functions that call each other   do_analysis_for_all the d

Re: [R] Estimate of intercept in loglinear model

2011-11-08 Thread Mark Difford
On Nov 08, 2011 at 11:16am Colin Aitken wrote: > An unresolved problem is: what does R do when the explanatory factors > are not defined as factors when it obtains a different value for the > intercept but the correct value for the fitted value? Colin, I don't think that happens (that the fit

Re: [R] rpanel package - retrieve data from panel

2011-11-08 Thread michalseneca
I found names(y)<-y before the end is working ;) some more ideas ? -- View this message in context: http://r.789695.n4.nabble.com/rpanel-package-retrieve-data-from-panel-tp4016953p4017082.html Sent from the R help mailing list archive at Nabble.com.

[R] Question about R mantissa and number of bits

2011-11-08 Thread Lafaye de Micheaux
Dear all, I think that every number x in R can be represented in floating point arithmetic as: x = (-1)^s (1+f) 2^(e-1023) where s is coded on 1 bit, e (positive integer) is coded on 11 bits, and f (real in [0,1)) is coded on 52 bits. Am I right? We have f=\sum_{i=1}^{52} k_i 2^{-i} for some

[R] nesting scale_manual caracteristics in ggplot

2011-11-08 Thread Sigrid
Hi there, I am having a little problem with combining three scale_manual commands in a facet plot. I am not able to combine the three different characteristics, instead ending up with three different descriptions next to the graph for the same geom. I would like to see two separate labels (not th

Re: [R] why NA coefficients

2011-11-08 Thread William Dunlap
It might make the discussion easier to follow if you used a smaller dataset that anyone can make and did some experiments with contrasts. E.g., > D <- data.frame(expand.grid(X1=LETTERS[1:3], X2=letters[24:26])[-1,], > Y=2^(1:8)) > D X1 X2 Y 2 B x 2 3 C x 4 4 A y 8 5 B y 16 6 C

Re: [R] how to use quadrature to integrate some complicated functions

2011-11-08 Thread R. Michael Weylandt
It's polite to include the whole list in your replies so the threads get archived properly. Yes, underflow is occasionally a problem: hence the common use of log-likelihood in MLE and other applications. Might that help you out here? You can get log-likelihoods directly from pnorm and dnorm with t

Re: [R] ggplot2 reorder factors for faceting

2011-11-08 Thread Dennis Murphy
Hi: (1) Here is one way to reorganize the levels of a factor: plotData[['infection']] <- factor(plotData[['infection']], levels = c('InfA', 'InfC', 'InfB', 'InfD')) Do this ahead of the call to ggplot(), preferably after plotData is defined. relevel() resets the ba

Re: [R] why NA coefficients

2011-11-08 Thread array chip
Hi Dennis, Thanks very much for the details. All those explanations about non-estimable mu_{12} when it has no data make sense to me!  Regarding my specific example data where mu_{12} should NOT be estimable in a linear model with interaction because it has no data, yet the linear model I creat

Re: [R] geoR, variofit/likfit

2011-11-08 Thread David Winsemius
On Nov 8, 2011, at 1:20 PM, katiab81 wrote: up down ... for a variety of reasons. And... PLEASE do read the posting guide http://www.R-project.org/posting-guide.html It's very possible that you are not communicating with the package authors by posting to rhelp (by way of Nabble) , an

Re: [R] passing dataframe col name through cbind()

2011-11-08 Thread jim holtman
Try this: > cbind(scores[,1,drop = FALSE], scores[,2:3]) name round1 round2 1 Bob 40 5 2 Ron 30 6 3 Bud 20 4 > Then do ?'[' to learn about 'drop' On Tue, Nov 8, 2011 at 1:06 PM, Eric Rupley wrote: > > > > Hi all --- > > I note that the column name of the first co

Re: [R] geoR, variofit/likfit

2011-11-08 Thread katiab81
up -- View this message in context: http://r.789695.n4.nabble.com/geoR-variofit-likfit-tp4013734p4016970.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLE

[R] rpanel package - retrieve data from panel

2011-11-08 Thread michalseneca
Dear Co-Forumeees Does anybody have experience with using rpanel..or how to retrieve data from created panel. For example my panel draws some interactive graph and computes something inside the panel. Question : is there a way to retrieve those data ? For illustration: if (interactive()) {

Re: [R] why NA coefficients

2011-11-08 Thread Dennis Murphy
The cell mean mu_{12} is non-estimable because it has no data in the cell. How can you estimate something that's not there (at least without imputation :)? Every parametric function that involves mu_{12} will also be non-estimable - in particular, the interaction term and the population marginal m

Re: [R] why NA coefficients

2011-11-08 Thread David Winsemius
On Nov 8, 2011, at 12:36 PM, array chip wrote: Sure it does, but still struggling with what is going on... Have you considered redefining the implicit base level for "treat" so it does not create the missing crossed-category? > test$treat2_ <- factor(test$treat, levels=c(2:7, 1) ) > lm(y~

[R] passing dataframe col name through cbind()

2011-11-08 Thread Eric Rupley
Hi all --- I note that the column name of the first column in a dataframe does not necessarily get passed on when using cbind (example below)… I'm looking for help in clarifying why this behavior occurs, and how I can get all col names, including the first, passed on to the result…while I su

Re: [R] multi-line query

2011-11-08 Thread Ben quant
Because I don't know anything about sqldf. :) Here is what happens, but I"m sure it is happening because I didn't read the manual yet: > s <- sqldf('create table r.dat("id" int primary key,"val" int)') Error in ls(envir = envir, all.names = private) : invalid 'envir' argument Error in !dbPreExi

Re: [R] Sampling with conditions

2011-11-08 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of SarahJoyes > Sent: Tuesday, November 08, 2011 5:57 AM > To: r-help@r-project.org > Subject: Re: [R] Sampling with conditions > > That is exactly what I want, and it's so simple!

Re: [R] multi-line query

2011-11-08 Thread jim holtman
Why not just send it in as is. I use SQLite (via sqldf) and here is the way I write my SQL statements: inRange <- sqldf(' select t.* , r.start , r.end from total t, commRange r where t.comm = r.comm and t.loc betw

Re: [R] why NA coefficients

2011-11-08 Thread array chip
true, why it has to omit "treat 7-group 2" Thanks again From: David Winsemius Cc: "r-help@r-project.org" Sent: Monday, November 7, 2011 10:19 PM Subject: Re: [R] why NA coefficients On Nov 7, 2011, at 10:07 PM, array chip wrote: > Thanks David. The only

Re: [R] why NA coefficients

2011-11-08 Thread array chip
Sure it does, but still struggling with what is going on... Thanks John From:David Winsemius To:David Winsemius oject.org> Sent:Monday, November 7, 2011 10:27 PM Subject:Re: [R] why NA coefficients But this output suggests there may be alligators in the swam

Re: [R] lapply to list of variables

2011-11-08 Thread Uwe Ligges
On 08.11.2011 17:59, Ana wrote: Hi Can someone help me with this? How can I apply a function to a list of variables. something like this listvar=list("Monday","Tuesday","Wednesday") This is a list of length one character vectors rather than a "list of variables". func=function(x){x

[R] dbWriteTable with field data type

2011-11-08 Thread Ben quant
Hello, When I do: dbWriteTable(con, "r.BOD", cbind(row_names = rownames(BOD), BOD)) ...can I specify the data types such as varchar(12), float, double precision, etc. for each of the fields/columns? If not, what is the best way to create a table with specified field data types (with the RpgSQL

Re: [R] Question

2011-11-08 Thread David Winsemius
I suspect you are lost. This is almost certainly more appropriate on the BioConductor list. There are relatively few people on this list who will know what (un-named) packages you might be using. Read the Posting Guide, note the link to the Bioconductor mailing list page, configure your

Re: [R] rearrange set of items randomly

2011-11-08 Thread David Winsemius
On Nov 8, 2011, at 11:31 AM, flokke wrote: Thanks for the replies! Indeed, I could use order() instead of sample() but that it wouldnt be random anymore, as it sorts data points in increasing(!) order. Second, I have to use 1000 different samples. Please re-read the help page for `orde

[R] GAM

2011-11-08 Thread Gyanendra Pokharel
Hi R community! I am analyzing the data set "motorins" in the package "faraway" by using the generalized additive model. it shows the following error. Can some one suggest me the right way? library(faraway) data(motorins) motori <- motorins[motorins$Zone==1,] library(mgcv) >amgam <- gam(log(Paymen

[R] determine length of bivariate polynomial

2011-11-08 Thread Nicolas Schuck
Dear R-community, I have a fitted bivariate polynomial, i.e: fit = lm(cbind(x, y)~poly(t, 15)) and I would like to determine the length of the line in the interval t = [a, b]. Obviously, I could use predict and go through all the points, i.e. for (t in a:(b-1)) { length = length + sqrt((x.pred[

[R] lapply to list of variables

2011-11-08 Thread Ana
Hi Can someone help me with this? How can I apply a function to a list of variables. something like this listvar=list("Monday","Tuesday","Wednesday") func=function(x){x[which(x<=10)]=NA} lapply(listvar, func) were Monday=[213,56,345,33,34,678,444] Tuesday=[213,56,345,33,34,678,444] ... in m

[R] Question

2011-11-08 Thread Parida, Mrutyunjaya
Hi My name is Rocky and I am trying to use the org.Dm.eg.db library. When I am using the org.Dm.egFLYBASE2EG[fb_ids] it is stopping at a point where it cannot find any value for a given ID such as the following: Error in .checkKeys(value, Rkeys(x), x@ifnotfound) : value for "FBgn0004461" not fou

[R] Help with SEM package: Error message

2011-11-08 Thread lisamp85
Hello. I started using the sem package in R and after a lot of searching and trying things I am still having difficulty. I get the following error message when I use the sem() function: Warning message: In sem.default(ram = ram, S = S, N = N, param.names = pars, var.names = vars, : Could no

Re: [R] Sampling with conditions

2011-11-08 Thread SarahJoyes
That is exactly what I want, and it's so simple! Thanks so much! -- View this message in context: http://r.789695.n4.nabble.com/Sampling-with-conditions-tp4014036p4016050.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-projec

[R] Error message after updating pkg spatstat

2011-11-08 Thread Robin W Hunnewell
Hello, I recently downloaded an updated version of the {spatstat} package 1.24-1. But now, when I do  >help() to look up a certain function in the spatstat library, I get an error message. It only seems to be for spatstat fns. The following error: Error in fetch(key) : internal error -3 in R_d

Re: [R] Sampling with conditions

2011-11-08 Thread SarahJoyes
Sorry about being confusing, I have so many loops in loops and ifelses that I get mixed up sometimes, it was just a typo, it was supposed to be "for(i in 1:5)" Sorry, Thanks for you help! SJ -- View this message in context: http://r.789695.n4.nabble.com/Sampling-with-conditions-tp4014036p40

Re: [R] rearrange set of items randomly

2011-11-08 Thread flokke
Thanks for the replies! Indeed, I could use order() instead of sample() but that it wouldnt be random anymore, as it sorts data points in increasing(!) order. Second, I have to use 1000 different samples. I got the hint that I have to do somethin with indeces, but still cant figure out what thi

[R] multi-line query

2011-11-08 Thread Ben quant
Hello, I'm using package RpgSQL. Is there a better way to create a multi-line query/character string? I'm looking for less to type and readability. This is not very readable for large queries: s <- 'create table r.BOD("id" int primary key,"name" varchar(12))' I write a lot of code, so I'm looki

Re: [R] similar package in R like "SKEW CALCULATOR"?

2011-11-08 Thread Knut Krueger
Am 08.11.2011 13:01, schrieb R. Michael Weylandt: See the replies given to you two days ago when you asked the same Hi Michael, thank you for your second answer. I did not get my first question and I did not get your answer via mail - strange Knut _

Re: [R] how to use quadrature to integrate some complicated functions

2011-11-08 Thread David Winsemius
On Nov 8, 2011, at 9:43 AM, R. Michael Weylandt wrote: Have you tried wrapping it in a function and using integrate()? R is pretty good at handling numerical integration. If integrate() isn't good for you, can you say more as to why? Michael On Nov 6, 2011, at 4:15 PM, JeffND wrote: H

Re: [R] Rename a directory in R

2011-11-08 Thread Gavin Blackburn
Thanks Jim, I didn't think it worked on directories but I've got it working now. Cheers, Gavin. -Original Message- From: jim holtman [mailto:jholt...@gmail.com] Sent: 08 November 2011 14:18 To: Gavin Blackburn Cc: r-help@r-project.org Subject: Re: [R] Rename a directory in R apropos('

Re: [R] Rekeying value denoting NA

2011-11-08 Thread David Winsemius
On Nov 8, 2011, at 8:57 AM, Jean V Adams wrote: SML wrote on 11/07/2011 09:10:30 PM: I'm trying to rekey values which denote there is no values, i.e., '-999' in a dataset which contains both '-999' and NA entries. When I try the following command I get the following error: data.frame[data.f

Re: [R] RpgSQL row names

2011-11-08 Thread Ben quant
This is great, thanks! I have another unrelated question. I'll create a new email for that one. ben On Mon, Nov 7, 2011 at 4:16 PM, Gabor Grothendieck wrote: > On Mon, Nov 7, 2011 at 5:34 PM, Ben quant wrote: > > Hello, > > > > Using the RpgSQL package, there must be a way to get the row names

Re: [R] window?

2011-11-08 Thread Uwe Ligges
On 08.11.2011 16:26, Kevin Burton wrote: Can someone enlighten me on why the following doesn't work? setwd('C:/Temp/R') d<- rep(1:53,2) (s<- ts(d, frequency=53, start=c(2000,10))) n<- length(s) k<- n%/%3 for(i in (n-k):n) { st<- c(start(s)[1] + (start(s)[2] + i)%/%frequency

[R] window?

2011-11-08 Thread Kevin Burton
Can someone enlighten me on why the following doesn't work? setwd('C:/Temp/R') d <- rep(1:53,2) (s <- ts(d, frequency=53, start=c(2000,10))) n <- length(s) k <- n%/%3 for(i in (n-k):n) { st <- c(start(s)[1] + (start(s)[2] + i)%/%frequency(s), (start(s)[2] + i) %% frequency(s

Re: [R] save at relative directory

2011-11-08 Thread Joshua Wiley
Hi Alex, For the R part, I would abstract it a bit: mydir <- paste("./", abs(threshold), sep = "") if (!file.exists(mydir)) dir.create(mydir) save(var, file = paste(mydir, DataSource[[4]], sep = "/")) if you use file.exists('threshold') you are testing for the existence of threshold, not the val

Re: [R] save at relative directory

2011-11-08 Thread Uwe Ligges
On 08.11.2011 16:09, Alaios wrote: Hmm I will try something like that if (file.exists('threshold')==FALSE) dir.create(paste('./',abs(threshold))) save(var,file=paste('./',abs(threshold),'/',DataSource[[4]],sep="") I just need a bit of confirmation If I am doing soemthing ter

Re: [R] save at relative directory

2011-11-08 Thread Alaios
Hmm I will try something like that     if (file.exists('threshold')==FALSE)       dir.create(paste('./',abs(threshold)))     save(var,file=paste('./',abs(threshold),'/',DataSource[[4]],sep="") I just need a bit of confirmation If I am doing soemthing terribly wrong that might harm my filesystem

Re: [R] Building package problem

2011-11-08 Thread Prof Brian Ripley
R CMD check is *not* 'building a package'. Nor is making a Windows binary package. 'Building a package' is creating a source tarball from a source directory. On Tue, 8 Nov 2011, Joshua Wiley wrote: Hi Ed, If the only error is in examples then this should work: R CMD check --no-examples fo

Re: [R] compare linear regressions

2011-11-08 Thread Jeff Newmiller
Just because your model specification is valid does not mean your data can be analyzed using that particular model specification. --- Jeff NewmillerThe . . Go Live... DCN:Basi

Re: [R] Building package problem

2011-11-08 Thread Uwe Ligges
On 08.11.2011 13:50, Joshua Wiley wrote: Hi Ed, If the only error is in examples then this should work: R CMD check --no-examples foopkg Disabling the example checks is not the solution - well, it is the one to hide the errors, of course. should not have anything to do with vignettes

Re: [R] compare linear regressions

2011-11-08 Thread Holger Taschenberger
Thank you. I was confused because the output of the line "summary(lm(formula =..." reads: "Coefficients: (1 not defined because of singularities)", which did not look like a normal message (which can safely be ignored) to me. --Holger On Tue, 8 Nov 2011 15:06:28 +0100 Peter Konings wrote: > O

Re: [R] how to use quadrature to integrate some complicated functions

2011-11-08 Thread R. Michael Weylandt
Have you tried wrapping it in a function and using integrate()? R is pretty good at handling numerical integration. If integrate() isn't good for you, can you say more as to why? Michael On Nov 6, 2011, at 4:15 PM, JeffND wrote: > Hello to all, > > I am having trouble with intregrating a co

Re: [R] from points in Lon/Lat to physical distance in dist class

2011-11-08 Thread David L Carlson
Look at distm() in package geosphere. -- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Beha

Re: [R] Rename a directory in R

2011-11-08 Thread jim holtman
apropos('rename') you will find 'file.rename' which also works on directories. On Tue, Nov 8, 2011 at 7:45 AM, Gavin Blackburn wrote: > Hi, > > I want to be able to rename a folder using R, similar to file.rename. I want > to paste " - done" onto the folder name. The reason for this is we run a

Re: [R] Rekeying value denoting NA

2011-11-08 Thread Jean V Adams
SML wrote on 11/07/2011 09:10:30 PM: > > I'm trying to rekey values which denote there is no values, i.e., > '-999' in a dataset which contains both '-999' and NA entries. > When I try the following command I get the following error: > > > data.frame[data.frame$MAR <= -9,"MAR"] <- NA > > "mi

[R] from points in Lon/Lat to physical distance in dist class

2011-11-08 Thread Mao Jianfeng
Dear R-listers, Here, I would like to hearing helps from you. I have GPS data (multiple points in the geographic scale) in longitude/latitude. I intend to calculate distance (in kilometer) among such points and output the distance matrix in dist class. I have gotten some progress, but I still ca

Re: [R] Simple coordinate transformations

2011-11-08 Thread Duncan Murdoch
On 11-11-08 7:24 AM, Matthew Young wrote: Hi, I need to do some simple coordinate transforms between cartesian, cylindrical and spherical coordinates. I can't find any built in functions or packages to do this, is this because they do not exist? Obviously I can write my own code, but don't want

Re: [R] compare linear regressions

2011-11-08 Thread R. Michael Weylandt
Yes, adding "-1" or "+0" both return a lm without an intercept term. Michael On Tue, Nov 8, 2011 at 8:52 AM, Holger Taschenberger wrote: > Hi, > >        I'm trying to compare two linear regressions. I'm using the > following approach: > ## > xx<-1:100 > df1 <- data.frame(x = xx,

[R] Rename a directory in R

2011-11-08 Thread Gavin Blackburn
Hi, I want to be able to rename a folder using R, similar to file.rename. I want to paste " - done" onto the folder name. The reason for this is we run a loop on a large number of folders on a server and it would be nice for people to be able to log in and instantly see if their data has been p

Re: [R] How much time a process need?

2011-11-08 Thread jim holtman
The 'user' + 'system' will give you how much CPU is required which is an indication of how many of the CPU cycles you are using. The elapsed time is just how long it spent. If the script is CPU intensive, and there is no paging going on, you should see the CPU time close to the elapsed time. Lon

[R] match first consecutive list of capitalized words in string

2011-11-08 Thread Richter-Dumke, Jonas
Dear R-Helpers, this is my first post ever to a mailing list, so please feel free to point out any missunderstandings on my side regarding the conventions of this mailing list. My problem: Assuming the following character vector is given: names <- c("filia Maria", "vidua Joh Dirck Kleve (oo 0

[R] compare linear regressions

2011-11-08 Thread Holger Taschenberger
Hi, I'm trying to compare two linear regressions. I'm using the following approach: ## xx<-1:100 df1 <- data.frame(x = xx, y = xx * 2 + 30 + rnorm(n=length(xx),sd=10), g = 1) df2 <- data.frame(x = xx, y = xx * 4 + 9 + rnorm(n=length(xx),sd=10), g = 2) dta <- rbind(df1, df2

Re: [R] save at relative directory

2011-11-08 Thread Joshua Wiley
Hi Alex, Look at some of these functions: apropos("dir") apropos("exists") Cheers, Josh On Tue, Nov 8, 2011 at 5:36 AM, Alaios wrote: > Dear all, > I have a variable called thres and before I run a script I set it to a value > like > thres<- -10 > at the end of the execution I am issuing a s

[R] save at relative directory

2011-11-08 Thread Alaios
Dear all, I have a variable called thres and before I run a script I set it to a value like thres<- -10 at the end of the execution I am issuing a save(variablename,file='Results') which will end up with a file saved at the current directory with the name Results   I would like though to use thres

Re: [R] How much time a process need?

2011-11-08 Thread Alaios
Actually I want to have a rough approximation. A process that takes one day and a half it is good to send me how many hours it gets. It is not a problem to convert the values of system.error the major is that I am not sure If I should use the user or elapsed time for getting an estimation of how

Re: [R] Aggregate or extract function ?

2011-11-08 Thread Jean V Adams
Celine wrote on 11/08/2011 02:28:32 AM: > > Thanks for your help, I still have a little problem with this function > because I don't have the same number of line in my two datarame so when I > try to apply the dataframe function, I obtain this response ; that I have a > different number of lines

[R] Export interactive linked graphs?

2011-11-08 Thread Rainer M Krug
Hi I am falling in love with iplots, especially the linked graphs, i.e. selecting points in one will highlight the same points in the other graph as well. But I would like to be able to "export" the graphs, so that I can give them to somebody else to be able to look at the graphs and explore the d

Re: [R] ggplot2 reorder factors for faceting

2011-11-08 Thread ONKELINX, Thierry
Dear Iain, RSiteSearch("ggplot2 reorder", restrict = c("Rhelp10", "Rhelp08")) gives you the solution. Best regards, Thierry > -Oorspronkelijk bericht- > Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > Namens Iain Gallagher > Verzonden: dinsdag 8 november 2011 1

Re: [R] ggplot2 reorder factors for faceting

2011-11-08 Thread Kenneth Frost
Hi, Iain- You might want to have a look at ?relevel i.e.  plotData$infection<-relevel(plotData$infection, ref = 'InfC') Ken On 11/08/11, Iain Gallagher wrote: > > > Dear List > > I am trying to draw a heatmap using ggplot2. In this heatmap I have faceted > my data by 'infection' o

  1   2   >