Re: [R] feed cut() output into goodness-of-fit tests

2010-10-15 Thread Phil Spector
break different than a simple call to seq(). - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley

Re: [R] boxplot ranked x labels

2010-10-18 Thread Phil Spector
. - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley spec...@stat.berkeley.edu On Mon

Re: [R] For-loop dummy variables?

2010-10-19 Thread Phil Spector
[i] = 0} } When you write a loop, you need to use the loop index to select the individual value you're working with. - Phil Spector Statistical Computing Facility

Re: [R] Chron object in time series plot

2010-10-19 Thread Phil Spector
. . . And I'm still not sure I've answered your question. - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley

Re: [R] How to read only ten rows from a SAS dataset (read.ssd)?

2010-10-19 Thread Phil Spector
will return only the first 10 observations. - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley

Re: [R] Clustering with ordinal data

2010-10-19 Thread Phil Spector
Steve - Take a look at daisy() in the cluster package. - Phil Spector Statistical Computing Facility Department of Statistics UC

Re: [R] efficient test for missing values (NAs)

2010-10-20 Thread Phil Spector
Ali - If all you care about is if there are any missing values (not how many or where they are), I think it would be a bit faster to use if(any(is.na(x))){...} - Phil Spector Statistical Computing Facility

Re: [R] How do I read multiple rows of different lengths?

2010-10-27 Thread Phil Spector
') So to reproduce your x, y, fit, and res: x = result$x[[1]] y = result$orig[[1]] fit = result$fit[[1]] res = result$res[[1]] Of course, you can access any of the other results by changing the subscript. - Phil Spector

Re: [R] Alter character attribute

2010-10-28 Thread Phil Spector
assuming you're using month/date/year.) I can pretty much guarantee it will run in less than 18 hours :-) - Phil Spector Statistical Computing Facility Department of Statistics

Re: [R] Determining a basal correct count

2010-10-28 Thread Phil Spector
David - I *think* apply(x,1,function(x)rle(x[which(x==1)[1]:length(x)])$lengths[1]) gives you what you want, but without a reproducible example it's hard to say. It will fail if there are no 1s in a given row. - Phil Spector

Re: [R] Determining a basal correct count

2010-10-28 Thread Phil Spector
Herzberg wrote: Thank you Phil - I'll give this a try. I do have some empty rows, so I'll have to deal with that eventually. Dave Sent via DROID X -Original message- From: Phil Spector spec...@stat.berkeley.edu To: David Herzberg dav...@wpspublish.com Cc: r-help@r

Re: [R] How to scan df from a specific word?

2010-10-29 Thread Phil Spector
loop reads up until the word Source appears in the line, and the second loop builds a text representation of what you want so that you can read it using textConnection. Hope this helps. - Phil Spector Statistical

Re: [R] date calculation

2010-10-29 Thread Phil Spector
certainly free to make it one: as.integer(difftime(strptime(24NOV2004, format=%d%b%Y), + strptime(13MAY2004,format=%d%b%Y), units=days)) [1] 195 - Phil Spector Statistical Computing Facility

Re: [R] spliting first 10 words in a string

2010-11-01 Thread Phil Spector
a - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley spec...@stat.berkeley.edu On Mon, 1

Re: [R] individual intercept and slope

2010-11-02 Thread Phil Spector
You didn't say what form you wanted the output in, but here's one way: sapply(split(dat,dat$individual),function(s)lm(height~time,data=s)$coef) 1 2 (Intercept) 8.47 19.87 time2.485714 -2.057143 - Phil Spector

Re: [R] Strings from different locale

2010-11-02 Thread Phil Spector
Steven - Does typing Sys.setlocale('LC_ALL','C') before the offending command suppress the message? - Phil Spector Statistical Computing Facility Department

Re: [R] how to work with long vectors

2010-11-04 Thread Phil Spector
(dat)) user system elapsed 0.024 0.000 0.026 - Phil Spector Statistical Computing Facility Department of Statistics UC

Re: [R] matlab code into R

