Re: [R] Wrong results from anova

2015-04-14 Thread Phil Spector
1 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 summary(fit.Y) Df Sum Sq Mean Sq F valuePr(>F) sample.Y 3 2202.70 734.23 190706 < 2.2e-16 *** Residuals80.030.00 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Re: [R] Capturing output of a C executable

2014-02-03 Thread Phil Spector
://www.stat.berkeley.edu/classes/s243/calling.pdf - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley

Re: [R] Extracting Numeric Columns from Data Fram

2013-02-16 Thread Phil Spector
Barry = Suppose your data frame is called "mydat". Then something like mydat[,sapply(mydat,class) %in% c('numeric','integer')] might do what you want. - Phil On Sat, 16 Feb 2013, Barry DeCicco wrote: Hello, I've got a data frame wi

Re: [R] help with calculation from dataframe with multiple entries per sample

2012-09-17 Thread Phil Spector
pecial characters like dashes in variable names. Hope this helps. - Phil Spector Statistical Computing Facility Department of Statistics

Re: [R] How to adjust the start of a series to zero? (i.e. subtract the first value from the sequence)

2012-06-30 Thread Phil Spector
your data. - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley spec...@stat.be

Re: [R] need help reshaping table using aggregate

2012-06-20 Thread Phil Spector
Tim - Another approach to your problem is to use xtabs: xtabs(count~site+bug,data=myf) bug site grasshopper ladybug spider stinkbug A 4 0 20 B 0 6 08 - Phil Spector

Re: [R] strings concatenation and organization (fast)

2012-06-15 Thread Phil Spector
et 25 rows.) - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley

Re: [R] reading file in zip archive

2012-05-30 Thread Phil Spector
Iain - Do you see the same behaviour if you use z <- unz(pathToZip, 'x.txt') instead of z <- unz(pathToZip, 'x.txt','r') - Phil Spector

Re: [R] reading file in zip archive

2012-05-30 Thread Phil Spector
#x27;t reproduce the exact error which you saw.) - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley

Re: [R] SAS Import with sas.get {Hmisc} - status 127 error

2012-03-28 Thread Phil Spector
I've found the keep,log=TRUE option of sas.get to be useful in cases like this. There's also a log.file= option if you don't want the default location for the log file. - Phil Spector Statistical Com

Re: [R] obtaining a true/false vector with combination of strsplit, length, unlist,

2012-02-11 Thread Phil Spector
It sounds like the problem boils down to counting the number of "_"s in the WELLID variable, and seeing if there are two: nchar(gsub('[^_]','',edm$WELLID)) == 2 [1] FALSE FALSE TRUE TRUE TRUE TRUE FALSE

Re: [R] apply pairs function to multiple columns in a data frame

2012-02-10 Thread Phil Spector
reproducible example goes a long way towards getting a good answer. - Phil Spector Statistical Computing Facility Department of Statistics

Re: [R] Rearanging Data

2012-02-09 Thread Phil Spector
Try sub <- subset(Claims, Year==Y1) In R, the equality test is performed by two equal signs, not one. - Phil Spector Statistical Computing Facility Department

Re: [R] Subsetting for the ten highest values by group in a dataframe

2012-01-27 Thread Phil Spector
sing=TRUE)[1:10],]) should give you what you want. In this simple case, you could also use do.call(rbind,by(df,df$z,function(dat)dat[order(dat$x,decreasing=TRUE)[1:10],])) from base R to get the same result. Hope this helps.

Re: [R] Using !is.na() in a HAVING clause in sqldf() XXXX

2012-01-17 Thread Phil Spector
Dan - Try using "having Premie not null" instead of "having !is.na(Premie)" . - Phil Spector Statistical Computing Facility Depa

Re: [R] Deleting rows and store the deleted rows in new data frame

2011-07-24 Thread Phil Spector
There's no need to use sapply or loops with grep -- it's already vectorized. So you can find the rows you're interested in with wh = grep('^[.,]+$',df[,9]) store them with sf = df[wh,] and delete them with df = df[-wh,]

Re: [R] list.files recursively to find files in a specific way...

2011-07-19 Thread Phil Spector
e=TRUE) should give you what you want. - Phil Spector Statistical Computing Facility Department of Statistics

Re: [R] cbind 3 or more matrices

