Displaying 20 results from an estimated 2000 matches similar to: "creating more vectors out of one"
2012 Feb 14
2
save objects of own function to workspace
Dear R-helpers,
I created an own function which looks like this
s_elternmz <- function(Var="balt")
{
Dg_a<-mz[,c("asbhh","apkz",Var)]
colnames(Dg_a)[colnames(Dg_a)=="apkz"]<-"bpkzm"
colnames(Dg_a)[colnames(Dg_a)==Var]<-paste(Var,"_m",sep="")
2012 Apr 12
3
Reading SPSS: underlying numerical codes
Dear people,
I have got a question concerning the underlying numerical codes when
reading an SPSS file into R.
I used the package foreign and when I look at a variable I get the verbal
codes.
I would like to know how it is possible to get the underlying numerical
codes as output, which are the same as in my SPSS file.
Thank you very much in advance for your help!
Marion
[[alternative HTML
2012 Jul 25
1
Memisc package: imported varibles from SPSS have got wrong measurement
Dear list members,
I have got another problem. I imported an SPSS file with the Memisc package
using the following commands:
mz <- spss.system.file("myspssfile.sav")
mz <- subset(mz,select=c(
bsex,balt,xurb,dtaet,kartab,bgeb,boseit,bgeblan,xnuts2,kausb,xerwstat,
asbper,asbhh,ajahr,aquartal,bstaat,xwieoft,gew1,apkz,bpkzm,bpkzv))
Afterwards I checked the measurements of the
2012 Jan 31
3
function: as.integer
dear r-helpers,
i created an object named A, which looks like this:
A <- c("4.4","1.9","4.1")
now i needed to get numbers instead of characters and for this i used the
function:
as.integer(A)
which resulted in:
[1] 4 1 4
My question is, why the numbers are rounded or more impotantly if
there is a way to keep the decimal numbers?
Thank you very much for
2011 Sep 20
4
open source editor for r for beginners
Hello all,
I am looking for an editor for R which has got functions beyond the normal R
editor that is included in the program.
I had a look at VIM but I think it's difficult if you are just starting
programming.
Could anyone recommend an editor that is suitable for beginners?
Thanks for your help.
Marion
[[alternative HTML version deleted]]
2011 Sep 16
3
writing data from several matrices in R into one excel-file with several sheets
hello,
does anyone know how I can write several matrices from R into one exel-file
using different sheets for the different matrices?
thank you very much in advance for your help.
Marion
[[alternative HTML version deleted]]
2011 Oct 11
2
binding all elements of list (character vectors) to a matrix as rows
dear r-users,
i have got a problem which i am trying to solve:
i have got the following commands:
Mymatrix <- matrix(1:9,ncol=3)
Z <-
list("V1"=c("a","",""),"V2"=c("b","",""),"V3"=c("c","",""),"V4"=c("d","",""))
Mymatrix <-
2011 Sep 16
2
automatic selection of object without loop
Hello,
does anyone know the solution to this problem:
I imported a dataframe from Spss into R and saved it as an object called
"kinderrechte".
I have got the following command lines:
q1 <- kinderrechte[,"q0007_0001"]
l1 <- q0007_0001_l
now i would like to be able to change the column name in the first command
line (e.g. into q0007_0002) and to get R to automatically
2012 Jan 02
2
syntax for reading into R
dear users,
we have got the following question:
we have got a text-file looking like this:
...
<trkpt lat="48.272000" lon="16.342984">
<ele>387</ele>
<time>2012-01-01T15:32:03Z</time>
<sat>9</sat>
</trkpt>
<trkpt lat="48.271909" lon="16.343563">
<ele>381</ele>
2012 Jan 16
3
list: index of the element, that is TRUE
Dear People,
I have got the following example for a vector and the index of the TRUE
element:
Myvector <- c(FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE)
which(Myvector)
Now I would like to find out the same for a list:
Mylist <- list(FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE)
...
Does anyone know how to do this?
Thank you very much in advance,
Marion
[[alternative HTML
2011 Dec 09
3
ggplot with geom_tile
Dear R-users,
I am trying to make a plot with ggplot-geom_tile(), but cannot remove some unwanted (white) lines through my plot.
Below a reproducible example:
#####
library(ggplot2)
tot=as.data.frame(rep(seq(-50,50,5),each=21))
names(tot)="precip"
temp=rep(seq(-5,5,0.5),21)
tot$temp=temp
disc=array(dim=c(21,21))
for(i in 1:21){
for(y in 1:21){
temp<-
2011 Sep 30
2
ggplot2 - extracting values of smooth
Suppose that I'm working on Hadley's diamond dataset and I want to
review the relationship between price, colour and carat.
I might run the following:
library(ggplot2)
#plot scatter and add some hex binning
q<-qplot(carat,price,data=diamonds, geom=c("hex"),
main="Variability of Diamond Prices by Carat and Colour")
#facet to get one scatter for
2012 Jul 24
3
package memisc: recode examples
Dear people,
Yesterday I looked at the recode command in the memisc package and ran the
following example stated in the manual:
x <- as.item(sample(1:6,20,replace=TRUE),
labels=c( a=1,
b=2,
c=3,
d=4,
e=5,
f=6))
print(x)
f <- as.factor(x)
f
recode(f,
2011 Sep 19
2
pasting elements of one character vector together
hello,
i am familiar with the paste command with which i can paste for exaple:
object <- "Hello"
paste(object,"World")
now i would like to be able to paste all the elements of the same vector
together e.g:
object <- c("Hello","World")
getting as a result also:
"Hello World".
Does anyone know the solution to this problem?
Thank you
2011 Aug 10
3
plot 3d info in 2d
Hi Listers,
Is it possible to produce an ordination plot in 2d, where bubbles represent
the location of sites (this part is easy enough) and the size of the bubbles
is proportional to the sites location in 3d space (I am stuck on this
option). So sites that are very near the 2d plane of the xy axes would be
larger while sites that are actually further away in 3 d space would be
proportionally
2011 Aug 24
3
ddply from plyr package - any alternatives?
Hello everyone,
I was asked to repost this again, sorry for any inconvenience.
I'm looking replacement for ddply function from plyr package.
Function allows to apply function by category stored in any column/columns.
Regular loops or lapplys slow down greatly because my unique combination
count exceeds 9000. Is there any available solution which allow me to apply
function by category?
2011 Sep 15
1
Courses in R
Hello,
I have a question concerning courses in R in *Vienna, Austria*.
Does anyone know where courses in R are offered, that you can do after
having attended a course for the basics?
Thanks in advance for your help.
Marion
[[alternative HTML version deleted]]
2012 Feb 20
3
Run function several times changing only one argument - without a loop
Dear people,
I created a plot which looks like this:
Ee1<-matrix(c(88,86,74,62,41),ncol=5)
colnames(Ee1)<-c("Lehrer","Lehrerinnen","Klassenkollegen","Klassenkolleginnen","Geschwister")
par(las=1)
par(mar=c(5,13,4,2))
barplot(Ee1,horiz=T,col="grey85",border="NA",xlim=c(0,100),axes=F)
axis(2,pos=10, tick=T, tcl=F,
2012 Feb 16
2
import .csv file into R
Dear r-helpers,
I read a .csv file into R
with the following command:
A<-read.csv2(file="Mappe3.csv")
It worked fine, except that I would like to get rid of the points between
the words and get spaces instead like I have got in the .csv file.
At the moment it looks like the following:
habe.mich.gut.mit.KlassenkollegInnen.verstanden
hatte.gutes.Verhältnis.zu.Eltern
2011 Sep 09
2
prcomp: results with reversed sign in output?
Dear All,
when I'm running a PCA with
prcomp(USArrests, scale = TRUE)
I get the right principal components, but with the wrong sign infront
Rotation:
PC1 PC2 PC3 PC4
Murder 0.5358995 -0.4181809 0.3412327 0.64922780
Assault 0.5831836 -0.1879856 0.2681484 -0.74340748
UrbanPop 0.2781909 0.8728062 0.3780158 0.13387773
Rape 0.5434321 0.1673186 -0.8177779 0.08902432
instead of
PC1 PC2 PC3 PC4