2010-11-04 Thread Phil Spector
Well, there's the obvious: N = matrix(0,n-1,n-1) for(i in 2:(n-1)) N[1,i] = 1/(pi * (i-1)) for(i in 2:(n-2)) for(j in i:(n-1)) N[i,j] = N[i-1,j-1] for(i in 2:(n-1)) for(j in 1:i) N[i,j] = -N[j,i] - Phil Spector

Re: [R] lookup in R - possible to avoid loops?

2010-11-08 Thread Phil Spector
Dimitri - While merge is most likely the fastest way to solve your problem, I just want to point out that you can use a named vector as a lookup table. For your example: categories = my.lookup$category names(categories) = my.lookup$names creates the lookup table, and my.df$category =

Re: [R] Help with getting ?match to not sort

2010-11-08 Thread Phil Spector
- Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley spec...@stat.berkeley.edu On Mon, 8 Nov 2010

Re: [R] help to add a new column filled with value 1

2010-11-09 Thread Phil Spector
Mohan - Suppose your data frame is named df. Try this: data.frame(df[,1],1,df[,2:5]) - Phil Spector Statistical Computing Facility Department of Statistics

Re: [R] library(kernlab) --- unable to load shared library

2010-11-09 Thread Phil Spector
-standard location. You didn't mention what Linux distribution you're using, or whether you built R and the kernlab library from source or not, so it's hard to give specific guidance to solve your problem. - Phil Spector

Re: [R] Merging data frames one of which is NULL

2010-11-09 Thread Phil Spector
NA NA NA 2 9 10 NA NA NA 15 3 10 20 NA 30 NA NA 4 12 19 NA NA 25 NA Hope this helps. - Phil Spector Statistical Computing Facility Department of Statistics

Re: [R] Question regarding to replace NA

2010-11-09 Thread Phil Spector
, you can use as.numeric: as.numeric(myvar) [1] 0 0 0 1 Hope this helps. - Phil Spector Statistical Computing Facility Department of Statistics

Re: [R] plotting histograms/density plots in a triangular layout?

2010-11-10 Thread Phil Spector
,data=somedat,skip=chk,layout=c(7,7),as.table=TRUE) I'm not sure what you mean by the legends, but maybe this will give you a start. - Phil Spector Statistical Computing Facility

Re: [R] maptools package

2010-11-10 Thread Phil Spector
Aleksandr - What happens when you use library(maptools) spb = readShapePoly('/home/sasha/Documents/maps/spb.shp') - Phil Spector Statistical Computing Facility Department

Re: [R] Format table help

2010-11-10 Thread Phil Spector
Cameron - Are you sure Mthticker is a table? It looks like a list containing named vectors. Are you trying to reformat the list (Mthticker), or to reformat one element in the list (MthTicker[[i]]). - Phil Spector

Re: [R] Summing functions of lists

2010-11-13 Thread Phil Spector
Does this version of y do what you want? y=function(j)sum(sapply(1:3,function(i)x(i,j))) - Phil Spector Statistical Computing Facility Department of Statistics

Re: [R] Error: invalid type(list) for variable when using lm()

2010-11-16 Thread Phil Spector
Tianchan - Your X is not a matrix -- it's a dataframe. Probably the simplest solution is to use lm(y~as.matrix(X)) but you should also learn the difference between a data frame and a matrix. - Phil Spector

Re: [R] Counting

2010-11-16 Thread Phil Spector
Hope this helps! - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley

Re: [R] Vectors out of lists?

2010-11-16 Thread Phil Spector
Eduardo - I'd guess that Ybar = function(u)mean(sapply(Y,function(fun)fun(u))) will do what you want, but without a reproducible example, it's hard to tell. - Phil Spector Statistical Computing Facility

Re: [R] Vectors out of lists?

2010-11-16 Thread Phil Spector
Vectorize() before trying to integrate: integrate(Vectorize(Ybar),0,1) 0.4587882 with absolute error 5.6e-05 - Phil Spector Statistical Computing Facility Department

Re: [R] Vectors out of lists?

2010-11-17 Thread Phil Spector
))) user system elapsed 1.324 0.000 1.323 system.time(two - Ybar1(seq(0,1,length=1))) user system elapsed 0.004 0.000 0.002 - Phil Spector Statistical Computing Facility

Re: [R] translate vector of numbers to indicies of 0/1 matrix

