I want to use question numbers from my survey data (fake data below) as markers in a scatterplot. I'm using "as.character" to convert question numbers to characters. However, plot truncates the 0 (zero) off of question 10. How can I get the ending zero so I can add questions 11 - 20? # Sample code below Question <- c(1,2,3,4,5,6,7,8,9,10) Performance <- c(3.5,3.6,3.7,3.8,3.9,4,4.1,4.2,4.3,4.4) Importance <- c(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,0.99) Survey <- data.frame(cbind(Question,Performance,Importance)) nums <-as.character(Question) plot(Performance, Importance, xlab='Graph', ylab='',pch=nums, axes=T) Thanks in advance for your help. ~Nick
Nick Drew wrote:> > I want to use question numbers from my survey data > (fake data below) as markers in a scatterplot. I'm > using "as.character" to convert question numbers to > characters. However, plot truncates the 0 (zero) off > of question 10. How can I get the ending zero so I can > add questions 11 - 20? > > # Sample code below > Question <- c(1,2,3,4,5,6,7,8,9,10) > Performance <- > c(3.5,3.6,3.7,3.8,3.9,4,4.1,4.2,4.3,4.4) > Importance <- > c(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,0.99) > Survey <- > data.frame(cbind(Question,Performance,Importance))Change the plot commands to this:> nums <-as.character(Question) > plot(Performance, Importance, xlab='Graph', ylab='', axes=T, type = "n") > text(Performance, Importance, nums)The inclusion of the rest of the question numbers, 11-20, can be done identically. hth, Julian -- --- Julian Taylor phone: +61 8 8303 6751 ARC Research Associate fax: +61 8 8303 6761 BiometricsSA, mobile: +61 4 1638 8180 University of Adelaide/SARDI email: julian.taylor at adelaide.edu.au Private Mail Bag 1 www: http://www.BiometricsSA.adelaide.edu.au Glen Osmond SA 5064 "There is no spoon." -- Orphan boy ---
On Mon, 28-Jun-2004 at 09:37PM -0700, Nick Drew wrote: |> I want to use question numbers from my survey data |> (fake data below) as markers in a scatterplot. I'm |> using "as.character" to convert question numbers to |> characters. However, plot truncates the 0 (zero) off |> of question 10. How can I get the ending zero so I can |> add questions 11 - 20? |> |> # Sample code below |> Question <- c(1,2,3,4,5,6,7,8,9,10) |> Performance <- |> c(3.5,3.6,3.7,3.8,3.9,4,4.1,4.2,4.3,4.4) |> Importance <- |> c(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,0.99) |> Survey <- |> data.frame(cbind(Question,Performance,Importance)) |> |> nums <-as.character(Question) |> plot(Performance, Importance, xlab='Graph', |> ylab='',pch=nums, axes=T) Try this instead: plot(Performance, Importance, xlab='Graph', ylab='',pch=" ", axes=T, adj = 0) text(Performance, Importance, text=nums) HTH -- Patrick Connolly HortResearch Mt Albert Auckland New Zealand Ph: +64-9 815 4200 x 7188 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ I have the world`s largest collection of seashells. I keep it on all the beaches of the world ... Perhaps you`ve seen it. ---Steven Wright ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~