2011-06-04 Thread Phil Spector
[,7] [,8][,9] [1,] -1.7481451 0.4467964 -0.41358420 [2,] -0.2882922 1.0243662 -0.48263684 [3,] 0.9402479 0.5467952 -0.01922035 [4,] 0.6795783 1.4560765 -0.23013826 [5,] 0.9800312 -1.3462175 -0.77064872 - Phil Spector

Re: [R] how to combine two data frames via factors (or somehow else)

2011-05-29 Thread Phil Spector
Philipp - I believe you're looking for the merge function. If you need more guidance, please provide a meaningful reproducible example. - Phil Spector Statistical Computing Fac

Re: [R] Oddity: I seem to have a variable in a dataframe that doesn't show in colnames() - can anyone advise?

2011-05-29 Thread Phil Spector
'PHQ'] Error in `[.data.frame`(x, , "PHQ") : undefined columns selected x[['PHQ']] NULL So if you don't want this "feature", you can use brackets instead of the dollar sign for extraction.

Re: [R] Installing package rgdal

2011-05-28 Thread Phil Spector
s. Hope this helps. - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley spec...@stat.b

Re: [R] Arrange a multi-level list to a one-level list

2011-05-27 Thread Phil Spector
00 [2,]10 [[2]] [,1] [,2] [1,]32 [2,]32 [[3]] [,1] [,2] [,3] [1,]101 [2,]010 [[4]] [,1] [,2] [,3] [1,]222 [2,]223 - Phil Spec

Re: [R] Count of rows while looping through data

2011-05-27 Thread Phil Spector
Jeanna - The family variable is being stored as a factor. You could eliminate the NA values manually, or you could try something like x$family = as.character(x$family) before subsetting. If neither of these solutions are satisfactory, please follow the posting guide and provide a repr

Re: [R] Applying "toupper" to only portions of text strings

2011-05-26 Thread Phil Spector
27;,'\\U\\1\\2\\L\\3',TEXT,perl=TRUE) [1] "" "BBB|cc" "|ddd" - Phil Spector Statistical Computing Facility

Re: [R] Trouble Combining With Paste

2011-05-25 Thread Phil Spector
John - Try infert[,toolong] = sapply(infert[,toolong],cut2,g=10,levels.mean=TRUE) - Phil Spector Statistical Computing Facility Department of Statistics

Re: [R] Count of rows while looping through data

2011-05-24 Thread Phil Spector
= subset(x,seq == use) Hope this helps. Take a look at the help page for the ave function to understand how it works. - Phil Spector Statistical Computing Facility

Re: [R] Extracting day of month from Date objects

2011-05-24 Thread Phil Spector
< 10 < 11 < 12 < 13 < ... < 31 Notice that it returns the days as factors. - Phil Spector Statistical Computing Facility Department of Statistics

Re: [R] Multiple count if style "queries"

2011-05-20 Thread Phil Spector
1 1 result[['Biak-Numfoor rain forests']]$Genus Bromheadia Homalomena 1 1 Hope this helps. - Phil Spector Statistical Computing Facility

Re: [R] trouble with summary tables with several variables using aggregate function

2011-05-19 Thread Phil Spector
1 S1 T1 2 2 2 S2 T1 2 2 3 S1 T2 2 2 7 S2 T2 NA 4 - Phil Spector Statistical Computing Facility

Re: [R] File to MYSQL

2011-05-16 Thread Phil Spector
t of the final query. You might also familiarize yourself with dbGetQuery, which may be more suited to your needs. - Phil Spector Statistical Computing Facility Depar

Re: [R] Creating dataframes

2011-05-13 Thread Phil Spector
The way to do what you want is to use the split function, for example, mydataframes = split(exmpl,exmpl$Site) This will return a list with all the data frames. If you don't understand why this is a better solution than creating many separate data frames, let us know what you plan to do with t

Re: [R] about vector to the power of a decimal

2011-05-12 Thread Phil Spector
lex number (-2)^2.1 [1] NaN complex(real=-2)^2.1 [1] 4.077269+1.324785i - Phil Spector Statistical Computing Facility Department of

Re: [R] Saving misclassified records into dataframe within a loop

2011-05-12 Thread Phil Spector
John - In your example, the misclassified observations (as defined by your predict.function) will be kyphosis[kyphosis$Kyphosis == 'absent' & prediction[,1] != 1,] so you could start from there.