2010-11-17 Thread Phil Spector
,]0010 [3,]0010 [4,]0001 - Phil Spector Statistical Computing Facility Department of Statistics

Re: [R] Set colour in tcl variable

2010-11-19 Thread Phil Spector
(lab,foreground='red',text='wrong') green = function(...)tkconfigure(lab,foreground='green',text='correct') tkpack(tkbutton(base,text='Red',command=red)) tkpack(tkbutton(base,text='Green',command=green)) - Phil Spector

Re: [R] Check for is.object

2010-11-22 Thread Phil Spector
and then truncate it at the end. I'd strongly recommend that you avoid building your matrix incrementally inside a loop! - Phil Spector Statistical Computing Facility

Re: [R] how to round only one column of a matrix ?

2010-11-22 Thread Phil Spector
- Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley spec...@stat.berkeley.edu On Mon, 22

Re: [R] I need a very specific unique like function and I don't know even how to properly call this

2010-11-22 Thread Phil Spector
],FALSE) dat[!(abv blw),] [,1] [,2] [1,]37 [2,]65 [3,]55 [4,]84 [5,]74 [6,]06 - Phil Spector Statistical Computing Facility

Re: [R] scan function

2010-11-23 Thread Phil Spector
. - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley spec...@stat.berkeley.edu On Wed, 24

Re: [R] Cannot update R

2010-11-24 Thread Phil Spector
I believe R is complaining that it can't find the jags library. You can find out about it here: http://www-fis.iarc.fr/~martyn/software/jags/ There appear to be rpms available. - Phil Spector Statistical

Re: [R] Cannot update R

2010-11-24 Thread Phil Spector
Alon - It says it couldn't find it in /usr/local/lib -- is it in some non-standard location? If so, you could modify the ~/.R/Makevars file to contain PKG_LIBS=/location/of/jagslibrary before trying to build the package. - Phil On Wed, 24 Nov

Re: [R] Create new string of same length as entry in dataframe

2010-11-24 Thread Phil Spector
$V2) t2$V3 [1] badbadb badbad b ba Hope this helps. - Phil Spector Statistical Computing Facility Department of Statistics

Re: [R] Subset by using multiple values

2010-11-29 Thread Phil Spector
). - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley spec...@stat.berkeley.edu On Mon, 29 Nov 2010, clangkamp

Re: [R] List elements of NULL to value

2010-11-29 Thread Phil Spector
Does A = lapply(A,function(x)if is.null(x) 0 else x) or for(i in 1:length(A))if(is.null(A[[i]]))A[i] = 0 do what you want? - Phil Spector Statistical Computing Facility

Re: [R] Can't Destroy Dim Names

2010-11-30 Thread Phil Spector
displaying the object, the names or dimnames should not affect anything you do with the object, and they do allow you to index elements by name instead of number. - Phil Spector Statistical Computing Facility

Re: [R] rows process in DF

2010-07-14 Thread Phil Spector
[-1]0])) t(apply(myDF,1,doit)) id sum_positive sum_negative [1,] 100 1.8 -2.2 [2,] 101 1.8 -1.7 - Phil Spector Statistical Computing Facility

Re: [R] replace negative numbers by smallest positive value in matrix

2010-07-15 Thread Phil Spector
Juliet - Since you're operating on each column, apply() would be the appropriate function; mymat = apply(mymat,2,function(x){x[x0] = min(x[x0]);x}) - Phil Spector Statistical Computing Facility

Re: [R] Repeated analysis over groups / Splitting by group variable

2010-07-15 Thread Phil Spector
results in a list. - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley

Re: [R] Help with Reshaping from Wide to Long

2010-07-17 Thread Phil Spector
$shape=factor(two$shape,labels=c('Circle','Square','Triangle')) two$color=factor(two$color,labels=c('Blue','Red','Green')) names(two)[4] = 'value' - Phil Spector Statistical Computing Facility

Re: [R] how to collapse categories or re-categorize variables?

2010-07-17 Thread Phil Spector
library(car) recode(d,c(1,2)='1') [1] 0 1 1 - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley

Re: [R] Get distribution of positive/negative examples for each cluster

