Re: [R] confirmatory factor analysis in R

2011-03-11 Thread Ingmar Visser
lavaan, sem, openMx all do this (there may be others) hth, Ingmar On Fri, Mar 11, 2011 at 8:26 AM, rvohen bingbingzhan...@126.com wrote: In R software,does it have packages about confirmatory factor analysis in R software? 3Q -- View this message in context:

[R] 'autocompletion' of named elements of a list

2011-03-11 Thread Håvard Rue
I had an obscure bug that boiled down to this ``feature'' in R, Read 3921 items A = list(aa = 1) A $aa [1] 1 if (A$a) print(a is there) [1] a is there The test appear to check is A$a is TRUE, but what happen is that it auto-complete (silently), and expand to 'A$aa'. The problem was caused

Re: [R] still a problem remainingRE: Data lebals xylattice plot: RE: displaying label meeting condition (i.e. significant, i..e p value less than 005) in plot function

2011-03-11 Thread Felix Andrews
Yes, it is intersect rather than intersection, sorry. And in panel.text() the x and y were switched, so just reverse the first two arguments. Thats what comes from posting from an iGizmo with no R to test my code. 2011/3/11 Umesh Rosyara rosyar...@gmail.com: Thank you so much for the advice.

Re: [R] 'autocompletion' of named elements of a list