Re: [R] help with mysql and R: partitioning by quintile

2011-05-08 Thread Phil Spector
One way to get the ratings would be to use the ave() function: rating = ave(x$freq,x$track, FUN=function(x)cut(x,quantile(x,(0:5)/5),include.lowest=TRUE)) - Phil Spector Statistical Computing Facility

Re: [R] simulate AR(1) process

2011-05-05 Thread Phil Spector
?arima.sim - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley

Re: [R] Help converting a data.frame to ordered factors

2011-05-02 Thread Phil Spector
creating the 96x34 array, there might be a better solution. - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley

Re: [R] Regression Summary for a List

2011-04-29 Thread Phil Spector
Ryan - summary expects an lm object, and fit is a list. So you need to use something like lapply(fit,summary) to pass each list element to the summary function. - Phil Spector Statistical Computing Facility

Re: [R] How to define specially nested functions

2011-04-28 Thread Phil Spector
Here's one possibility: funmaker = function(x,y,z)function(z)x + y + (x^2 - z) uniroot(funmaker(1,3,z),c(0,10))$root [1] 5 uniroot(funmaker(5,2,z),c(30,40))$root [1] 32 (The third argument to the function doesn't really do anything.) - Ph

Re: [R] Question on list object

2011-04-27 Thread Phil Spector
NA [3,] -2.5787357 1.381395 -1.6545857 0.8239982 -1.169961 - Phil Spector Statistical Computing Facility Department of Statistics

Re: [R] paste function by INDICES

2011-04-27 Thread Phil Spector
a,list(ID=df$ID),paste,collapse='') - Phil Spector Statistical Computing Facility Department of Statistics

Re: [R] Install and Configure RSQLite in Ubuntu

2011-04-25 Thread Phil Spector
sudo apt-get install libsqlite3-dev (Unfortunately, the method I described to find this package in my previous post doesn't work for this one.) - Phil Spector Statistical Computing Fac

Re: [R] Problem installing XML in Ubuntu 10.10

2011-04-25 Thread Phil Spector
Interestingly, for xml, it's last one listed. - Phil Spector Statistical Computing Facility Department of Statistics UC Berk

Re: [R] Problem installing XML in Ubuntu 10.10

2011-04-25 Thread Phil Spector
sudo apt-get install libcurl4-openssl-dev - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley

Re: [R] Problem installing XML in Ubuntu 10.10

2011-04-25 Thread Phil Spector
Abraham - sudo apt-get install libxml2-dev is what you need to get the development libraries and xml2-config installed on your Ubuntu machine. - Phil On Mon, 25 Apr 2011, Abraham Mathew wrote: Hello folks, Here's is info on what system I'm wo

Re: [R] merge with origin information in new variable names

2011-04-25 Thread Phil Spector
7; names(df)[wh] = paste(names(df)[wh],nm,sep='.') df } Reduce(function(x,y)merge(x,y,by='id'),lapply(names(dfs),changenm)) - Phil Spector Statistical Computing Facility

Re: [R] Parametrized object name in Save statement

2011-04-22 Thread Phil Spector
bly do what you want. - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley spec...@sta

Re: [R] get cells by the combination of their column and row names

2011-04-20 Thread Phil Spector
mtrx[outer(rownames(mtrx),colnames(mtrx),function(x,y)substr(x,2,4) == substr(y,2,4))] Hope this helps. - Phil Spector Statistical Computing Facility Department of Stati

Re: [R] 'Record' row values every time the binary value in a collumn changes

2011-04-20 Thread Phil Spector
apply(Next,1,function(x)answer[answer[,1]==x[1] & x[2] >= answer[,2] & x[2] <= answer[,3],4]) [1] 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 0 0 0 - Phil Spector Statistical Computing Facilit

Re: [R] Extract indices after comparing two vectors