2010-07-21 Thread Phil Spector
='membership', + v.names='Freq',timevar='label',direction='wide') membership Freq.0 Freq.1 1 1 2 1 2 2 1 2 3 3 0 3 - Phil Spector Statistical Computing

Re: [R] Question about allocMatrix error message

2010-07-21 Thread Phil Spector
,] - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley spec...@stat.berkeley.edu On Wed, 21

Re: [R] xyplot with all columns of a data.frame on a single plot

2010-07-27 Thread Phil Spector
. - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley spec...@stat.berkeley.edu On Mon

Re: [R] read.delim()

2010-07-28 Thread Phil Spector
Harold - If there aren't any true quoted fields in the file, you could pass the quote= option to read.delim(). - Phil Spector Statistical Computing Facility Department

Re: [R] Equality of Vectors

2010-08-13 Thread Phil Spector
?all - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley spec

Re: [R] 'panel.smooth' error

2010-08-18 Thread Phil Spector
,...)}) - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley spec

Re: [R] Different way of aggregating

2010-08-18 Thread Phil Spector
) For POSIXct objects: aggregate(thedata$value,list(hour=format(thedata$date,'%H')),mean) If I made the wrong assumptions, please provide a reproducible example. - Phil Spector Statistical Computing Facility

Re: [R] Aggregate Help

2010-08-19 Thread Phil Spector
. - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley spec

Re: [R] Converting sparse matrix to data.frame in Matrix package

2010-08-19 Thread Phil Spector
This seems to work, although it eliminates the sparseness of the storage: dimnames(a) = list(NULL,letters[1:5]) as.data.frame(as.matrix(a)) a b c d e 1 0 0 0 1 0 2 2 1 0 0 0 3 0 0 3 0 1 - Phil Spector

Re: [R] Index list by other list (w/ logical elements)?

2010-08-24 Thread Phil Spector
Marianne - The function you're looking for is mapply: mapply(function(one,two)one[two],x,y) [[1]] [1] one [[2]] [1] four five - Phil Spector Statistical Computing Facility

Re: [R] Non-standard sorts on vectors

2010-08-26 Thread Phil Spector
Here's one possibility: sort.v-c(Lake=1,Shoreline=2,Floodplain=3) test.df[order(sort.v[as.character(test.df$Zone)]),] Zone Cover 2 Lake60 3 Shoreline70 1 Floodplain50 - Phil Spector

Re: [R] interpreting date-related error message

2010-08-27 Thread Phil Spector
Toby - Since dat$doy is just a number, the default S3 method for format is used, where the second argument is the trim parameter. I suspect you are confusing format (which is for output) with strptime (which is for input). For example, strptime(dat$doy,'%j') will assume that the dates

Re: [R] listing files recursively

2010-08-30 Thread Phil Spector
Hyunchul - You don't have to rely on the operating system to provide information about the file system. Look at ?list.files For example, list.files('/path/to/directory',recursive=TRUE) - Phil Spector

Re: [R] subbing a string vector for another string vector

2010-09-08 Thread Phil Spector
url 1 http://$IMAGE_ID$ www.url.com/image.jpg http://www.url.com/image.jpg 2$IMAGE_ID$ http://www.blah.com/image.gif http://www.blah.com/image.gif - Phil Spector Statistical Computing

Re: [R] problem with outer

2010-09-08 Thread Phil Spector
Does outer(p_11,p_12,Vectorize(guete)) do what you want? - Phil Spector Statistical Computing Facility Department of Statistics UC

Re: [R] filter a tab delimited text file

2010-09-10 Thread Phil Spector
, check.names=FALSE) expFC.TRUE - expFC[expFC[dim(expFC)[2]]==TRUE,] write.table(expFC.TRUE, file=test_TRUE.txt, row.names=FALSE, sep=\t, quote=FALSE ) - Phil Spector Statistical Computing Facility

Re: [R] average matrices across a list

2010-09-12 Thread Phil Spector
Gregory - Suppose your list is called mymats. Then Reduce(+,mymats) does what you want. - Phil On Sun, 12 Sep 2010, Gregory Ryslik wrote: Hi, I have a list of several hundred 2 dimensional matrices, where each matrix is n x m. What I need to do is

Re: [R] average matrices across a list