2011-03-11 Thread Ivan Calandra
Hi, From ?$, you can see that using [[ instead would do what you're looking for. You should read and try to understand the whole help file. The reason is that for [[ the default is exact=TRUE, wheareas for $ the only possible value is exact=FALSE, which means partial matching if possible.

[R] How to calculate means for multiple variables in samples with different sizes

2011-03-11 Thread Aline Santos
Hello R-helpers: I have data like this: samplereplicateheightweightage A1.0012.00.646.00 A2.0012.20.386.00 A3.0012.40.496.00 B1.0012.70.654.00 B2.0012.80.785.00 C1.0011.90.456.00 C

Re: [R] Moving window per group

2011-03-11 Thread mathijsdevaan
Thanks Gabor, that worked great! Gabor Grothendieck wrote: On Thu, Mar 10, 2011 at 11:27 AM, mathijsdevaan lt;mathijsdev...@gmail.comgt; wrote: Hi, I have a data.frame of the following type: F = data.frame(read.table(textConnection(    A  B 1 1  4 2 1  3 3 1  1 4 1  4 5 1  2 6 1  

Re: [R] 'autocompletion' of named elements of a list

2011-03-11 Thread peter dalgaard
On Mar 11, 2011, at 09:55 , Håvard Rue wrote: since NULL elements are removed from the list, and that A$a auto-expand to A$aa, my error appeared. To me, this seems not a feature I want in order to have a robust program. Partial matching of arguments and list item names is a

Re: [R] How to calculate means for multiple variables in samples with different sizes

2011-03-11 Thread jim holtman
use the package 'data.table' x - read.table(textConnection(samplereplicateheightweightage + A1.0012.00.646.00 + A2.0012.20.386.00 + A3.0012.40.496.00 + B1.0012.70.654.00 + B2.0012.80.785.00 + C

[R] How to get all combinations between two character vectors?

2011-03-11 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi I know there is a function - I have used it before - but I always forget what it is called... I need the combination of two character vectors, i.e: x - c(a, b) y - c(x, y) z - THEFUNCTION(x, y) z == c(ax, ay, bx, by) I promise I will write

[R] Ifs in formula

2011-03-11 Thread Otto Kässi
Dear r-helpers, This might be an elementary question, but I have a hard time getting my head around it, so all help is much appreciated. I am working on a nonlinear regression model of the form if z 0 y = f1(x,y), else y = f2(x,t) . In other words, the functional form of f(.) changes

Re: [R] plot question, increasing Y-axis labels

2011-03-11 Thread Jim Lemon
On 03/11/2011 05:08 AM, Mike Gibson wrote: I want to increase the number of labels on my y-axis. Here is my code: plot(fish$species, fish$fl, ylim=c(5,25), xlab=Species, ylab=Fork Length (in)) The plot is great but it only has numerical y-labes every five values (i.e. labels at 5, 10,

Re: [R] How to calculate means for multiple variables in samples with different sizes

2011-03-11 Thread Berend Hasselman
Aline Santos wrote: Hello R-helpers: I have data like this: samplereplicateheightweightage A1.0012.00.646.00 A2.0012.20.386.00 A3.0012.40.496.00 B1.0012.70.654.00 B2.0012.80.785.00 C

Re: [R] How to calculate means for multiple variables in samples with different sizes

2011-03-11 Thread Dennis Murphy
Hi: Here are a few one-liners. Calling your data frame dd, aggregate(cbind(height, weight, age) ~ sample, data = dd, FUN = mean) sample heightweight age 1 A 12.2 0.503 6.00 2 B 12.75000 0.715 4.50 3 C 11.35250 0.5125000 3.75 4 D 14.99333

Re: [R] How to get all combinations between two character vectors?

2011-03-11 Thread Dennis Murphy
Hi: This is probably not quite what you had in mind, but both work for your example - I think the second is probably easier. x - c(a, b) y - c(x, y) as.vector(outer(x, y, function(x, y) paste(x, y, sep = ''))) [1] ax bx ay by apply(expand.grid(x, y), 1, paste, collapse = '') [1] ax bx ay by

Re: [R] How to get all combinations between two character vectors?

2011-03-11 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 03/11/2011 12:22 PM, Dennis Murphy wrote: Hi: This is probably not quite what you had in mind, No - the second one is the one I used before. Thanks, Rainer but both work for your example - I think the second is probably easier. x -

[R] LATEX-like formula and pictures in Rd-Helpfiles

2011-03-11 Thread Etienne Stockhausen
__ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

[R] predicting values from model function

2011-03-11 Thread Anna Gretschel
Dear List, I have fitted a spherical function to my variogram using variofit(...) from GeoR. Now I would like to predict some data with the function predict(object,...) from package stats. Does anyone know wether this works and if it does how to do it? Thanks a lot! Anna

Re: [R] How to get all combinations between two character vectors?

2011-03-11 Thread Eik Vettorazzi
Hi Rainer, I don't know a function for literally substituting THEFUNCTION, but x - c(a, b) y - c(x, y) sort(levels(interaction(x,y,sep=))) or as.vector(t(outer(x,y,paste,sep=))) will work. sort and t respectively here are used to produce the desired order. hth. Am 11.03.2011 11:53, schrieb

Re: [R] How to get all combinations between two character vectors?

2011-03-11 Thread Eik Vettorazzi
or even simpler paste(rep(x,each=length(y)),y,sep=) Am 11.03.2011 12:44, schrieb Eik Vettorazzi: Hi Rainer, I don't know a function for literally substituting THEFUNCTION, but x - c(a, b) y - c(x, y) sort(levels(interaction(x,y,sep=))) or as.vector(t(outer(x,y,paste,sep=))) will

Re: [R] Timezone issue with strftime/strptime and %z and %Z

2011-03-11 Thread David Winsemius
On Mar 10, 2011, at 8:46 PM, David Winsemius wrote: On Mar 10, 2011, at 11:17 AM, Daniel Nüst wrote: Hello! I've been trying to get this right for quite a while now and fear there is an easy solution I just don't see. I did not have this problem in Linux, and I searched r-help and Google

Re: [R] How to get all combinations between two character vectors?

2011-03-11 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 03/11/2011 12:48 PM, Eik Vettorazzi wrote: or even simpler paste(rep(x,each=length(y)),y,sep=) I like that one - it makes perfect sense. I might wrap it into a function and use it. Am 11.03.2011 12:44, schrieb Eik Vettorazzi: Hi Rainer,

Re: [R] Ifs in formula

2011-03-11 Thread Dennis Murphy
Hi: Perhaps something like f1(x, y) * I(z 0) + f2(x, y) * I(z = 0) ?? HTH, Dennis On Fri, Mar 11, 2011 at 3:10 AM, Otto Kässi otto.ka...@gmail.com wrote: Dear r-helpers, This might be an elementary question, but I have a hard time getting my head around it, so all help is much

Re: [R] tobit regression model

2011-03-11 Thread Jen
H Zeileis, This helped out a lot - thanks!! Jen -- View this message in context: http://r.789695.n4.nabble.com/tobit-regression-model-tp3345789p3347936.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] Selecting ranges of dates from a dataframe

2011-03-11 Thread David Winsemius
On Mar 10, 2011, at 8:23 AM, Benjamin Stier wrote: Hello list! I have a data.frame which looks like this: serv datum op.read op.write read write 1 2011-01-29 10:00:00 00 0 0 2 2011-01-29 10:00:01 00 0 0 3 2011-01-29 10:00:02

Re: [R] still a problem remainingRE: Data lebals xylattice plot: RE: displaying label meeting condition (i.e. significant, i..e p value less than 005) in plot function

2011-03-11 Thread Umesh Rosyara
Thank you for helping me and this solved the problem Best Regards Umesh R _ From: foolish.andr...@gmail.com [mailto:foolish.andr...@gmail.com] On Behalf Of Felix Andrews Sent: Friday, March 11, 2011 4:05 AM To: Umesh Rosyara Cc: R mailing list;

[R] insertion of a row between individuals

2011-03-11 Thread kyle . landskroner
Can someone help with a fairly simple task? I have a data set where I would like to insert a 0 time event between individuals: what I have: VAR DATETIME CONC COVAR 1 NOV20.2510 group1 1 NOV20.5 20 group1 1 NOV21 5 group1 1

Re: [R] snp-chip table

2011-03-11 Thread David Winsemius
On Mar 10, 2011, at 3:58 PM, shai uliel wrote: Dear R helpers I have a table and i need to make new table table1: sire snp1 snp2 snp3 snp4 snp5 snp6 snp7 snp8 snp9 snp10 snp11 snp12 snp13 snp14 snp15 8877 -1 -1 -1 -1 0 0 -1 -1 -1 0 1 1 1 -1 -1 7765 1 1 1 0 0 0 -1 1 1 1 0 0

Re: [R] insertion of a row between individuals

2011-03-11 Thread Henrique Dallazuanna
Try this: newX - rbind(unique(transform(x, TIME = 0, CONC = 0)), x) newX[order(newX$VAR),] On Fri, Mar 11, 2011 at 9:28 AM, kyle.landskro...@actelion.com wrote: Can someone help with a fairly simple task? I have a data set where I would like to insert a 0 time event between individuals:

Re: [R] insertion of a row between individuals

2011-03-11 Thread Dennis Murphy
Hi: df - read.table(textConnection( VAR DATETIME CONC COVAR 1 NOV20.2510 group1 1 NOV20.5 20 group1 1 NOV21 5 group1 1 NOV22 1 group1 1 NOV23 0.1 group1 2 NOV20.2510

Re: [R] How to calculate means for multiple variables in samples with different sizes

2011-03-11 Thread Matthew Dowle
Hi, One liners in data.table are : x.dt[,lapply(.SD,mean),by=sample] sample replicate heightweight age [1,] A 2.0 12.2 0.503 6.00 [2,] B 1.5 12.75000 0.715 4.50 [3,] C 2.5 11.35250 0.5125000 3.75 [4,] D 2.0

[R] Using dates on axis in persp

2011-03-11 Thread Owe Jessen
Hi, I'm trying to plot the dates on the x-axis of a persp plot, but cannot find a way of doing so. This is where I am at: |x- seq(-10, 10, length= 30) x0- as.Date(2000-01-01) x.dates- seq(x0,x0+length(x)-1,1) y- x f- function(x,y) { r- sqrt(x^2+y^2); 10 * sin(r)/r} z- outer(x, y,

Re: [R] How to calculate means for multiple variables in samples with different sizes

2011-03-11 Thread Henrique Dallazuanna
Try this: aggregate(. ~ sample, x[-2], FUN = mean) On Fri, Mar 11, 2011 at 6:32 AM, Aline Santos aline...@gmail.com wrote: Hello R-helpers: I have data like this: samplereplicateheightweightage A1.0012.00.646.00 A2.0012.20.386.00 A3.00

Re: [R] No response after click the show Rules button on Tab Associate.

2011-03-11 Thread Xiaobo Gu
On Fri, Mar 11, 2011 at 2:55 AM, Graham Williams graham.willi...@togaware.com wrote: Did you scroll down the window to see the rules? OK, it takes a long time for rattle to show the rules, about 30 seconds, and why the message on the status bar is the decision tree model has been built. Time

[R] dataframe to a timeseries object

2011-03-11 Thread Daniele Amberti
I’m wondering which is the most efficient (time, than memory usage) way to obtain a multivariate time series object from a data frame (the easiest data structure to get data from a database trough RODBC). I have a starting point using timeSeries or xts library (these libraries can handle time

Re: [R] Selecting ranges of dates from a dataframe

2011-03-11 Thread Benjamin Stier
Hi Francisco, Thanks for your solution. It runs pretty fast compared to my for loop. Here is a comparison of system.time(): system.time(splitVals - by(serv, dates, aggregateDf )) user system elapsed 1.129 0.218 1.348 system.time(... my long for loop...) user system elapsed

[R] robust estimation

2011-03-11 Thread Wilhelm Caspary
Hi, I have been looking through all packages but I cannot find a routine for LAD-regression (L1-norm-regression). Is there none? Willi __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] Timezone issue with strftime/strptime and %z and %Z

2011-03-11 Thread Daniel Nüst
2011/3/11 David Winsemius dwinsem...@comcast.net: On Mar 10, 2011, at 8:46 PM, David Winsemius wrote: On Mar 10, 2011, at 11:17 AM, Daniel Nüst wrote: I try to parse a time stamp with time zone. I essentially just want to parse the time stamp 1995-05-25T15:30:00+10:00 and output it exactly

Re: [R] Selecting ranges of dates from a dataframe

2011-03-11 Thread David Winsemius
On Mar 11, 2011, at 8:41 AM, Benjamin Stier wrote: Hi Francisco, Thanks for your solution. It runs pretty fast compared to my for loop. Here is a comparison of system.time(): system.time(splitVals - by(serv, dates, aggregateDf )) user system elapsed 1.129 0.218 1.348

Re: [R] robust estimation

2011-03-11 Thread Bryan Hanson
Willi, try this: install.packages(sos) library(sos) findFn(L1 norm regression) I find 34 hits but you'd have to look them over to see if any of them are the sort of thing you want. HTH, Bryan Prof. Bryan Hanson Dept of Chemistry Biochemistry DePauw University 602 S.

Re: [R] Timezone issue with strftime/strptime and %z and %Z

2011-03-11 Thread David Winsemius
On Mar 11, 2011, at 8:54 AM, Daniel Nüst wrote: 2011/3/11 David Winsemius dwinsem...@comcast.net: On Mar 10, 2011, at 8:46 PM, David Winsemius wrote: On Mar 10, 2011, at 11:17 AM, Daniel Nüst wrote: I try to parse a time stamp with time zone. I essentially just want to parse the time stamp

Re: [R] .Library in R 2.12.2 for windows

2011-03-11 Thread Oxxx
Thanks so much for the help! Sorry about not finding that info in the help. I must have overlooked it. My apologies. -- View this message in context: http://r.789695.n4.nabble.com/Library-in-R-2-12-2-for-windows-tp3347351p3348218.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] robust estimation

2011-03-11 Thread David Winsemius
On Mar 11, 2011, at 7:31 AM, Wilhelm Caspary wrote: Hi, I have been looking through all packages but I cannot find a routine for LAD-regression (L1-norm-regression). Is there none? (In addition to the pkg::sos search results the help archives can also be reviewed.)

Re: [R] Timezone issue with strftime/strptime and %z and %Z

2011-03-11 Thread Daniel Nüst
Update: I ran the following commands on a Linux machine: sessionInfo() R version 2.12.1 (2010-12-16) Platform: x86_64-pc-linux-gnu (64-bit) locale: [1] LC_CTYPE=de_DE.utf8 LC_NUMERIC=C [3] LC_TIME=de_DE.utf8 LC_COLLATE=de_DE.utf8 [5] LC_MONETARY=de_DE.utf8

Re: [R] Timezone issue with strftime/strptime and %z and %Z

2011-03-11 Thread Daniel Nüst
2011/3/11 David Winsemius dwinsem...@comcast.net: On Mar 11, 2011, at 8:54 AM, Daniel Nüst wrote: Let me rephrase my question: How can I create a time object from the character string 1995-05-25T15:30:00-10:00 and get exactly the same character string again when formatting it/printing it? x

Re: [R] How to get all combinations between two character vectors?

2011-03-11 Thread David L Lorenz
Rainer, The are probably lots of ways, I'd use levels(interaction(c(a, b), c('x', 'y'), sep='')) Dave Hi I know there is a function - I have used it before - but I always forget what it is called... I need the combination of two character vectors, i.e: x - c(a, b) y - c(x, y) z -

Re: [R] Timezone issue with strftime/strptime and %z and %Z

2011-03-11 Thread David Winsemius
On Mar 11, 2011, at 9:23 AM, Daniel Nüst wrote: 2011/3/11 David Winsemius dwinsem...@comcast.net: On Mar 11, 2011, at 8:54 AM, Daniel Nüst wrote: Let me rephrase my question: How can I create a time object from the character string 1995-05-25T15:30:00-10:00 and get exactly the same

Re: [R] robust estimation

2011-03-11 Thread S Ellison
Is the L1 norm not equivalent to quantile regression for the 0.5th quantile? If so, quantreg would do it using rq with the defult value for tau. S Ellison Wilhelm Caspary wilhelm.casp...@unibw.de 11/03/2011 12:31 Hi, I have been looking through all packages but I cannot find a routine for

Re: [R] system(..., invisible=FALSE, show.output.on.console=FALSE) in Windows 7

2011-03-11 Thread Ralph Olsson
Hi, Thanks for taking the time to respond. After further investigation I suspect the invisible=FALSE has nothing to do with the problem we're having. It may also be a different issue to the one Jim has seen. Jim describes the command window flashing up and disappearing. We saw this in R

Re: [R] system(..., invisible=FALSE, show.output.on.console=FALSE) in Windows 7

2011-03-11 Thread Gabor Grothendieck
On Wed, Mar 9, 2011 at 12:14 PM, Ralph Olsson ralphols...@btinternet.com wrote: Hello, I work for a company in which a number of employees use R. Many of them like to run executables via the system function in such a way that the output of that executable is displayed in a separate window.

Re: [R] 'autocompletion' of named elements of a list

2011-03-11 Thread Peter Ehlers
On 2011-03-11 01:07, Ivan Calandra wrote: Hi, From ?$, you can see that using [[ instead would do what you're looking for. You should read and try to understand the whole help file. The reason is that for [[ the default is exact=TRUE, wheareas for $ the only possible value is exact=FALSE,

[R] I cannot install Cairo package on R-2.12.2

2011-03-11 Thread nqueralt
Dear all, I have installed R-2.12.2 version on a Suse OS. I am trying to install the Cairo package on R but I got this error message: installing to /dades/R-2.12.2/lib64/R/library/Cairo/libs ** R ** preparing package for lazy loading ** help *** installing help indices ** building

[R] changing one character in the name of dataframes repeatedly

2011-03-11 Thread Bodnar Laszlo EB_HU
Dear R-community, I'd like to ask you a question concerning R again. I try to keep this simple because I am not willing to confuse you at all. I have a little data frame which I have created the following way: a -c(1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4,5,5,5,5,5,6,6,6,6,6) b

[R] changing one character in the name of dataframes repeatedly

2011-03-11 Thread Bodnar Laszlo EB_HU
Dear R-community, I'd like to ask you a question concerning R again. I try to keep this simple because I am not willing to confuse you at all. I have a little data frame which I have created the following way: a -c(1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4,5,5,5,5,5,6,6,6,6,6) b

[R] Generation of random numbers in a function - (Return command)

2011-03-11 Thread Vincy Pyne
Dear R helpers I have following data.frame and for each product_name, I have associated mean and standard deviation. I need to generate 1000 random no.s for each of these products and find the respective mean and standard deviation.   My R code is as follows.   library(plyr) library(reshape2)

Re: [R] Help writing a Scheffe Contrast function for R

2011-03-11 Thread peter dalgaard
On Mar 10, 2011, at 05:49 , Tyler Rinker wrote: My Question: What do I need to do to correct the three error codes R gives me and make the function run correctly? This is the session, code and R's error message when supplied with data: rm(list=ls()) dat1-read.table(dat1.csv,

Re: [R] changing one character in the name of dataframes repeatedly

2011-03-11 Thread David Winsemius
On Mar 11, 2011, at 10:49 AM, Bodnar Laszlo EB_HU wrote: Dear R-community, I'd like to ask you a question concerning R again. I try to keep this simple because I am not willing to confuse you at all. I have a little data frame which I have created the following way: a

[R] (no subject)

2011-03-11 Thread Andreas Emanuelsson
Hi, I have tried to load a file originally from Excel, via csv, text and clipboard today. When I succeed I cannot change the format from factor, and when I try to convert it to numerical it only gives the position of the factor-group, not the real value in the column? Any quick suggestions?

Re: [R] Timezone issue with strftime/strptime and %z and %Z

2011-03-11 Thread jdnew...@gmail.com
I have found the various tz arguments not to provide the support I would like in terms of arbitrary timezones. For now I use Sys.setenv(TZ=timezone_spec) prior to input or output, and do not use the tz arguments. In your case, I would consider keeping a character copy of the input to write out

[R] Fwd: How to get all combinations between two character vectors?

2011-03-11 Thread roberto . muller
Hi Rainer Or maybe you are referring to the outer function. I'm a newbie in R, but I recently read something about it in the pdf book named below (pages 91-2). I send to you an excerpt: An introduction to R An introduction to R Longhow Lam 6.2.5 The outer function outer function

Re: [R] changing one character in the name of dataframes repeatedly

2011-03-11 Thread Ivan Calandra
Hi, I think, what you want is assign(). for (i in 1:6) assign(paste(df, i, sep=.), split(df,df$a)[[i]]) But using lists is usually a better solution since you can work with them using functions such as lapply(). First, you don't need cbind() to create your data.frame: df2 - data.frame(a,b)

Re: [R] creating additional column

2011-03-11 Thread Laszlo
Thank you Philipp, it is very useful! How come I haven't figured it out myself I dont know... Have a pleasant weekend! Laszlo -- View this message in context: http://r.789695.n4.nabble.com/creating-additional-column-tp3341224p3348552.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] (no subject)

2011-03-11 Thread jim holtman
If you are using 'read.csv', add the parameteras.is=TRUE to prevent conversion to factors. If you have factors that are supposed to be numeric, use the following df$mydata - as.numeric(as.character(df$mydata)) On Fri, Mar 11, 2011 at 10:45 AM, Andreas Emanuelsson

[R] Any existing functions for reading and extracting data from path names?

2011-03-11 Thread Ista Zahn
Hi helpeRs, I have inherited a set of data files that use the file system as a sort of poor man's database, i.e., the data files are nested in directories that indicate which city they come from. For example: dir.create(deleteme) for(i in paste(deleteme, c(New York, Los Angeles), sep=/)) {

Re: [R] (no subject)

2011-03-11 Thread Joshua Wiley
Hi Andreas, Assuming you are using read.table(), try setting the argument: stringsAsFactors = FALSE Also consider what about the Excel file is making R default to a factor rather than numerical? There may be a nonstandard reprsentation of missing data (e.g., .), which could also be specified to

Re: [R] Generation of random numbers in a function - (Return command)

2011-03-11 Thread jim holtman
You can only return a single object. You might want to create a list if you have multiple objects: return(list(output_avg_mc, output_stdev_mc)) On Fri, Mar 11, 2011 at 10:51 AM, Vincy Pyne vincy_p...@yahoo.ca wrote: Dear R helpers I have following data.frame and for each product_name, I

Re: [R] (no subject)

2011-03-11 Thread Ista Zahn
Hi Andreas, if your factor is named x, you can do as.numeric(as.character(x)) Best, Ista On Fri, Mar 11, 2011 at 10:45 AM, Andreas Emanuelsson andreas.emanuels...@sik.se wrote: Hi, I have tried to load a file originally from Excel, via csv, text and clipboard today. When I succeed I cannot

Re: [R] ERROR: gamm function (mgcv package). attempt to set an attribute on NULL

2011-03-11 Thread Simon Wood
Thanks. This is a bug, the source code made an implicit assumption that there would always be at least one smooth, when creating the gam object after fitting. Fixed for the next release (1.7-5). For now, you could use glmmPQL from the MASS library to get an equivalent fit when there are no

Re: [R] Any existing functions for reading and extracting data from path names?

2011-03-11 Thread Henrik Bengtsson
Hi, the R.filesets package was designed for this. It is heavily used by the aroma framework (http://www.aroma-project.org/), so it got a fair bit of mileage now (in a good a way). Here is how you could setup your data set and work with the data. # - - - - - - - - - - - - # Setup file data set

Re: [R] Any existing functions for reading and extracting data from path names?

2011-03-11 Thread Ista Zahn
Thanks Henrik, that is exactly what I was hoping for! Best, Ista On Fri, Mar 11, 2011 at 1:02 PM, Henrik Bengtsson h...@biostat.ucsf.edu wrote: Hi, the R.filesets package was designed for this.  It is heavily used by the aroma framework (http://www.aroma-project.org/), so it got a fair bit

[R] nesting same set of values with each level of another set of values

2011-03-11 Thread Dimitri Liakhovitski
Hello! The code below works and does what I need it to do. However, I think the way I create myframe (last step) is very un-R-like and probably not very efficient. I am sure there are better, more R-appropriate methods. Any pointers? Thanks a lot! Dimitri # Step 1: Creating a vector of dates:

Re: [R] nesting same set of values with each level of another set of values

2011-03-11 Thread David Winsemius
On Mar 11, 2011, at 1:26 PM, Dimitri Liakhovitski wrote: Hello! The code below works and does what I need it to do. However, I think the way I create myframe (last step) is very un-R-like and probably not very efficient. I am sure there are better, more R-appropriate methods. Any pointers?

Re: [R] nesting same set of values with each level of another set of values

2011-03-11 Thread Dimitri Liakhovitski
Thanks a lot, David! Exactly what I was looking for! Dimitri On Fri, Mar 11, 2011 at 1:46 PM, David Winsemius dwinsem...@comcast.net wrote: On Mar 11, 2011, at 1:26 PM, Dimitri Liakhovitski wrote: Hello! The code below works and does what I need it to do. However, I think the way I create

[R] Error in plot.lm

2011-03-11 Thread Jeff Newmiller
I am encountering an error with plot.lm: tstdf - data.frame( y=c(1.01,1.98,3.02,3.99),x=c(1,2,3,4)) plot(lm(I(y) ~ x, data=tstdf)) Hit Return to see next plot: Hit Return to see next plot: Error in object$coefficients : $ operator is invalid for atomic vectors Obviously I don't need the I()

Re: [R] Lattice: Feature Request

2011-03-11 Thread Peter Ehlers
On 2011-03-10 15:07, Jim Price wrote: Hi, I'm currently designing some global themes for use with lattice, and have hit a snag. There doesn't appear to be (in xyplot at least) a way of setting a lattice option for the 'scales' parameter at a global level - changes have to be made in each

Re: [R] Error in plot.lm

2011-03-11 Thread David Winsemius
On Mar 11, 2011, at 2:06 PM, Jeff Newmiller wrote: I am encountering an error with plot.lm: tstdf - data.frame( y=c(1.01,1.98,3.02,3.99),x=c(1,2,3,4)) plot(lm(I(y) ~ x, data=tstdf)) Hit Return to see next plot: Hit Return to see next plot: Error in object$coefficients : $ operator is

Re: [R] minimum distance between line segments

2011-03-11 Thread rex.dwyer
I like Thomas's idea as a quick practical solution. Here is one more little variation just in case you really do have millions of these distances. Pick point P1 on line segment L1 (e.g., an endpoint). Pick 101 evenly spaced points on line segment L2. Find the nearest to P1 and call it P2.

Re: [R] minimum distance between line segments

2011-03-11 Thread rex.dwyer
I think I need to retract the part about 3 iterations... not true if, e.g., the segments intersect and the angle is small. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of rex.dw...@syngenta.com Sent: Friday, March 11, 2011 2:37

Re: [R] Easy 'apply' question

2011-03-11 Thread Aaron Polhamus
Perfect, thanks Josh! Cheers, A 2011/3/10 Joshua Wiley jwiley.ps...@gmail.com Dear Aaron, The problem is not with your function, but using apply(). Look at the Details section of ?apply You will see that if the data is not an array or matrix, apply will coerce it to one (or try). Now go

Re: [R] minimum distance between line segments

2011-03-11 Thread Stephan Kolassa
Hi, this sounds like a standard problem in Computational Geometry - I guess game developers have to deal with something like this all the time. You may want to look at a textbook or two. An article with the promising title On fast computation of distance between line segments can be found

[R] Large dataset operations

2011-03-11 Thread hi Berven
Hello all, I'm new to R and trying to figure out how to perform calculations on a large dataset (300 000 datapoints). I have already made some code to do this but it is awfully slow. What I want to do is add a new column for each rep_ column where I have taken each value and divide it by

[R] Partial Cross Correlation

2011-03-11 Thread Kevin Boggs
Does anyone know of any R code for computing partial cross-correlation? I have examples of cross correlation functions (ccfs) that are not smooth but rather consist of a peak of several high values in consecutive lags, with sharp drops on either side. This indicates that y(t) is a function of

Re: [R] Kendall Theil line as fit?

2011-03-11 Thread jonbfish
Also called Sen's slope estimate... -- View this message in context: http://r.789695.n4.nabble.com/Kendall-Theil-line-as-fit-tp3344617p3348823.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] Partial Cross Correlation

2011-03-11 Thread Don McKenzie
?pacf On 11-Mar-11, at 9:42 AM, Kevin Boggs wrote: Does anyone know of any R code for computing partial cross- correlation? I have examples of cross correlation functions (ccfs) that are not smooth but rather consist of a peak of several high values in consecutive lags, with sharp drops

Re: [R] Partial Cross Correlation

2011-03-11 Thread Don McKenzie
Belay that. I misread the post. On 11-Mar-11, at 12:09 PM, Don McKenzie wrote: ?pacf On 11-Mar-11, at 9:42 AM, Kevin Boggs wrote: Does anyone know of any R code for computing partial cross- correlation? I have examples of cross correlation functions (ccfs) that are not smooth but rather

Re: [R] Large dataset operations

2011-03-11 Thread Phil Spector
To get the equivalent of what your loop does, you could use lapply(data[,3:5],function(x)x/ave(x,data$plateNo,FUN=mean)) but you might find the output of sapply(data[,3:5],function(x)x/ave(x,data$plateNo,FUN=mean)) to be more useful. - Phil Spector

[R] 'Date' elements within a matrix

2011-03-11 Thread Bogaso Christofer
Dear all, when I put date objects (class of 'Date') in a matrix it becomes numeric: dat - matrix(seq(as.Date(2011-01-01), as.Date(2011-01-09), by=1 day), 3) dat [,1] [,2] [,3] [1,] 14975 14978 14981 [2,] 14976 14979 14982 [3,] 14977 14980 14983 class(dat[1,1]) [1] numeric As

Re: [R] Error in plot.lm

2011-03-11 Thread Peter Ehlers
On 2011-03-11 11:31, David Winsemius wrote: On Mar 11, 2011, at 2:06 PM, Jeff Newmiller wrote: I am encountering an error with plot.lm: tstdf- data.frame( y=c(1.01,1.98,3.02,3.99),x=c(1,2,3,4)) plot(lm(I(y) ~ x, data=tstdf)) HitReturn to see next plot: HitReturn to see next

Re: [R] Large dataset operations

2011-03-11 Thread Claudia Beleites
Haakon, as replicates imply that they all have the same data type, you can put them into a matrix which is often faster and needs less memory (though whether that can really matter depends of the number of replicates you have: for small no of replicates you won't have much effect anyways).

Re: [R] 'Date' elements within a matrix

2011-03-11 Thread Phil Spector
It will be difficult or impossible to store objects of class Date in a matrix -- you'll need to store them in a data frame: pts = seq(as.Date(2011-01-01), as.Date(2011-01-09), by=1 day) z = data.frame(pts[1:3],pts[4:6],pts[7:9]) z pts.1.3. pts.4.6. pts.7.9. 1 2011-01-01 2011-01-04

Re: [R] 'Date' elements within a matrix

2011-03-11 Thread Gabor Grothendieck
On Fri, Mar 11, 2011 at 4:15 PM, Bogaso Christofer bogaso.christo...@gmail.com wrote: Dear all, when I put date objects (class of 'Date') in a matrix it becomes numeric: dat - matrix(seq(as.Date(2011-01-01), as.Date(2011-01-09), by=1 day), 3) dat      [,1]  [,2]  [,3] [1,] 14975 14978

Re: [R] Error in plot.lm

2011-03-11 Thread Jeff Newmiller
Thank you for indicating more precisely where the bug arises. I disagree with the blanket assertion that the I() is not needed. The example is purposely simplified to illustrate the problem, which lm has no difficulty with but which plot.lm does. plot.lm manages to deal with I() on the right

Re: [R] Error in plot.lm

2011-03-11 Thread peter dalgaard
On Mar 11, 2011, at 20:31 , David Winsemius wrote: Are you sure you need I() on the LHS? The I function is designed to avoid the confusion related to the dual use of the arithmetic operator symbols affecting the construction of the model matrix, but I don't think that applies to the

[R] How to source a part of the file

2011-03-11 Thread Paul Y. Peng
I have a text file of R commands. Some times I only want to run a few lines of the R commands in an existing R session and wonder whether there is a simple way to do this. To run a few lines in a new session of R, I could use sed to pick up the lines from the file and pipe them into R. source()

Re: [R] How to source a part of the file

2011-03-11 Thread Gabor Grothendieck
On Fri, Mar 11, 2011 at 4:41 PM, Paul Y. Peng pywp...@gmail.com wrote: I have a text file of R commands. Some times I only want to run a few lines of the R commands in an existing R session and wonder whether there is a simple way to do this. To run a few lines in a new session of R, I could

[R] Reference Lines Using Grid Graphics

2011-03-11 Thread Pete Brecknock
Hi I would like to be able to add reference lines to a series of plots that are built using the Grid graphics package. These lines should coincide with tick marks which are different on each plot. I can add the lines manually using the grid.lines() function but would like to understand how to

Re: [R] How to source a part of the file

2011-03-11 Thread jim holtman
You can do: source(readLines(yourFile)[10:20]) # lines 10-20 of the file On Fri, Mar 11, 2011 at 4:41 PM, Paul Y. Peng pywp...@gmail.com wrote: I have a text file of R commands. Some times I only want to run a few lines of the R commands in an existing R session and wonder whether there is a

Re: [R] How to source a part of the file

2011-03-11 Thread jim holtman
I meant to say, but my fingers got ahead of my brain: source(textConnection(readLines(yourFile)[10:20])) On Fri, Mar 11, 2011 at 4:53 PM, jim holtman jholt...@gmail.com wrote: You can do: source(readLines(yourFile)[10:20])   # lines 10-20 of the file On Fri, Mar 11, 2011 at 4:41 PM, Paul Y.

Re: [R] Error in plot.lm

2011-03-11 Thread Peter Ehlers
On 2011-03-11 13:33, Jeff Newmiller wrote: Thank you for indicating more precisely where the bug arises. I disagree with the blanket assertion that the I() is not needed. The example is purposely simplified to illustrate the problem, which lm has no difficulty with but which plot.lm does.

Re: [R] Reference Lines Using Grid Graphics

2011-03-11 Thread Pete Brecknock
Apologies I forgot to include that the reference lines should be for the y axis only. Thanks. Pete -- View this message in context: http://r.789695.n4.nabble.com/Reference-Lines-Using-Grid-Graphics-tp3349185p3349206.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] 'Date' elements within a matrix

2011-03-11 Thread jim holtman
It is easy to recover the date by using as.Date: dat - matrix(seq(as.Date(2011-01-01), as.Date(2011-01-09), by=1 day), 3) dat [,1] [,2] [,3] [1,] 14975 14978 14981 [2,] 14976 14979 14982 [3,] 14977 14980 14983 str(dat) num [1:3, 1:3] 14975 14976 14977 14978 14979 ... as.Date(dat)

  1   2   >