Substituting the values on the y-axis

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Substituting the values on the y-axis

Emanuela
Hello,

I plotted a graph on R showing how salinity (in ‰, y-axis) changes with time(in
years, x-axis). However, right from the beginning on the Excel spreadsheet the v
alues for salinity appeared as, for example, 35000‰ instead of 35‰, which I gues
sed must have been a typing error for the website from which I extracted the dat
a (NOAA).Thus, I now would like to substitute these values with the correspondin
g smaller value, as it follows:

25000 35000-> 25, 35   and so on.

Is there any way I can change this on R or do I have to modify these numbers bef
ore inputting the data on R (for example on Excel)? If so, can anybody tell me h
ow to do either of these?

Many thanks!

Emanuela

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Substituting the values on the y-axis

Bert Gunter
Sounds like you have made no effort to learn R, e.g. by reading the
Intro to R tutorial packaged with R or other online tutorial (there
are many).

Don't you think you need to do some homework first?

-- Bert

On Mon, Jun 10, 2013 at 7:26 AM,  <[hidden email]> wrote:

> Hello,
>
> I plotted a graph on R showing how salinity (in ‰, y-axis) changes with time(in
> years, x-axis). However, right from the beginning on the Excel spreadsheet the v
> alues for salinity appeared as, for example, 35000‰ instead of 35‰, which I gues
> sed must have been a typing error for the website from which I extracted the dat
> a (NOAA).Thus, I now would like to substitute these values with the correspondin
> g smaller value, as it follows:
>
> 25000 35000-> 25, 35   and so on.
>
> Is there any way I can change this on R or do I have to modify these numbers bef
> ore inputting the data on R (for example on Excel)? If so, can anybody tell me h
> ow to do either of these?
>
> Many thanks!
>
> Emanuela
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



--

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Substituting the values on the y-axis

John Kane
In reply to this post by Emanuela

Just calculate a new sequence if those percentages are in an orderly sequence. See ?seq
 v  <-  seq(25, 200, by = 10)
or perhaps the values are actually  text
?substr
x  <-  substr(v, 1,2)

John Kane
Kingston ON Canada


> -----Original Message-----
> From: [hidden email]
> Sent: Mon, 10 Jun 2013 16:26:54 +0200 (CEST)
> To: [hidden email]
> Subject: [R] Substituting the values on the y-axis
>
> Hello,
>
> I plotted a graph on R showing how salinity (in ‰, y-axis) changes with
> time(in
> years, x-axis). However, right from the beginning on the Excel
> spreadsheet the v
> alues for salinity appeared as, for example, 35000‰ instead of 35‰, which
> I gues
> sed must have been a typing error for the website from which I extracted
> the dat
> a (NOAA).Thus, I now would like to substitute these values with the
> correspondin
> g smaller value, as it follows:
>
> 25000 35000-> 25, 35   and so on.
>
> Is there any way I can change this on R or do I have to modify these
> numbers bef
> ore inputting the data on R (for example on Excel)? If so, can anybody
> tell me h
> ow to do either of these?
>
> Many thanks!
>
> Emanuela
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

____________________________________________________________
FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your desktop!

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Substituting the values on the y-axis

Emanuela
In reply to this post by Emanuela
I did look into tutorials but I could not find the exact request I am looking
for. I just started using R so I am still a beginner.  If you then know
where I can find it, can you please redirect me to it




--
View this message in context: http://r.789695.n4.nabble.com/Substituting-the-values-on-the-y-axis-tp4669165p4669171.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Substituting the values on the y-axis

John Kane
Hi Emanuela,

Welcome to R

It can be hard finding even relatively simple things when you are just starting.  You might want to have a look at
http://www.unt.edu/rss/class/Jon/R_SC/ or http://www.burns-stat.com/documents/tutorials/impatient-r/ if ou have not already seen them.  Patrick Burn's site http://www.introductoryr.co.uk/R_Resources_for_Beginners.html has some useful links

If you are a refugee from SAS or SPSS, this paper by Bob Muenchen is very useful www.et.bs.ehu.es/~etptupaf/pub/R/RforSAS&SPSSusers.pdf

Some tricks for asking a good question in the R help list is here:
https://github.com/hadley/devtools/wiki/Reproducibility or  http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

In most cases it is very useful to provide some data. See ?dput in the last two links. A small bit of sample data in your original post would definately have helped.

Many or most R-help readers do not use nabble and really hate to have to go there to see the context of a message.  You should always leave the important parts of earlier messages to let the R-help reader see what the problems and other suggested solutions may be.

John Kane
Kingston ON Canada


> -----Original Message-----
> From: [hidden email]
> Sent: Mon, 10 Jun 2013 09:08:59 -0700 (PDT)
> To: [hidden email]
> Subject: Re: [R] Substituting the values on the y-axis
>
> I did look into tutorials but I could not find the exact request I am
> looking
> for. I just started using R so I am still a beginner.  If you then know
> where I can find it, can you please redirect me to it
>
>
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Substituting-the-values-on-the-y-axis-tp4669165p4669171.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

____________________________________________________________
FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family!
Visit http://www.inbox.com/photosharing to find out more!

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Substituting the values on the y-axis

Jim Lemon
In reply to this post by Emanuela
On 06/11/2013 12:26 AM, [hidden email] wrote:

> Hello,
>
> I plotted a graph on R showing how salinity (in ‰, y-axis) changes with time(in
> years, x-axis). However, right from the beginning on the Excel spreadsheet the v
> alues for salinity appeared as, for example, 35000‰ instead of 35‰, which I gues
> sed must have been a typing error for the website from which I extracted the dat
> a (NOAA).Thus, I now would like to substitute these values with the correspondin
> g smaller value, as it follows:
>
> 25000 35000->  25, 35   and so on.
>
> Is there any way I can change this on R or do I have to modify these numbers bef
> ore inputting the data on R (for example on Excel)? If so, can anybody tell me h
> ow to do either of these?
>
Hi Emanuela,
I think that the axis.mult function in the plotrix package will do what
you want with mult=0.001. Obviously you won't want to display the
transformation, so set mult.label="".

Jim

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.