Displaying 20 results from an estimated 8000 matches similar to: "Subsetting for unwanted values"
2011 Sep 07
1
Subsetting does not remove unwanted data in table
Dear all,
This relatively routine analysis has left me frustrated and in a rut. I
have a dataset (data1), which I subset in order to remove rows where
HabitatDensity="Med". This dataset looks correct when I call it up,
however, when I create a table out of the new subset (data2), my table
continues to show the "Med" information as 0.
This is a problem because I need a
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 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 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
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
2012 Jan 19
8
sumarizar
*Hola!!! resulta que tengo unos datos de divisas ordenados por fechas
(días) los que he convertido a formato tipo YYYY-MM-DD donde DD siempre es
01:*
*
*
*
EUR.resto$date<-as.Date(EUR.resto$date)
EUR.resto$mo <- substr(EUR.resto$date,6,7)
EUR.resto$yr <- substr(EUR.resto$date, 1,4)
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
2010 Aug 09
4
Pie Chart in map
Hey R'rs,
So im sick of dealing with ESRI products and am looking to stream line a
process i now use GIS to do using R. I have made a lot of maps using R but
have not yet seen a map that puts pie charts within the map to help
represent data like the attachment.
http://r.789695.n4.nabble.com/file/n2318816/template1.bmp
I found Tanimura et al. work "Proportional Symbol Mapping in
2011 May 17
4
Summarize by two or more attributes
Okay everyone heres a likely softball for someone.
Consider the following data frame:
#Create data
x<-rep(c(1,15),10)
y<-rnorm(20)
z<-c(rep("auto",10),rep("bus",10))
a<-rep(c(1,1,2,2,3,3,4,4,5,5),2)
#Create Data frame
Df<-data.frame(Source=x,Rate=y,Bin=a,Type=z)
I want to create a new column the equals the sum of the Rates for each type
(1,15) by Bin.
A
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 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,
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,
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 Mar 22
2
Loading mdb
Well im thoroughly frustrated after 25 minutes of checking and rechecking my
path. What do i not know about loading a mdb that is keeping me from
loading my data.
i have loaded the Hmisc library and pointed it too my data using mdb.get and
continue to get the following error.
Error in system(paste("mdb-tables -1", file), intern = TRUE) :
'mdb-tables' not found
Which i
2001 Jul 02
1
text.rpart: Unwanted NA labels on terminal nodes (PR#1009)
Brian
The following (which is new to rw1030) occurs with both
Windows 98 & Windows ME. I have not tested behaviour
under Unix or Linux, but I expect it is no different.
text.rpart() prints unwanted NAs (presumably in the
splitting criterion position) on terminal nodes.
Criterion <- factor(paste("Leaf", 1:5))
Node <- factor(1:5)
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 Dec 02
1
speeding up likelihood computation
R Users:
I am trying to estimate a model of fertility behaviour using birth history data with maximum likelihood. My code works but is extremely slow (because of several for loops and my programming inefficiencies); when I use the genetic algorithm to optimize the likelihood function, it takes several days to complete (on a machine with Intel Core 2 processor [2.66GHz] and 2.99 GB RAM). Computing
2010 Sep 13
2
proportion
Hi ,
SO i have been on a role of asking simple questions lately. So much for
feeling like im getting this R business.
I wrote a script 2 weeks ago that utilized "proportion" to turn values in a
table (from "table") into proportions to then graph. I now get an error
that proportion is not a function so im confused. I ran the script a few
times and im thinking maybe i had