2011-04-18 Thread Phil Spector
?which A <- c(1,2,3,4) B <- c(0,3,1,5) which(A [1] 4 - Phil Spector Statistical Computing Facility Department of Statistics

Re: [R] loop and sapply problem, help need

2011-04-09 Thread Phil Spector
c(1,2,3,3) allvals = rbind(lcd1,lcd2,lcd3) pn = replicate(10,allvals[sample(smpool,1),]) but I can't be sure. - Phil Spector Statistical Computing Facility

Re: [R] Finding elements in a character vector

2011-04-08 Thread Phil Spector
match(list.a,list.b) - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley

Re: [R] Where is the tcltk package?

2011-04-07 Thread Phil Spector
Rolf - In order for R to build with tcltk support, the tcl/tk development packages need to be available when R is configured. This command apt-get install tcl8.5-dev tk8.5-dev will install the necessary development packages, but you'll need to reconfigure and rebuild R in order to get tcltk

Re: [R] Need a more efficient way to implement this type of logic in R

2011-04-06 Thread Phil Spector
Walter - Since your codes represent numbers, you could use something like this: chk = as.numeric((hh.sub$HHFAMINC) hh.sub$CS_FAMINC = cut(chk,c(-10,0,5,10,15,17,18),labels=c(0,1:5)) - Phil Spector Statistical

Re: [R] Cannot install pakcage RMySQL

2011-04-06 Thread Phil Spector
You need to install the mysql client development libraries. On SUSE systems, I believe the package is called libmysqlclient-devel . - Phil Spector Statistical Computing Facility

Re: [R] Select subset of data

2011-03-29 Thread Phil Spector
Lisa - Suppose your data frame is called "somedat". Then do.call(rbind,spl[sapply(spl,function(z)z$result[1] == 0 & z$result[2] == 0 & sum(z$result) == 1)]) should give you what you want.

Re: [R] line graph question

2011-03-26 Thread Phil Spector
)) - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley spec...@stat.berkeley.edu On Sat, 26 Mar 2011, Bulent

Re: [R] Loading mdb

2011-03-22 Thread Phil Spector
atabase choice, and navigate to your database. You should then be able to pass the Data Source Name you chose to the odbcConnect function, and use the result in the odbcQuery to make SQL queries to your data base. Hope this helps.

Re: [R] Loading mdb

2011-03-22 Thread Phil Spector
k. I don't know what operating system you are using, but the mdb tools are designed for non-Windows systems. - Phil Spector Statistical Computing Facility

Re: [R] how to convert a data.frame to a list of dist objects for individual differences MDS?

2011-03-22 Thread Phil Spector
l 13.1 6.0 Gy1 12.6 7.9 6.2 Gy2 10.6 8.4 8.4 5.2 Green 10.6 9.4 9.9 6.5 4.1 Blue 10.8 10.2 10.3 8.8 7.0 6.4 BlP7.3 11.3 12.7 11.2 10.4 9.9 4.2 Pur1 5.4 11.5 12.9 11.7 10.8 9.4 8.4 4.5 Pur2 5.0 11.5 10.7 10.2 10.6 10.1 8.1 6.4 3.0

Re: [R] problem running a function

2011-03-19 Thread Phil Spector
Try RN() - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley

Re: [R] [O/T] reference for regular expressions

2011-03-18 Thread Phil Spector
e thorough or authoritive. - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley spec...@stat.berkeley.edu

Re: [R] Why doesn't this work ?

2011-03-16 Thread Phil Spector
function(t)ifelse(t %in% c(1,2,3),1,0) makez(3) [1] 1 makez(4) [1] 0 - Phil Spector Statistical Computing Facility Department of Statistics

Re: [R] Reorganize data frame

2011-03-16 Thread Phil Spector
') rownames(ans) = NULL ans Date Ticker Return 1 20110301 MSFT 0.05 2 20110302 MSFT 0.01 3 20110301 GOOG -0.01 4 20110302 GOOG 0.04 - Phil Spector Statistical Computing Facility

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

2011-03-11 Thread Phil Spector
.6. pts.7.9. 1 2011-01-01 2011-01-04 2011-01-07 2 2011-01-02 2011-01-05 2011-01-08 3 2011-01-03 2011-01-06 2011-01-09 sapply(z,class) pts.1.3. pts.4.6. pts.7.9. "Date" "Date" "Date" - Phil Spector

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

Re: [R] A question about data frame

2011-03-10 Thread Phil Spector
tions. - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley

Re: [R] using lapply

2011-03-10 Thread Phil Spector
that R can't handle large problems. Learning to use the apply family of functions from the start avoids this misconception. - Phil Spector Statistical Computing Facility

Re: [R] Help with read.csv