2010-09-12 Thread Phil Spector
' is not subsettable Thanks again! Kind regards, Greg On Sep 12, 2010, at 3:49 PM, Phil Spector wrote: Gregory - Suppose your list is called mymats. Then Reduce(+,mymats) does what you want. - Phil On Sun, 12 Sep 2010, Gregory Ryslik wrote: Hi, I have a list

Re: [R] Question: Form a new list with the index replicated equal to the number of elements in that index

2010-09-13 Thread Phil Spector
Sunny - I don't think mapply is needed: lapply(1:length(mylist),function(x)rep(x,length(mylist[[x]]))) [[1]] [1] 1 1 1 [[2]] [1] 2 [[3]] [1] 3 3 - Phil Spector Statistical Computing Facility

Re: [R] Condition %in%

2010-09-13 Thread Phil Spector
!10 %in% x (or !(10 %in% x) if you don't believe in R's precedence rules. - Phil Spector Statistical Computing Facility Department of Statistics

Re: [R] proportion

2010-09-13 Thread Phil Spector
Maybe prop.table ? - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley

Re: [R] rnorm using vector of means and SDs

2010-09-14 Thread Phil Spector
I think t(mapply(rnorm,1000,vector_of_means,vector_of_sds)) will do what you want. - Phil Spector Statistical Computing Facility Department of Statistics

Re: [R] loop, list() and non-numeric argument to binary operator

2010-09-15 Thread Phil Spector
Chien-Pang - Here's a *reproducible* example that should answer your question: k = list() n = 10 max = 10:19 for(i in 1:n) (k[i]=list(c(0:max[i]))) k[[1]] + 1 [1] 1 2 3 4 5 6 7 8 9 10 11 - Phil Spector

Re: [R] labeling outliers with subject numberss

2010-09-15 Thread Phil Spector
Kevin - Here's one way: z = boxplot(mydata$score,outline=FALSE,ylim=range(mydata$score)) text(1,z$out,SubNo[which(score == z$out)]) - Phil Spector Statistical Computing Facility

Re: [R] get top n rows group by a column from a dataframe

2010-09-16 Thread Phil Spector
533 2.328799 . . . - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley

Re: [R] Weibull simulation- number of items to replace is not a multiple of replacement length

2010-09-16 Thread Phil Spector
the estimates into the pth row (mymat[p,]) or pth column (mypat[,p]) of the matrix. - Phil Spector Statistical Computing Facility Department of Statistics

Re: [R] If statements for multiple arrays

2010-09-16 Thread Phil Spector
.) - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley spec

Re: [R] grouping dataframe entries using a categorical variable

2010-09-17 Thread Phil Spector
Bastien - In what way did subset(yourdataframe,ESS %in% softwood) not work? - Phil Spector Statistical Computing Facility Department of Statistics

Re: [R] how to import this kind of data?

2010-09-17 Thread Phil Spector
Soyeon - I think scan() (combined with matrix and data.frame) is the easiest way. Suppose your text file is called data.txt. Then data.frame(matrix(scan('data.txt'),byrow=TRUE,ncol=14)) should give you what you want. - Phil Spector

Re: [R] Sorting and subsetting

2010-09-20 Thread Phil Spector
Harold - Two ways that come to mind: 1) do.call(rbind,lapply(split(tmp,tmp$index),function(x)x[1:5,])) 2) subset(tmp,unlist(tapply(foo,index,seq))=5) - Phil Spector Statistical Computing Facility

Re: [R] Removing slected values from original vector and definning new vector with the rest?

2010-09-20 Thread Phil Spector
Anan - If you actually want the indices, you can use seq_along(sampWB)[-censidx] If you want the values themselves, then use sampWB[-censidx] - Phil Spector Statistical Computing Facility

Re: [R] Trouble installing pwr package

2010-09-21 Thread Phil Spector
pwr.chisq.test [9] pwr.f2.testpwr.norm.test pwr.p.test pwr.r.test [13] pwr.t2n.test pwr.t.test Those are the functions that are made available by loading the pwr package. Do you see something different after you load pwr? - Phil Spector

Re: [R] Lattice xyplot and groups

