similar to: To Try or to TryCatch, I have tried to long

Displaying 20 results from an estimated 1000 matches similar to: "To Try or to TryCatch, I have tried to long"

2012 Oct 11
3
Sorting a data frame by specifying a vector
Hello all, I cannot seem to figure out this seemingly simple procedure. I want to sort a data frame by a specified character vector. So for : df.. <- data.frame(Season=rep(c("Summer","Fall","Winter","Spring"),4),Obs= runif(length(rep(c("Summer","Fall","Winter","Spring"),4)))) I want to sort the data frame
2012 Feb 06
5
I bet apply has a solution
Hi all For the data below, I would like to return a logical value indicating differences in the data. #Create data Data..<-data.frame(a=rep(1,10),b=c(rep(1,9),2),c=c(rep(1,8),2,2)) a b c 1 1 1 1 2 1 1 1 3 1 1 1 4 1 1 1 5 1 1 1 6 1 1 1 7 1 1 1 8 1 1 1 9 1 1 2 10 1 2 2 So what I want is to return logical value telling me if all the values are the same. So the result would be a b
2010 Nov 29
3
List elements of NULL to value
Hi everyone, I am posting this because i know its easy and i cant for the life of me figure out how to do it though i have tried and through a ridiculously complex loop made it happen. I need to convert some list elements of NULL value to 0s so they mesh with my data frame properly. So for A<-list(1,NULL) returns [[1]] [1] 1 [[2]] NULL Would instead return [[1]] [1] 1 [[2]] [1] 0
2000 Dec 19
1
packages installation failed on Linux
Hi all, I've successfully compiled R-1.2 on a Linux box (Mandrake 7.1). However, when I installed packages from sources, I run into problems with the packages logspline and tseries. The error messages are as follows. Can anyone help? The compiler is gcc 2.95.3, if that helps. Andy ================================================ Installing source package `logspline' ... libs gcc
2010 Jan 12
5
Drop last numeral
Hello all, Frustrated and i know you can help I need to drop the last numeral of each of my values in my data set. So for the following i have tried the ?substring but since i have to specify the length, but because my data are of varying lengths it doenst work so well Data<-c("1131", "1132", "1731" ,"1732" ,"1821" ,"1822",
2010 Jan 25
3
Issue using tapply
Hello all, I am trying to use the tapply function to sum some values and change the column names of the resulting vector. I input Emp Et 1 10565 ACC 2 7515 ADM 3 625 AGF 4 6243 CNS 5 12721 EDU 6 3924 FIN 7 18140 HLH 8 3686 INF 9 15841 MFG 10 243 MIN 11 1864 MNG 12 4664 OSV 13 5496 PRF 14 4988 PUB 15 2166 REC 16 2153 REL 17 16082 RTL 18 3582 TRN 19 757 UTL 20
2007 May 31
1
R keeps crashing when executing 'rlogspline'
Dear List, I have a simple model as follows: x <- rnorm(500) library(logspline) fit <- logspline(x) n <- 1000000 y <- replicate(n, sum(rlogspline(rpois(1,10), fit))) # last line The problem I keep getting is R crashes when doing the last line. It seems to be fine if n is small, but not if n is 1000000. The message I keep getting is: "R for Windows GUI front-end has
2010 Oct 28
4
Alter character attribute
Hi everyone I have some records that include a date attribute for the date and time but i need to separate the data and analyze it separately in GIS by Month and Year, so i need to pull these attributes out and create their own attribute field. So the input: RawData2.. returns ID period_end_date 1 22 9/10/2007 0:00:00 2 44 2/2/2006 0:00:00 and i need to get ID period_end_date
2010 Mar 10
1
trouble getting multinimial logit model to work properly
Greetings all, please consider the following data: #Build Data frame Slope<-c(1.291370, 12.208500, 2.110930, 0.578990, 5.019520, 0.807444, 0.554079 , 1.257080, 0.241504 , 0.184337 , 0.383044 , 0.342021) Exposure<-c(790.54, 1167.79 , 845.58 , 1082.47 , 1189.61 , 677.17 , 2058.56 , 469.09 , 112.02 , 803.31 , 254.14 ,1336.16) FwyDist<-c(11809.4222 ,10623.0458, 12279.6271,
2010 Sep 13
1
Transforming character vector
Hi guys, Cant seem to find a solution for this. I am looking for a substitute for cut that can transform character vectors. So as cut would be used below to transform YearCat-> YearCat2 base on Year and vector Ag<-c("00-'70","'71-'75","'76-'85","'86-'09") using 'cut '
2010 Oct 26
1
Cut including the 0 value as separate bin
Hi everyone, I have been using R too long to have to ask this but here i am. How do i create a separate bin for the 0 value? So for: #Create data frame DF<-data.frame(A=0:20) #Create label vector labs<-1:6 #Create buckets and label DF$Cut<-cut(DF$A,c(0,4,8,12,14,16,20),labels=labs,include.lowest=TRUE) I want the 0(zero) value to be in a separate bin. Sorry for the lame post...
2010 Feb 23
1
select row based on highest value
Please consider the following #Data to use Props<-c("p754921","p754921" ,"p754921","p75506" ,"p75506" ,"p75506","p75506","p75508","p75508","p75508","p75508","p75508") TAZ<-c(38,37,37,171,171,282,171,46,46,169,169,169) Area<-c(109828.04, 128134.71, 46469.57,
2010 Jun 07
1
Transforming list to data frame with corresponding columns
Hi all, Consider the following. a<-list(c("MHsub","MHsub","SFD","Duplex")) b<-list(c("MHsub","MHsub","SFD")) c<-list(c("MHpark","SFD","SFD")) d<-list(c("MultiFam","MultiFam","MultiFam","Duplex")) all<-list(a,b,c,d)
2010 Aug 23
1
Plotting multiple histograms on same panel
Hey everyone, So i cant figure this out. when using histogram() from lattice instead of hist() i get what i want as far as output. But using histogram i can seem to be able to figure out how to get multiple plots on the same panel. So par(mfrow=c(3,2)) for (i in 1:20) hist(rnorm(100),main="",cex.axis=.8) gets me about what i want but i want to use histogram() cause it gives
2010 Jan 27
1
returning a list of functions
Hi interested readers, I have a function that creates several functions within a loop and I would like them to be returned for further use as follows: Main.Function(df,...){ # df is a multivariate data funcList<-list(NULL) for (i in 1:ncol(df)){ temp<-logspline(df[,i],...) # logspline density estimate funcList[[i]]<-function(x){expression(temp,x)} } return(funcList) } I have tried
2012 Nov 29
1
Coerce rownames to factor for ordering
Hi all, I think this might be an easy one but I cannot think of a way to do this other than what I am currently attempting. I simply want to sort my data frame's rownames by a defined vector so that the plots I generate from that vector are in the desired order Consider the test data below: #Create test data DataToPlot.. <- data.frame("Location1" =
2010 Feb 22
1
matching on two criteria
Howdy y'all, I am looking to use the match function to match a data attribute to another data frame but i need it to do so on two criteria to ensure an appropriate match. The following matches incorrectly. I know the example looks pointless but its just an example. Perhaps there is another way of doing this? Thanks #Sample Data Props<-c("p754921","p754921"
2011 Sep 01
3
Oh apply functions, how you confuse me
Hi guys, I have a crap load of data to parse and have enjoyed creating a script that takes this data and creates a number of useful graphics for our area. I am unable to figure out one summary though and its all cause I dont fully understand the apply family of functions. Consider the following: #Create data
2011 Dec 01
2
Summarizing elements of a list
Hi everyone, I looked around the list for a while but couldn't find a solution to my problem. I am storing some results to a simulation in a list and for each element i have two separate vectors(is that what they are called, correct my vocab if necessary). See below Version1_<-list() for(i in 1:5){ Version1_[[i]]<-list(First=rnorm(1),Second=rnorm(1)) } What I want is to put all
2011 Jun 22
1
Appending to list
So im here now b/c im incredibly frustrated. Please consider the following: #Try 1 Data_<-list() Sn<-1:12 for(sn in Sn){ for(i in 1:10){ Data.X <- rnorm(100,0,10) Data_[[paste(sn,i,sep="-")]]<-Data.X } } ##Try 2 Data_<-list() Sn<-1:12 for(sn in Sn){ for(i in 1:10){ Data.X <- rnorm(100,0,10) Data_[[sn]][[i]]<-Data.X } } In Try 1 i am able to append