Displaying 7 results from an estimated 7 matches for "new_mat".
Did you mean:
new_map
2009 Feb 10
2
Problem with retrieving updated variables after attach()
...NA
5 NA NA
Then I attach the data frame:
> attach(mat)
I assign some new values...
> id <<- sample(100,5)
> age <<- rnorm(5,mean=30)
Then I want to create a new data frame from the variables id and age which still are attached to position 2 of the R environment...
> new_mat <- data.frame(ls(pos=2)) # I want to rescue ALL variables that were created by attach(mat)
> new_mat
ls.pos...2.
1 age
2 id
But this leads to a bogus object... how can I rescue the updated id and age values into new_mat?
Regards,
David
--
Jetzt 1 Monat kostenlos! GMX...
2011 Jun 30
2
volcano plot.r
...ot;, sep=",", row.names=1, header=TRUE)
# Get groups information
groups<-data[,1]
# Get levels for groups
grp_levs<-levels(groups)
if (length(levels(groups)) > 2)
print("Number of groups is greater than 2!") else {
#
# Split the matrix by group
#
new_mats<-c()
for (ii in 1:length(grp_levs))
new_mats[ii]<-list(data[which(groups==levels(groups)[ii]),])
#
# Calculate the means
#
# For each matrix, calculate the averages per column
submeans<-c()
# Preallocate a matrix for the means
means<-matr...
2011 Jun 20
2
(no subject)
...ot;, sep=",", row.names=1, header=TRUE)
# Get groups information
groups<-data[,1]
# Get levels for groups
grp_levs<-levels(groups)
if (length(levels(groups)) > 2)
print("Number of groups is greater than 2!") else {
#
# Split the matrix by group
#
new_mats<-c()
for (ii in 1:length(grp_levs))
new_mats[ii]<-list(data[which(groups==levels(groups)[ii]),])
#
# Calculate the means
#
# For each matrix, calculate the averages per column
submeans<-c()
# Preallocate a matrix for the means
means<-matr...
2018 May 22
0
remove rows of a matrix by part of its row name
...row indices and then subset with a *negative* index
to remove those rows.
rn <- scan(what = character(), text = "
70/556
71.1/280
72.1/556
72.1/343
73.1/390
73.1/556
")
mat <- matrix(rnorm(6*6), nrow = 6)
row.names(mat) <- rn
inx <- grep("73\\.", row.names(mat))
new_mat <- mat[-inx, ]
new_mat
Hope this helps,
Rui Barradas
On 5/22/2018 11:48 AM, Ahmed Serag wrote:
> Dear R-experts,
>
>
> How can I remove a certain feature or observation by a part of its name. To be clear, I have a matrix with 766 observations as a rows. The row names are like t...
2018 May 22
4
remove rows of a matrix by part of its row name
Dear R-experts,
How can I remove a certain feature or observation by a part of its name. To be clear, I have a matrix with 766 observations as a rows. The row names are like this
70/556
71.1/280
72.1/556
72.1/343
73.1/390
73.1/556
Now I would like to remove all the rows that contain the text 73.1
Any ideas or suggestion please ?
Regards
**********************
Ahmed Serag
Analytical
2018 May 22
0
remove rows of a matrix by part of its row name
...> rn <- scan(what = character(), text = "
> 70/556
> 71.1/280
> 72.1/556
> 72.1/343
> 73.1/390
> 73.1/556
> ")
>
> mat <- matrix(rnorm(6*6), nrow = 6)
> row.names(mat) <- rn
>
> inx <- grep("73\\.", row.names(mat))
>
> new_mat <- mat[-inx, ]
> new_mat
>
>
> Hope this helps,
>
> Rui Barradas
>
> On 5/22/2018 11:48 AM, Ahmed Serag wrote:
>> Dear R-experts,
>>
>>
>> How can I remove a certain feature or observation by a part of its name. To be clear, I have a matrix w...
2011 Jun 30
0
help with interpreting what nnet() output gives:
...ot;, sep=",", row.names=1, header=TRUE)
# Get groups information
groups<-data[,1]
# Get levels for groups
grp_levs<-levels(groups)
if (length(levels(groups)) > 2)
? ? print("Number of groups is greater than 2!") else {
? ? #
? ? # ? ?Split the matrix by group
? ? #
? ? new_mats<-c()
? ? for (ii in 1:length(grp_levs))
? ? ? ? new_mats[ii]<-list(data[which(groups==levels(groups)[ii]),])
? ??
? ? #
? ? # ? ?Calculate the means
? ? #
? ? # For each matrix, calculate the averages per column
? ? submeans<-c()
? ? # Preallocate a matrix for the means
? ? means<-matr...