2011-03-09 Thread Phil Spector
Giovanni - If you change "int" (which has no meaning in R) to "integer" in your second example, it should work. - Phil Spector Statistical Computing Facility

Re: [R] Speed up sum of outer products?

2011-03-01 Thread Phil Spector
0.008 0.104 Of course, you could just do the calculation directly: system.time({C1 = t(X) %*% X}) user system elapsed 0.008 0.000 0.007 all.equal(C,C1) [1] TRUE - Phil Spector Stati

Re: [R] typecasting a function from character to double

2011-02-28 Thread Phil Spector
=k;s=s;eval(parse(text=exprs[1]))} expr1(3,2) [1] 0.75 expr1(10,5) [1] 0.5454545 - Phil Spector Statistical Computing Facility Department of Statistics

Re: [R] how to remove rows in which 2 or more observations are smaller than a given threshold?

2011-02-26 Thread Phil Spector
not sure ifelse would be of much use here. - Phil Spector Statistical Computing Facility Department of Statistics

Re: [R] Transform a dataset from long to wide using reshape2

2011-02-26 Thread Phil Spector
t can rearrange the values. Hope this helps. - Phil Spector Statistical Computing Facility Department of Statistics UC Ber

Re: [R] combining two columns into one column despite NAs

2011-02-24 Thread Phil Spector
Andrew - I believe character.data$z = ifelse(is.na(character.data$x), character.data$y,character.data$x) should do what you want. - Phil Spector Statistical Computing Facility

Re: [R] Delete Comment Lines from SQL String as a Vector

2011-02-21 Thread Phil Spector
to get it to print the way you listed, you need to reduce the width of the line: options(width=20) use[use != ''] [1] "select sysdate " [2] " from dual " - Phil Spector

Re: [R] (no subject)

2011-02-21 Thread Phil Spector
1) adding an informative subject line 2) showing us what you tried without including your typos and other errors. I think you'll find this a more effective strategy than trying to replace core elements of R that you don't understand with empty functions.

Re: [R] Mutiplying a data frame to a list

2011-02-21 Thread Phil Spector
Rohit- If I understand you correctly, and your list's name is mylist, then mapply('*',mylist,as.numeric(names(mylist))) will do what you want. In the future, please provide a reproducible example.

Re: [R] xyplot formula

2011-02-17 Thread Phil Spector
year') xyplot(X~year|country*food,data=newdf) - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley

Re: [R] Using Weights in R

2011-02-17 Thread Phil Spector
111 19.57672 567 100.0 You can probably find the specific part you want from the above code. - Phil Spector Statistical Computing Facility

Re: [R] sort by column and row names

2011-02-17 Thread Phil Spector
Jim - I believe dat[order(rownames(dat)),order(colnames(dat))] is what you are looking for. - Phil Spector Statistical Computing Facility Department of Statistics

Re: [R] A very basic line-plot question

2011-02-17 Thread Phil Spector
axis labeled in what ever way you want, to produce a whatever sort of plot you wanted. I'll leave it to you to figure out the details. - Phil Spector Statistical Computing Facility

Re: [R] How to speed up a for() loop

2011-02-17 Thread Phil Spector
Simona - I don't think preallocating your random variables would make the code run any faster. A very simple change that would speed things up a little would be to replace simPD.vec[i]=length(R.vec[R.vec Dear all, Does anyone have any idea on how to speed up the for() loop below. Current

Re: [R] selecting columns

2011-02-15 Thread Phil Spector
eate a reduced csv file called "mydata.csv" write.csv(mydata[,grep('Location|Ambient|Name',names(mydata),invert=TRUE)], file='mydata.csv') should do what you want, but without a more concrete example, it's just

Re: [R] help with aggregate()

2011-02-15 Thread Phil Spector
a (most likely) easy solution. - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley

Re: [R] Write File to Shared Drive

2011-02-15 Thread Phil Spector
use a call to file.choose() by itself to see what path R expects to see for a particular file or directory. - Phil Spector Statistical Computing Facility Department of

Re: [R] Testing for empty result of which

2011-02-15 Thread Phil Spector
Francois - I think you're looking for the any function: x = c(1,2,3) y = c(4,5,6) any(x==y) [1] FALSE any(which(x==y)) [1] FALSE x = c(1,2,3) y = c(4,2,5) any(x==y) [1] TRUE any(which(x==y)) [1] TRUE - Phil Sp

