similar to: converting character matrix to a dataframe

Displaying 20 results from an estimated 20000 matches similar to: "converting character matrix to a dataframe"

2003 Apr 02
19
Combining the components of a character vector
Dear Help, Suppose I have a character vector. x <- c("Bob", "loves", "Sally") I want to combine it into a single string: "Bob loves Sally" . paste(x) yields: paste(x) [1] "Bob" "loves" "Sally" The following function combines the character vector into a string in the way that I want, but it seems somewhat inelegant.
2002 Apr 23
3
Subsetting by a logical condition and NA's
I have run into a general problem with subsetting of which the following is a simple example. Suppose that x <- c(5, NA, 7, 5, NA, 3) y <- c(1, 2, 3, 4, 5, 6) I want to extract the values of y for which x = 5, but y[x==5] yields > y[x==5] [1] 1 NA 4 NA I find that y[!is.na(x) & x==5] yields the desired result: > y[!is.na(x) & x==5] [1] 1 4 but I am wondering whether
2003 Mar 22
1
extracting the names of the dataframe and variables in aov or lm
Dear R Users, I want to write a function that applies to the dataframe and variables that were used in a previous call to lm or aov. In order to do this, I need to write a function that applies to the output of lm or aov, and yields the names of the dataframe and variables that were used in the lm or aov analysis. For example, suppose that I give the command: aov.out <- aov( Rt ~
2002 Dec 20
2
vectorizing test for equality
Dear R Help, I am trying to create a boolean vector that is TRUE whenever a particular value occurs in a numeric vector, and FALSE otherwise. For example, suppose that > y <- c(5, 2, 4, 3, 1) > y [1] 5 2 4 3 1 and suppose that I want to find where 3 occurs in y. Then, the following yields the solution: > y == 3 [1] FALSE FALSE FALSE TRUE FALSE My problem arises when the
2001 Oct 31
3
t.test
Dear R-users, I am learning to use R 1.3.1 on a Pentium running Windows '98. I'm puzzled that several statistical procedures, t.test and chisq.test, do not appear to be available on R version 1.3.1. For example, if I type "t.test", I get the reply, "Object "t.test" not found". Is there a package that I have to load in order to have access to these
2002 Dec 22
4
pasting "\" into character strings
Dear R-Help, I'm using R version 1.6.0 on a Windows computer. I am trying to create a function that, among other things, constructs strings that refer to Windows files, e.g., I might want to construct a string like 'c:\work\part1.txt'. I have found that the following does not work. > paste("c:", "\", "work", "\", "part1.txt",
2002 Apr 19
4
Multidimensional scaling
A student of mine wants to use R to do some nonmetric multidimensional scaling. According to the R FAQ, there's a package called pcurve that computes multidimensional scaling solutions, but I was not able to locate it the contrib page (I am a Windows user with R version 1.4.1). Can anyone tell me whether it is possible to do nonmetric multidimensional scaling with R, and if so, how? John
2008 May 05
3
merge numerous columns of unequal length
I have numerous objects, each containing continuous data representing the same variable, movement rate, yet each having a different number of rows. e.g. d1<-as.matrix(rnorm(5)) d2<-as.matrix(rnorm(3)) d3<-as.matrix(rnorm(6)) How can I merge these three columns side-by-side in order to create a table regardless of the difference in length? I wish to analyze the output in a spreadsheet
2002 Oct 10
2
Environment variables under Windows
Greetings, I have a question pertaining to the concept of "environment variables" that is mentioned in the R documentation for "Startup" and also in the discussion of the Windows configuration of R in the recent book "An Introduction to R" authored by Venables, Smith, and the R Development Core Team (referred to as VS in this message). The Startup documentation and
2012 Apr 19
3
How to "flatten" a multidimensional array into a dataframe?
Hi, I have a three dimensional array, e.g., my.array = array(0, dim=c(2,3,4), dimnames=list( d1=c("A1","A2"), d2=c("B1","B2","B3"), d3=c("C1","C2","C3","C4")) ) what I would like to get is then a dataframe: d1 d2 d3 value A1 B1 C1 0 A2 B1 C1 0 . . . A2 B3 C4 0 I'm sure there is one function to do
2003 Oct 14
0
Job notice at the University of Washington
UNIVERSITY OF WASHINGTON FACULTY POSITION IN QUANTITATIVE PSYCHOLOGY The Department of Psychology seeks to fill a position in Quantitative Psychology at the tenure-track assistant professor level. In exceptional circumstances, appointment at the Associate Professor or Professor level may be considered for candidates who offer extraordinary opportunities to further the University's
2003 Feb 12
2
rbind.data.frame: character comverted to factor
Dear All, on rbind:ing together a number of data.frames, I found that character variables are converted into factors. Since this occurred for a data identifier, it was a little inconvenient and, to me, unexpected. (The help page explains the general procedure used. I also found that on forming a data frame, character variables are converted to factors. The help page on read.table has the
2008 Jun 21
1
question on rgl.surface
I'd like to use rgl.surface (or some other function if more appropriate) to create a horizontal and vertical transparent grey slice (plane) running through both the x and y origins and extending across the z axis, i.e. the 3-d equivalent of the normal 2-d coordinate axes we are all familiar with. The examples for rgl.surface are a bit more complex than what I need and I am having trouble
2009 Feb 22
2
how to recover a list structure
I am experiencing some problems at working with lists at high level. In the following "coef" contains the original DWT coefficients organized in a list. Thorugh applying the following two commands: coef.abs <- lapply(unlist(coef,recursive=FALSE,use.names =TRUE),abs) coef.abs.sorted <- sort(unlist(coef.abs),decreasing=TRUE) I get vector "coef.abs.sorted" containing
2008 Jun 03
3
How to solve a non-linear system of equations using R
Dear R-list members, I've had a hard time trying to solve a non-linear system (nls) of equations which structure for the equation i, i=1,...,4, is as follows: f_i(d_1,d_2,d_3,d_4)-k_i(l,m,s) = 0 (1) In the expression above, both f_i and k_i are known functions and l, m and s are known constants. I would like to estimate the vector d=(d_1,d_2,d_3,d_4) which is solution
2011 Feb 06
3
manipulate dataframe
Hello, Can someone give me hint to change a data.frame. I want to split a column in more columns depending on the value of a other column. Thanks for the reaction, Andre Example: > dat x1 x2 1 1 a 2 1 b 3 1 c 4 2 d 5 2 e 6 2 f 7 3 g 8 3 h 9 3 i in > dur d1 d2 d3 1 a d g 2 b e h 3 c f i [[alternative HTML version deleted]]
2009 May 25
2
apply fn to many dataframes
Hi, Say I have dataframes d1, d2, ... , dn, and I want to apply a function to all of them. For example, say I want to change the name of the second variable in each dataframe to "x2". The following doesn't work: a = list(d1,d2,d3,d4) lapply(a,function(x) names(x)[2] = "x2") What would work? Thanks for any help.
2015 Oct 27
3
pregunta
Estimados Cuando existia epicalc, había una manera muy fácil de determinar la media de una variable (en esta caso Gain) por grupos, en este caso (Diet). ?Como se puede hacer ahora? Diet Gain 1 d1 270 2 d1 300 3 d1 280 4 d1 280 5 d1 270 6 d2 290 7 d2 250 8 d2 280 9 d2 290 10 d2 280 11 d3 290 12 d3 340 13 d3 330 14 d3 300 15 d3 300
2017 Oct 30
2
Problems in communication with Mustek PowerMust 1060 LCD
System: Cenots Linux 6.9 Application: nut-2.7.5-0.20170613gitb1314c6 [with usb 0.1 from distro] Device: Mustek PowerMust 1060 LCD Comunication log file: dump.txt We are looking at the possibility of successful communicating with this device UPS Mustek PowerMust 1060 LCD. PS: wolfy on the list gives me assistance and i can install any new compiled nut version from sources. Thanks, Catalin.
2015 Oct 27
2
pregunta
Otras variantes con y sin paquetes adicionales... > sapply(split(datIn$Gain, as.factor(datIn$Diet)), mean) d1 d2 d3 280 278 312 > by(datIn$Gain, datIn$Diet, mean) datIn$Diet: d1 [1] 280 -------------------------------------------------------------- datIn$Diet: d2 [1] 278 -------------------------------------------------------------- datIn$Diet: d3 [1] 312 > > library(dplyr) >