2010-09-21 Thread Phil Spector
Does using df = df[order(df$type,df$set,df$x),] before calling xyplot fix the problem? - Phil Spector Statistical Computing Facility Department of Statistics

Re: [R] Extracting bins and frequencies from frequency table

2010-09-22 Thread Phil Spector
Ralf - Try bins = as.numeric(names(t1)) freqs = as.vector(t1) - Phil Spector Statistical Computing Facility Department of Statistics

Re: [R] Some questions about string processing

2010-09-24 Thread Phil Spector
) . . . - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley spec

Re: [R] Splitting a time + duration into a series of periods

2010-09-24 Thread Phil Spector
$login_end tm))) time count 1 2010-01-01 10:00:00 1 2 2010-01-01 10:30:00 1 3 2010-01-01 11:00:00 2 4 2010-01-01 11:30:00 1 5 2010-01-01 12:00:00 1 6 2010-01-01 12:30:00 0 Hope this helps. - Phil Spector

Re: [R] performing script on multiple files

2010-09-24 Thread Phil Spector
all the .csv files in the current directory, and write out a file with the extension changed to .new in the directory /some/location . - Phil Spector Statistical Computing Facility

Re: [R] How to read this file into R.

2010-09-24 Thread Phil Spector
.0.N C.2.S C.0.G H.3.G Hope this helps. - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley

Re: [R] POSIXct: Extract the hour for a list of elements

2010-09-24 Thread Phil Spector
Matthew - It's a bit simpler than you think: as.POSIXlt(pk)$hour should return what you want. (If not, please provide a reproducible example.) - Phil Spector Statistical Computing Facility

Re: [R] Percentages and lattice

2010-09-27 Thread Phil Spector
,all) both$Pct = both$Freq / both$Total * 100 - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley

Re: [R] Issues with Legend symbols

2010-09-27 Thread Phil Spector
) [1] 19 15 21 22 and c(2,2,2,2) [1] 2 2 2 2 or rep(2,4) [1] 2 2 2 2 I would ignore any other advice you got from the source that advised you to use expressions like 19:15:21:22 in R. - Phil Spector Statistical

Re: [R] Trying to avoid loop structure

2010-09-29 Thread Phil Spector
$st,6),labels=FALSE) + 1) - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley

Re: [R] Split data

2010-09-29 Thread Phil Spector
9 14 [5,]5 10 15 - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley

Re: [R] interactive session

2010-09-30 Thread Phil Spector
If you don't mind the prompt of 1:, I think scan will do what you want: a = scan(n=1,what='',quiet=TRUE);b = paste(t,a,sep=''); 1: ada b [1] tada - Phil Spector Statistical Computing Facility

Re: [R] second element of a list

2010-09-30 Thread Phil Spector
Gregory - I'm confused -- if the first element is the matrix you want, why would you use 2 as an index? Here's a way to get a list with the first elements of each member of a list: lapply(thelist,'[[',1) - Phil Spector

Re: [R] add a new column to data frame

2010-10-01 Thread Phil Spector
(x$y)]) merge(dat,data.frame(id=names(two),type=two)) - Phil Spector Statistical Computing Facility Department of Statistics UC

Re: [R] Suppressing printing in the function

2010-10-01 Thread Phil Spector
?invisible - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley

Re: [R] element wise conditional assignment in r

2010-10-01 Thread Phil Spector
John - Is this what you're looking for? r = sample(c(0,1),10,replace=TRUE) r [1] 0 1 0 1 1 0 0 1 0 1 v = 1:10 ifelse(r == 1,v-1,v) [1] 1 1 3 3 4 6 7 7 9 9 - Phil Spector Statistical Computing Facility

Re: [R] Help with apply

2010-10-04 Thread Phil Spector
)mapply(function(n,w)doit1(x,n,w),qq$nodes,qq$weights)) Both seem to agree with your rr1. - Phil Spector Statistical Computing Facility Department of Statistics

Re: [R] Subset POSIXlt Field

2010-10-05 Thread Phil Spector
Jared - The value 2010-08-17 is a character value, and your dates are stored as POSIXlt values. So you'd need to use Date == as.POSIXlt(2010-08-17) in your subset statement. - Phil Spector Statistical

  1   2   3   4   >