Re: [R] Calculating rowMeans from different columns in each row?

2011-02-10 Thread Phil Spector
Marine - Assuming your data frame is named "df", I think apply(df,1,function(x)mean(x[x[7]:x[8]])) will give you what you're looking for. - Phil Spector Statistical Com

Re: [R] accessing members from a data frame

2011-02-10 Thread Phil Spector
Try my.data.frame[my.data.frame$Buy==1 | my.data.frame$Sell ==1, ] or subset(my.data.frame,buy == 1 | sell == 1) Then take a look at the help page for || i.e., help("||") to see what you did wrong. - Ph

Re: [R] highest and second highest value in row for each combination

2011-02-10 Thread Phil Spector
r from yours because you didn't specify a seed for the random number generator) I'm not exactly sure how to form your column "combination", though. - Phil Spector Statistical Computing Facility

Re: [R] Loop to find dates whithin dates

2011-02-10 Thread Phil Spector
time <= both$sunset,'day','night') both$date = both$sunrise = both$sunset = NULL Then both should be the data frame you want. - Phil Spector Statistical Computing Facility

Re: [R] add mean and sd to dotplot in each panel using lattice

2011-02-09 Thread Phil Spector
s(c(i-.1,i+.1),rep(mns[i] + 1.96 * sds[i],2)); llines(c(i-.1,i+.1),rep(mns[i] - 1.96 * sds[i],2))} panel.dotplot(x,y,...) } dotplot(Score ~ Dose | Sex, groups=Sex, data=dat,panel=mypanel) - Phil Spec

Re: [R] Removing X and Y labels in graph error

2011-02-08 Thread Phil Spector
Contrast the behaviour of these two statements: plot(x,y,xlab=NULL,ylab=NULL) plot(x,y,xlab='',ylab='') In other words, use xlab='' to supress the label, not NULL. - Phil Spector

Re: [R] delete a row in dataframe w/o changing indexing

2011-02-08 Thread Phil Spector
Nicolas - I don't think it can be done automatically, but you can use row.names(pop) = 1:nrow(pop) after deleting the column(s) to restore consecutive numbers for the row names. - Phil Spector Statis

Re: [R] manipulating the Date & Time classes

2011-02-08 Thread Phil Spector
"Telescopes and bathyscaphes and sonar probes of Scottish lakes, Tacoma Narrows bridge collapse explained with abstract phase-space maps, Some x-ray slides, a music score, Minard's Napoleanic war: The most exciting frontier is charting what's already here."   -- xkcd -- Help pr

Re: [R] Keep date, strip time?

2011-02-08 Thread Phil Spector
9-06-15" as.Date(sub('(\\d+/\\d+/\\d+) .*','\\1',dts),'%m/%d/%Y') [1] "2009-06-10" "2009-06-15" "2009-06-15" as.Date(sub('\\d+:\\d+:\\d+ [AP]M','',dts),'%m/%d/%Y') [1] "200

Re: [R] Using Aggregate for Date

2011-02-07 Thread Phil Spector
the format you want. - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley spec.

Re: [R] Applying 'cbind/rbind' among different list object

2011-02-06 Thread Phil Spector
Another possibility is mapply(rbind,list1,list2,SIMPLIFY=FALSE) - Phil Spector Statistical Computing Facility Department of Statistics

Re: [R] Multiplying elements of vectors

2011-02-05 Thread Phil Spector
400 outer(x,y) [,1] [,2] [,3] [,4] [1,] 25 50 75 100 [2,] 50 100 150 200 [3,] 75 150 225 300 [4,] 100 200 300 400 The outer() function will accepts a FUN= argument which defaults to '*'.

Re: [R] aggregate function - na.action

2011-02-04 Thread Phil Spector
alues. (The subtle distinction between na.action=na.omit and na.rm=TRUE is the function you're calling is that na.omit will remove the entire row of data when it encounters a missing value, while the na.rm=TRUE argument will remove missing values separately from eac

Re: [R] dataframes from a function

2011-02-04 Thread Phil Spector
jects in your workspace, you could look at the help page for the assign function. - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley

Re: [R] tapply output as a dataframe

2011-02-03 Thread Phil Spector
Try as.data.frame(as.table(a)) - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley

  1   2   3   4   5   >