Displaying 20 results from an estimated 2000 matches similar to: "Subset"
2017 Sep 25
2
Subset
myDF <- data.frame(a = c("<0.1", NA, 0.3, 5, "Nil"),
b = c("<0.1", 1, 0.3, 5, "Nil"),
stringsAsFactors = FALSE)
# you can subset the b-column in several ways
myDF[ , 2]
myDF[ , "b"]
myDF$b
# using the column, you make a logical vector
! is.na(as.numeric(myDF$b))
# This can be used to select the
2017 Sep 22
3
Subset
Super,
Thanks
On Fri, Sep 22, 2017 at 4:57 PM, Boris Steipe <boris.steipe at utoronto.ca>
wrote:
> > a <- c("<0.1", NA, 0.3, 5, "Nil")
> > a
> [1] "<0.1" NA "0.3" "5" "Nil"
>
> > b <- as.numeric(a)
> Warning message:
> NAs introduced by coercion
> > b
> [1] NA NA 0.3
2017 Sep 25
1
Subset
Always via logical expressions. In this case you can use the logical expression
myDF$b != "0"
to give you a vector of TRUE/FALSE
B.
> On Sep 25, 2017, at 8:00 AM, Shane Carey <careyshan at gmail.com> wrote:
>
> This is super, really helpfull. Sorry, one final question, lets say I wanted to remove 0's rather than NAs , what would it be?
>
> Thanks
>
2017 Sep 25
0
Subset
Hi,
Lets say this was a dataframe where I had two columns
a <- c("<0.1", NA, 0.3, 5, "Nil")
b <- c("<0.1", 1, 0.3, 5, "Nil")
And I just want to remove the rows from the dataframe where there were NAs
in the b column, what is the syntax for doing that?
Thanks in advance
On Fri, Sep 22, 2017 at 5:04 PM, Shane Carey <careyshan at
2017 Sep 25
0
Subset
This is super, really helpfull. Sorry, one final question, lets say I
wanted to remove 0's rather than NAs , what would it be?
Thanks
On Mon, Sep 25, 2017 at 12:41 PM, Boris Steipe <boris.steipe at utoronto.ca>
wrote:
> myDF <- data.frame(a = c("<0.1", NA, 0.3, 5, "Nil"),
> b = c("<0.1", 1, 0.3, 5, "Nil"),
>
2017 Sep 22
0
Subset
> a <- c("<0.1", NA, 0.3, 5, "Nil")
> a
[1] "<0.1" NA "0.3" "5" "Nil"
> b <- as.numeric(a)
Warning message:
NAs introduced by coercion
> b
[1] NA NA 0.3 5.0 NA
> b[! is.na(b)]
[1] 0.3 5.0
B.
> On Sep 22, 2017, at 11:48 AM, Shane Carey <careyshan at gmail.com> wrote:
>
> Hi,
2013 Sep 26
1
R not ploting lines in the correct order
Hi,
I have a set of x, y points where x represents dates and y actual values. I
am trying to plot a line graph of the data with points on top, but R is
connecting the wrong points with lines. Does anyone know how I can rectify
this. Please see sample below:
x=
24/09/2009 09:13 16/10/2009 11:17 24/10/2009 21:43 11/09/2009
18:34 22/08/2009
15:45 10/08/2009 00:30 14/08/2009 14:52 24/09/2009
2013 Mar 26
6
How do I show real values on a log10 histogram
Hi,
I have a histogram with values logged to the base 10
hist(log10(x),breaks=60)
How do I show the log values on the x-axis and a second x-axis showing the
real values?
Thanks
--
Shane
[[alternative HTML version deleted]]
2013 Jun 26
3
XYZ data
I have x, y, z data. The x, y fields dont change but Z does. How do I add a
very small number onto the end of each x, y data point.
For example:
Original (X) Original (Y) Original (Z)
15 20 30
15 20 40
New (X) New (Y)
2013 Apr 11
4
%*%
What does these operators do: %*%
Thanks
--
Shane
[[alternative HTML version deleted]]
2017 Sep 26
0
censtats from the NADA package
Hi,
Has anyone ever used the censtats from the nada package and carried it out
per group on a dataframe?
I have it working on the entire dataframe but I need to do it by group.
Thanks
--
Le gach dea ghui,
*Shane Carey*
*GIS and Data Solutions Consultant*
[[alternative HTML version deleted]]
2013 Mar 29
4
How do you graph data when you have lots of small values but few extremely large values?
I was thinking of splitting the y-axis into two? Is this possible?
Thanks
--
Shane
[[alternative HTML version deleted]]
2013 Apr 03
3
Superscript
Hi,
How do I write a superscript within gsub?
I have the following: gsub("_mgkg",expression(paste("mg kg"^{-1})),names[1])
Thanks
--
Shane
[[alternative HTML version deleted]]
2013 Mar 29
2
0e+00
Hi,
Rather than a graph label to display labels as 0e+00, how do I get it to
display the real value?
Thanks
--
Shane
[[alternative HTML version deleted]]
2013 Mar 27
2
find and replace characters in a string
Hi,
I have a string of text as follows "LOI ."
How do I replace the dot with "(%)"
gsub(".","(%)",LOI .)
gives
"(%)(%)(%)(%)(%)"
Thanks
--
Shane
[[alternative HTML version deleted]]
2013 Apr 02
1
read.delim
Hi,
Im reading in a .txt file into R that consists of 5 columns, however, when
imported into R, it reads all the data into just one column. Is there a way
of telling R to create a dataframe with 5 columns rather than putting all
the data into one column?
Thanks
--
Shane
[[alternative HTML version deleted]]
2013 Mar 28
2
Can R read in .xyz files
Hi,
Can R read in .xyz files? If so, what is the package,
thanks
--
Shane
[[alternative HTML version deleted]]
2013 Jun 23
1
Fault geology xyz to raster
Hi,
I have a 3-d geology problem. I have an xyz fault data set. I am able to
view the data set in R using plot3-d but cannot create a raster from it. I
need to create a raster and export so that it can be read in arcscene. Can
anybody help?
Thanks
--
Shane
[[alternative HTML version deleted]]
2013 Mar 19
2
Cumulative Frequency Graph
Hi,
I am trying to create a Cumulative Frequency graph and I am using the
following example:
http://www.r-tutor.com/elementary-statistics/quantitative-data/cumulative-frequency-graph
When I plot this data, how do I put in "real values" on the x-axis, rather
than the values that
are used for the breaks
Thanks
--
Shane
[[alternative HTML version deleted]]
2013 Mar 25
2
%*% what does this mean
Hi
I was working with a script and I came across this %*%. What does this mean?
Thanks
--
Shane
[[alternative HTML version deleted]]