Displaying 20 results from an estimated 4000 matches similar to: "Cut including the 0 value as separate bin"
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
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
2011 Dec 06
2
To Try or to TryCatch, I have tried to long
So after about 4 hours struggling with Try and TryCatch I am throwing in the
towel. I have a more complicated function that used logspline through
iterative distributions and at some point the logspline doesnt function
correctly for some subsets but is fine with others so I need to be able to
identify when the error occurs and stop curtailing the distribution and I
think this Try or TryCatch
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
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 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 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
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 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
2010 Jun 03
2
Subsetting for unwanted values
Hi all,
I have toyed with this for too long today and in the past i used multiple
lines of code to get at what i want. Consider the following:
All i need to do is subset Pc to the values that do not equal Pc.X. The
first attempt doesnt work because i have unequal lengths. The second
attempt doesnt give me an the right answer.
2010 Mar 04
2
Removing colon from numerical data
Basic question, looked through the forum and documentation but didnt see a
solution.
So consider
O<-c(1:20)
D<-c("1:","2:","3:","4:","5:","6:","7:","8:","9:","10:","11:","12:","13:","14:","15:","16:",
2011 Jan 07
2
Dont show zero values in line graph
Hey everyone,
Im getting better at plotting my data but cant for the life of me figure
out how to show a line graph with missing data that doesnt continue the line
down to zero then back up to the remaining values.
Consider the following
x<-c(1:5,0,0,8:10)
y<-1:10
plot(0,0,xlim=c(0,10), ylim=c(0,10),type="n",main="Dont show the bloody 0
values!!")
lines(x~y,
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 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
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" =
2012 Jun 20
2
Using object as literal value in list vector
Hello all ,
This is a pretty simple question I think but cannot find an answer on the
list or in my brain. I would like to iterate through a loop and use a
vector of strings to name a number of list elements. For instance
#Create vector of strings
Et<- c("ACC","RTL","WHL")
MeanValues_ <- list("ACC" = 1000, "RTL" = 2000,
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"